AuthenticationContext Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The AuthenticationContext class retrieves authentication tokens from Azure Active Directory and ADFS services.
public sealed class AuthenticationContext
type AuthenticationContext = class
Public NotInheritable Class AuthenticationContext
- Inheritance
-
System.ObjectAuthenticationContext
Constructors
AuthenticationContext(String) |
Constructor to create the context with the address of the authority. Using this constructor will turn ON validation of the authority URL by default if validation is supported for the authority address. |
AuthenticationContext(String, Boolean) |
Constructor to create the context with the address of the authority and flag to turn address validation off. Using this constructor, address validation can be turned off. Make sure you are aware of the security implication of not validating the address. |
AuthenticationContext(String, Boolean, TokenCache) |
Constructor to create the context with the address of the authority and flag to turn address validation off. Using this constructor, address validation can be turned off. Make sure you are aware of the security implication of not validating the address. |
AuthenticationContext(String, TokenCache) |
Constructor to create the context with the address of the authority. Using this constructor will turn ON validation of the authority URL by default if validation is supported for the authority address. |
Properties
Authority |
Gets address of the authority to issue token. |
CorrelationId |
Gets or sets correlation Id which would be sent to the service with the next request. Correlation Id is to be used for diagnostics purposes. |
ExtendedLifeTimeEnabled |
Used to set the flag for AAD extended lifetime |
TokenCache |
Property to provide ADAL's token cache. Depending on the platform, TokenCache may have a default persistent cache or not. Library will automatically save tokens in default TokenCache whenever you obtain them. Cached tokens will be available only to the application that saved them. If the cache is persistent, the tokens stored in it will outlive the application's execution, and will be available in subsequent runs. To turn OFF token caching, set TokenCache to null. |
ValidateAuthority |
Gets a value indicating whether address validation is ON or OFF. |
Methods
AcquireDeviceCodeAsync(String, String) |
Acquires device code from the authority. |
AcquireDeviceCodeAsync(String, String, String) |
Acquires device code from the authority. |
AcquireTokenAsync(String, ClientAssertion) |
Acquires security token from the authority. |
AcquireTokenAsync(String, ClientAssertion, UserAssertion) |
Acquires an access token from the authority on behalf of a user. It requires using a user token previously received. |
AcquireTokenAsync(String, ClientCredential) |
Acquires security token from the authority. |
AcquireTokenAsync(String, ClientCredential, UserAssertion) |
Acquires an access token from the authority on behalf of a user. It requires using a user token previously received. |
AcquireTokenAsync(String, IClientAssertionCertificate) |
Acquires security token from the authority. |
AcquireTokenAsync(String, IClientAssertionCertificate, UserAssertion) |
Acquires an access token from the authority on behalf of a user. It requires using a user token previously received. |
AcquireTokenAsync(String, String, Uri, IPlatformParameters) |
Acquires security token from the authority. |
AcquireTokenAsync(String, String, Uri, IPlatformParameters, UserIdentifier) |
Acquires security token from the authority. |
AcquireTokenAsync(String, String, Uri, IPlatformParameters, UserIdentifier, String) |
Acquires security token from the authority. |
AcquireTokenAsync(String, String, Uri, IPlatformParameters, UserIdentifier, String, String) |
Acquires an access token from the authority on behalf of a user, passing in the necessary claims for authentication. It requires using a user token previously received. |
AcquireTokenAsync(String, String, UserAssertion) |
Acquires security token from the authority. |
AcquireTokenByAuthorizationCodeAsync(String, Uri, ClientAssertion) |
Acquires security token from the authority using an authorization code previously received. This method does not lookup token cache, but stores the result in it, so it can be looked up using other methods such as AcquireTokenSilentAsync(String, String, UserIdentifier). |
AcquireTokenByAuthorizationCodeAsync(String, Uri, ClientAssertion, String) |
Acquires security token from the authority using an authorization code previously received. This method does not lookup token cache, but stores the result in it, so it can be looked up using other methods such as AcquireTokenSilentAsync(String, String, UserIdentifier). |
AcquireTokenByAuthorizationCodeAsync(String, Uri, ClientCredential) |
Acquires security token from the authority using authorization code previously received. This method does not lookup token cache, but stores the result in it, so it can be looked up using other methods such as AcquireTokenSilentAsync(String, String, UserIdentifier). |
AcquireTokenByAuthorizationCodeAsync(String, Uri, ClientCredential, String) |
Acquires security token from the authority using an authorization code previously received. This method does not lookup token cache, but stores the result in it, so it can be looked up using other methods such as AcquireTokenSilentAsync(String, String, UserIdentifier). |
AcquireTokenByAuthorizationCodeAsync(String, Uri, IClientAssertionCertificate) |
Acquires security token from the authority using an authorization code previously received. This method does not lookup token cache, but stores the result in it, so it can be looked up using other methods such as AcquireTokenSilentAsync(String, String, UserIdentifier). |
AcquireTokenByAuthorizationCodeAsync(String, Uri, IClientAssertionCertificate, String) |
Acquires security token from the authority using an authorization code previously received. This method does not lookup token cache, but stores the result in it, so it can be looked up using other methods such as AcquireTokenSilentAsync(String, String, UserIdentifier). |
AcquireTokenByDeviceCodeAsync(DeviceCodeResult) |
Acquires security token from the authority using an device code previously received. This method does not lookup token cache, but stores the result in it, so it can be looked up using other methods such as AcquireTokenSilentAsync(String, String, UserIdentifier). |
AcquireTokenSilentAsync(String, ClientAssertion, UserIdentifier) |
Acquires security token without asking for user credential. |
AcquireTokenSilentAsync(String, ClientCredential, UserIdentifier) |
Acquires security token without asking for user credential. |
AcquireTokenSilentAsync(String, IClientAssertionCertificate, UserIdentifier) |
Acquires security token without asking for user credential. |
AcquireTokenSilentAsync(String, String) |
Acquires security token without asking for user credential. |
AcquireTokenSilentAsync(String, String, UserIdentifier) |
Acquires security token without asking for user credential. |
AcquireTokenSilentAsync(String, String, UserIdentifier, IPlatformParameters) |
Acquires security token without asking for user credential. |
GetAuthorizationRequestUrlAsync(String, String, Uri, UserIdentifier, String) |
Gets URL of the authorize endpoint including the query parameters. |
GetAuthorizationRequestUrlAsync(String, String, Uri, UserIdentifier, String, String) |
Gets URL of the authorize endpoint including the query parameters. |
Extension Methods
AcquireTokenAsync(AuthenticationContext, String, String, UserCredential) |
Acquires security token from the authority. |