Package org.azd.authentication
Class OAuthAccessTokenCredential
java.lang.Object
org.azd.authentication.OAuthAccessTokenCredential
- All Implemented Interfaces:
AccessTokenCredential
Represents OAuth authentication provider model.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionOAuthAccessTokenCredential(String organizationUrl, String projectName, String appSecret, String authCode, String callbackUrl) Creates a new OAuth access token credential provider object.OAuthAccessTokenCredential(String organizationUrl, String projectName, String appSecret, String authCode, String callbackUrl, AuthorizedToken authorizedToken) Creates a new OAuth access token credential provider object. -
Method Summary
Modifier and TypeMethodDescriptionIf not already authenticated, automatically authenticates, acquires the access token and returns it.Gets the organization or tfs collection name.Gets the project name.voidsetAccessToken(String accessToken) Sets the oauth token.voidsetOrganizationUrl(String organizationUrl) Sets the organization or tfs collection name.voidsetProjectName(String projectName) Sets the project name.
-
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
Gets the organization or tfs collection name.- Specified by:
getOrganizationUrlin interfaceAccessTokenCredential- Returns:
- Organization name.
-
setOrganizationUrl
Sets the organization or tfs collection name.- Specified by:
setOrganizationUrlin interfaceAccessTokenCredential- Parameters:
organizationUrl- Azure DevOps services or TFS collection url.
-
getProjectName
Gets the project name.- Specified by:
getProjectNamein interfaceAccessTokenCredential- Returns:
- Project name.
-
setProjectName
Sets the project name.- Specified by:
setProjectNamein interfaceAccessTokenCredential- Parameters:
projectName- Pass the project name.
-
getAccessToken
If not already authenticated, automatically authenticates, acquires the access token and returns it. Token refresh is automatically handled.- Specified by:
getAccessTokenin interfaceAccessTokenCredential- Returns:
- OAuth access token.
-
setAccessToken
Sets the oauth token.- Specified by:
setAccessTokenin interfaceAccessTokenCredential- Parameters:
accessToken- OAuth access token.
-