credentials-plugin code examples

26 views
Skip to first unread message

Cletus D'Souza

unread,
Jan 30, 2015, 3:32:57 PM1/30/15
to Jenkins Dev Group
I'm looking to incorporate the credentials-plugin to manage credentials for my own plugin.  Where can I find some basic examples to obtain the following from saved credentials?

1. URI path
2. Username
3. Password

Thanks in advance!

Cletus

Stephen Connolly

unread,
Jan 31, 2015, 2:13:50 PM1/31/15
to jenkin...@googlegroups.com


On Friday, January 30, 2015, Cletus D'Souza <cletus...@hotmail.com> wrote:
I'm looking to incorporate the credentials-plugin to manage credentials for my own plugin.  Where can I find some basic examples to obtain the following from saved credentials?

1. URI path


Unless the credential type is one that declares storing this information, you cannot get it
 

2. Username


Any UsernameCredential has a standard method getUsername() to get the username
 

3. Password


Any PasswordCredential has the getPassword() method that returns a secret that has a getPlainText() method 




Thanks in advance!

Cletus

The basic idea is that the credentials plugin can *store* different kinds of credential and give them back again.

If your credentials do not fit the standard types, extend the closest fit and derive a new type. Then you can store and retrieve those credentials via a standard api and you don't have to keep reinventing the wheel like layering credentials with folders or providing a per-user credentials store.
 
 
 
 
 
 
 

 

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/SNT153-W912A2C1FEE191A3886ED9EC1310%40phx.gbl.
For more options, visit https://groups.google.com/d/optout.


--
Sent from my phone
Reply all
Reply to author
Forward
0 new messages