Class BitbucketAccessTokenAuthenticator

java.lang.Object
com.cloudbees.jenkins.plugins.bitbucket.credentials.BitbucketAccessTokenAuthenticator
All Implemented Interfaces:
BitbucketAuthenticator

public class BitbucketAccessTokenAuthenticator extends Object implements BitbucketAuthenticator
Authenticator that uses an access token.
  • Constructor Details

    • BitbucketAccessTokenAuthenticator

      public BitbucketAccessTokenAuthenticator(org.jenkinsci.plugins.plaincredentials.StringCredentials credentials)
      Constructor.
      Parameters:
      credentials - the access token that will be used
  • Method Details

    • configureRequest

      public void configureRequest(org.apache.http.HttpRequest request)
      Provides the access token as header.
      Specified by:
      configureRequest in interface BitbucketAuthenticator
      Parameters:
      request - to configure with the access token
    • getCredentialsForSCM

      public com.cloudbees.plugins.credentials.common.StandardUsernameCredentials getCredentialsForSCM()
      Provides with the Git command line interface.

      As per documentation the username must be x-token-auth and the password is the token.

      Specified by:
      getCredentialsForSCM in interface BitbucketAuthenticator
      Returns:
      the UsernamePasswordCredentials credential to be used with Git command line interface
    • getId

      public String getId()
      Specified by:
      getId in interface BitbucketAuthenticator
      Returns:
      id of the credentials used.