[英]How to get Jenkins username and password property
I have a Jenkins job where I login to a website. 我有一个詹金斯(Jenkins)工作,我登录到一个网站。 The username and password for the website is the same username and password I use for Jenkins.
该网站的用户名和密码与我用于Jenkins的用户名和密码相同。 I want to get the Jenkins username and password and and pass it to the java code i have written to login to the website.
我想获取Jenkins用户名和密码,并将其传递给我编写的用于登录网站的Java代码。
How do I get the Jenkins Username and Password properties? 如何获得Jenkins用户名和密码属性?
Background: Lets say I use "username1" and "password1" to login to Jenkins. 背景:假设我使用“ username1”和“ password1”登录到Jenkins。 I have a website that uses this same login credentials.
我有一个使用相同登录凭据的网站。 I have a jenkins job created to login to this website.
我创建了一个詹金斯工作来登录该网站。 This jenkins job is used by a lot of people.
这个詹金斯工作被很多人使用。 I want to write the Java code in such a way that when each person login to the system and run this jenkin job, it will get the username and password that this person logged into jenkins and use that username and password to login to the website.
我想以这样的方式编写Java代码:当每个人登录系统并运行此jenkin作业时,它将获得此人登录jenkins的用户名和密码,并使用该用户名和密码登录网站。 So no one will be able to get the password of others.
因此,没有人能够获得他人的密码。 They will be using their own username and password.
他们将使用自己的用户名和密码。
There is no generic solution for this. 没有通用的解决方案。
Only in the very special case where you select "Jenkins' own user database" as Security Realm, you might be able to retrieve the password. 仅在非常特殊的情况下,您选择“ Jenkins自己的用户数据库”作为Security Realm,您才可以检索密码。 However, local Jenkins credentials will conflict with your very idea sharing credentials with other services...
但是,本地Jenkins凭证将与您与其他服务共享凭证的想法冲突。
Possibly, delegating Jenkins authentication to a servlet container can help -- if you manage to connect the servlet container's authentication machinery to the services that you need to use. 将Jenkins身份验证委派给Servlet容器可能会有所帮助-如果您设法将Servlet容器的身份验证机制连接到需要使用的服务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.