Class OAuthAccessTokenCredential

java.lang.Object
org.azd.authentication.OAuthAccessTokenCredential
All Implemented Interfaces:
AccessTokenCredential

public class OAuthAccessTokenCredential extends Object implements AccessTokenCredential
Represents OAuth authentication provider model.
See Also:
  • Constructor Details

    • OAuthAccessTokenCredential

      public OAuthAccessTokenCredential(String organizationUrl, String projectName, String appSecret, String authCode, String callbackUrl)
      Creates a new OAuth access token credential provider object.
      Parameters:
      organizationUrl - Azure DevOps services organization or TFS server collection url.
      projectName - Pass the project name.
      appSecret - URL encoded client secret acquired when the app was registered.
      authCode - URL encoded "code" provided via the code query parameter to your callback URL.
      callbackUrl - callback URL registered with the app.
    • OAuthAccessTokenCredential

      public OAuthAccessTokenCredential(String organizationUrl, String projectName, String appSecret, String authCode, String callbackUrl, AuthorizedToken authorizedToken)
      Creates a new OAuth access token credential provider object.
      Parameters:
      organizationUrl - Azure DevOps services organization or TFS server collection url.
      projectName - Pass the project name.
      appSecret - URL encoded client secret acquired when the app was registered.
      authCode - URL encoded "code" provided via the code query parameter to your callback URL.
      callbackUrl - callback URL registered with the app.
      authorizedToken - Authorized token object if OAuth token is already generated. This is for validating the and auto refreshing the token. AuthorizedToken
  • Method Details

    • getOrganizationUrl

      public String getOrganizationUrl()
      Gets the organization or tfs collection name.
      Specified by:
      getOrganizationUrl in interface AccessTokenCredential
      Returns:
      Organization name.
    • setOrganizationUrl

      public void setOrganizationUrl(String organizationUrl)
      Sets the organization or tfs collection name.
      Specified by:
      setOrganizationUrl in interface AccessTokenCredential
      Parameters:
      organizationUrl - Azure DevOps services or TFS collection url.
    • getProjectName

      public String getProjectName()
      Gets the project name.
      Specified by:
      getProjectName in interface AccessTokenCredential
      Returns:
      Project name.
    • setProjectName

      public void setProjectName(String projectName)
      Sets the project name.
      Specified by:
      setProjectName in interface AccessTokenCredential
      Parameters:
      projectName - Pass the project name.
    • getAccessToken

      public String getAccessToken()
      If not already authenticated, automatically authenticates, acquires the access token and returns it. Token refresh is automatically handled.
      Specified by:
      getAccessToken in interface AccessTokenCredential
      Returns:
      OAuth access token.
    • setAccessToken

      public void setAccessToken(String accessToken)
      Sets the oauth token.
      Specified by:
      setAccessToken in interface AccessTokenCredential
      Parameters:
      accessToken - OAuth access token.