artifactory-client-java icon indicating copy to clipboard operation
artifactory-client-java copied to clipboard

Use Artifactory API Key to login with artifactory.client

Open vincentfree opened this issue 9 years ago • 3 comments

If it's possible to log in with the Artifactory API key I could bypass the corporate LDAP. The LDAP can be a slowing factor and I read that the API key bypasses the problem.

When setting up the connection with Artifactory you can give X-JFrog-Art-Api: <YOUR_API_KEY> as header. the solution could look like:

//new part
if (apiKey) {
client.headers.'X-JFrog-Art-Api'= apiKey
}
//This is already there ->
if (username && password) {
            client.auth.basic username, password
            client.headers.Authorization = "Basic ${"$username:$password".toString().bytes.encodeBase64()}"
        }

vincentfree avatar Dec 30 '16 11:12 vincentfree

@vincentfree, Will you be able to test this and submit pull request? We'd gladly accept it.

eyalbe4 avatar Dec 30 '16 14:12 eyalbe4

Hey @eyalbe4 i'll submit a pull request and add tests. should not take to long, didn't have time with the new year etc.

vincentfree avatar Jan 02 '17 17:01 vincentfree

Great @vincentfree. Happy new year!

eyalbe4 avatar Jan 02 '17 17:01 eyalbe4