Package com.azure.core.credential
Class TokenRequestContext
java.lang.Object
com.azure.core.credential.TokenRequestContext
Contains details of a request to get a token.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds one or more scopes to the request scopes.Get the additional claims to be included in the token.Gets the scopes required for the token.Get the tenant id to be used for the authentication request.booleanGet the status indicating whether Continuous Access Evaluation (CAE) is enabled for the requested token.setCaeEnabled(boolean enableCae) Indicates whether to enable Continuous Access Evaluation (CAE) for the requested token.Set the additional claims to be included in the token.Sets the scopes required for the token.setTenantId(String tenantId) Set the tenant id to be used for the authentication request.
-
Constructor Details
-
TokenRequestContext
public TokenRequestContext()Creates a token request instance.
-
-
Method Details
-
getScopes
Gets the scopes required for the token.- Returns:
- the scopes required for the token
-
setScopes
Sets the scopes required for the token.- Parameters:
scopes- the scopes required for the token- Returns:
- the TokenRequestContext itself
-
addScopes
Adds one or more scopes to the request scopes.- Parameters:
scopes- one or more scopes to add- Returns:
- the TokenRequestContext itself
-
setClaims
Set the additional claims to be included in the token.- Parameters:
claims- the additional claims to be included in the token.- Returns:
- the updated TokenRequestContext itself
- See Also:
-
getClaims
Get the additional claims to be included in the token.- Returns:
- the additional claims to be included in the token.
- See Also:
-
setTenantId
Set the tenant id to be used for the authentication request.- Parameters:
tenantId- the tenant to be used when requesting the token.- Returns:
- the updated TokenRequestContext itself
-
getTenantId
Get the tenant id to be used for the authentication request.- Returns:
- the configured tenant id.
-
setCaeEnabled
Indicates whether to enable Continuous Access Evaluation (CAE) for the requested token.If a resource API implements CAE and your application declares it can handle CAE, your app receives CAE tokens for that resource. For this reason, if you declare your app CAE ready, your application must handle the CAE claim challenge for all resource APIs that accept Microsoft Identity access tokens. If you don't handle CAE responses in these API calls, your app could end up in a loop retrying an API call with a token that is still in the returned lifespan of the token but has been revoked due to CAE.
- Parameters:
enableCae- the flag indicating whether to enable Continuous Access Evaluation (CAE) for the requested token.- Returns:
- the updated TokenRequestContext.
-
isCaeEnabled
public boolean isCaeEnabled()Get the status indicating whether Continuous Access Evaluation (CAE) is enabled for the requested token.- Returns:
- the flag indicating whether CAE authentication should be used or not.
-