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
ConstructorDescriptionOAuthAccessTokenCredential
(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.void
setAccessToken
(String accessToken) Sets the oauth token.void
setOrganizationUrl
(String organizationUrl) Sets the organization or tfs collection name.void
setProjectName
(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:
getOrganizationUrl
in interfaceAccessTokenCredential
- Returns:
- Organization name.
-
setOrganizationUrl
Sets the organization or tfs collection name.- Specified by:
setOrganizationUrl
in interfaceAccessTokenCredential
- Parameters:
organizationUrl
- Azure DevOps services or TFS collection url.
-
getProjectName
Gets the project name.- Specified by:
getProjectName
in interfaceAccessTokenCredential
- Returns:
- Project name.
-
setProjectName
Sets the project name.- Specified by:
setProjectName
in 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:
getAccessToken
in interfaceAccessTokenCredential
- Returns:
- OAuth access token.
-
setAccessToken
Sets the oauth token.- Specified by:
setAccessToken
in interfaceAccessTokenCredential
- Parameters:
accessToken
- OAuth access token.
-