@Beta(value=V1_2_0) public class DelegatedTokenCredentials extends AzureTokenCredentials
| Modifier and Type | Class and Description |
|---|---|
static class |
DelegatedTokenCredentials.ResponseMode
Specifies the method that should be used to send the resulting token back to your app.
|
| Constructor and Description |
|---|
DelegatedTokenCredentials(ApplicationTokenCredentials applicationCredentials,
String redirectUrl)
Initializes a new instance of the DelegatedTokenCredentials.
|
DelegatedTokenCredentials(ApplicationTokenCredentials applicationCredentials,
String redirectUrl,
String authorizationCode)
Initializes a new instance of the DelegatedTokenCredentials, with a pre-acquired oauth2 authorization code.
|
| Modifier and Type | Method and Description |
|---|---|
String |
clientId() |
static DelegatedTokenCredentials |
fromFile(File authFile,
String redirectUrl)
Creates a new instance of the DelegatedTokenCredentials from an auth file.
|
static DelegatedTokenCredentials |
fromFile(File authFile,
String redirectUrl,
String authorizationCode)
Creates a new instance of the DelegatedTokenCredentials from an auth file,
with a pre-acquired oauth2 authorization code.
|
String |
generateAuthenticationUrl() |
String |
generateAuthenticationUrl(DelegatedTokenCredentials.ResponseMode responseMode,
String state)
Generate the URL to authenticate through OAuth2.
|
String |
getToken(String resource)
Override this method to provide the mechanism to get a token.
|
void |
setAuthorizationCode(String authorizationCode)
Set the authorization code acquired returned to the redirect URL.
|
applyCredentialsFilter, defaultSubscriptionId, domain, environment, getToken, proxy, withDefaultSubscriptionId, withProxygetSchemepublic DelegatedTokenCredentials(ApplicationTokenCredentials applicationCredentials, String redirectUrl)
applicationCredentials - the credentials representing a service principalredirectUrl - the URL to redirect to after authentication in Active Directorypublic DelegatedTokenCredentials(ApplicationTokenCredentials applicationCredentials, String redirectUrl, String authorizationCode)
applicationCredentials - the credentials representing a service principalredirectUrl - the URL to redirect to after authentication in Active DirectoryauthorizationCode - the oauth2 authorization codepublic static DelegatedTokenCredentials fromFile(File authFile, String redirectUrl) throws IOException
authFile - The credentials based on the fileredirectUrl - the URL to redirect to after authentication in Active DirectoryIOException - exception thrown from file access errors.public static DelegatedTokenCredentials fromFile(File authFile, String redirectUrl, String authorizationCode) throws IOException
authFile - The credentials based on the fileredirectUrl - the URL to redirect to after authentication in Active DirectoryauthorizationCode - the oauth2 authorization codeIOException - exception thrown from file access errors.public String clientId()
public String generateAuthenticationUrl()
public String generateAuthenticationUrl(DelegatedTokenCredentials.ResponseMode responseMode, String state)
responseMode - the method that should be used to send the resulting token back to your appstate - a value included in the request that is also returned in the token responsepublic void setAuthorizationCode(String authorizationCode)
authorizationCode - the oauth2 authorization codepublic String getToken(String resource) throws IOException
AzureTokenCredentialsgetToken in class AzureTokenCredentialsresource - the resource the access token is forIOException - exceptions from IOCopyright © 2019. All rights reserved.