public class ApplicationTokenCredentials extends AzureTokenCredentials
Constructor and Description |
---|
ApplicationTokenCredentials(String clientId,
String domain,
byte[] certificate,
String password,
AzureEnvironment environment)
Initializes a new instance of the ApplicationTokenCredentials.
|
ApplicationTokenCredentials(String clientId,
String domain,
String secret,
AzureEnvironment environment)
Initializes a new instance of the ApplicationTokenCredentials.
|
Modifier and Type | Method and Description |
---|---|
String |
clientId()
Gets the active directory application client id.
|
static ApplicationTokenCredentials |
fromFile(File credentialsFile)
Initializes the credentials based on the provided credentials file.
|
String |
getToken(String resource)
Override this method to provide the mechanism to get a token.
|
applyCredentialsFilter, defaultSubscriptionId, domain, environment, getToken, proxy, withDefaultSubscriptionId, withProxy
getScheme
public ApplicationTokenCredentials(String clientId, String domain, String secret, AzureEnvironment environment)
clientId
- the active directory application client id. Also known as Application Id which Identifies the application that is using the token.domain
- the domain or tenant id containing this application.secret
- the authentication secret for the application.environment
- the Azure environment to authenticate with.
If null is provided, AzureEnvironment.AZURE will be used.public ApplicationTokenCredentials(String clientId, String domain, byte[] certificate, String password, AzureEnvironment environment)
clientId
- the active directory application client id. Also known as Application Id which Identifies the application that is using the token.domain
- the domain or tenant id containing this application.certificate
- the PKCS12 certificate file contentpassword
- the password to the certificate fileenvironment
- the Azure environment to authenticate with.
If null is provided, AzureEnvironment.AZURE will be used.public static ApplicationTokenCredentials fromFile(File credentialsFile) throws IOException
credentialsFile
- A file with credentials, using the standard Java properties format.
and the following keys:
subscription=<subscription-id>
tenant=<tenant-id>
client=<client-id>
key=<client-key>
managementURI=<management-URI>
baseURL=<base-URL>
authURL=<authentication-URL>
or a JSON format and the following keys
{
"clientId": "<client-id>",
"clientSecret": "<client-key>",
"subscriptionId": "<subscription-id>",
"tenantId": "<tenant-id>",
}
and any custom endpoints listed in AzureEnvironment
.IOException
- exception thrown from file access errors.public String clientId()
public String getToken(String resource) throws IOException
AzureTokenCredentials
getToken
in class AzureTokenCredentials
resource
- the resource the access token is forIOException
- exceptions from IOCopyright © 2019. All rights reserved.