TokenRequestContext Class
- java.
lang. Object - com.
azure. core. credential. TokenRequestContext
- com.
public class TokenRequestContext
The TokenRequestContext is a class used to provide additional information and context when requesting an access token from an authentication source. It allows you to customize the token request and specify additional parameters, such as scopes, claims, or authentication options.
The TokenRequestContext is typically used with authentication mechanisms that require more advanced configurations or options, such as Azure Active Directory (Azure AD) authentication.
Here's a high-level overview of how you can use the TokenRequestContext:
- Create an instance of the TokenRequestContext class and configure the required properties. The TokenRequestContext class allows you to specify the scopes or resources for which you want to request an access token, as well as any additional claims or options.
- Pass the TokenRequestContext instance to the appropriate authentication client or mechanism when requesting an access token. The specific method or API to do this will depend on the authentication mechanism you are using. For example, if you are using Azure Identity for AAD authentication, you would pass the TokenRequestContext instance to the getToken method of the TokenCredential implementation.
- The authentication client or mechanism will handle the token request and return an access token that can be used to authenticate and authorize requests to Azure services.
Constructor Summary
| Constructor | Description |
|---|---|
| TokenRequestContext() |
Creates a token request instance. |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
|
Token |
addScopes(String[] scopes)
Adds one or more scopes to the request scopes. |
| String |
getClaims()
Get the additional claims to be included in the token. |
|
Proof |
getProofOfPossessionOptions()
Gets the proof of possession options. |
| List<String> |
getScopes()
Gets the scopes required for the token. |
| String |
getTenantId()
Get the tenant id to be used for the authentication request. |
| boolean |