예제 #1
0
 /// <summary>
 /// Acquires an access token from the authority on behalf of a user. It requires using a user token previously received.
 /// </summary>
 /// <param name="resource">Identifier of the target resource that is the recipient of the requested token.</param>
 /// <param name="clientAssertion">The client assertion to use for token acquisition.</param>
 /// <param name="userAssertion">The user assertion (token) to use for token acquisition.</param>
 /// <returns>It contains Access Token and the Access Token's expiration time.</returns>
 public async Task <AuthenticationResult> AcquireTokenAsync(string resource, ClientAssertion clientAssertion, UserAssertion userAssertion)
 {
     return(await this.AcquireTokenOnBehalfCommonAsync(resource, new ClientKey(clientAssertion), userAssertion));
 }
예제 #2
0
 /// <summary>
 /// Acquires security token without asking for user credential.
 /// </summary>
 /// <param name="resource">Identifier of the target resource that is the recipient of the requested token.</param>
 /// <param name="clientAssertion">The client assertion to use for token acquisition.</param>
 /// <param name="userId">Identifier of the user token is requested for. This parameter can be <see cref="UserIdentifier"/>.Any.</param>
 /// <returns>It contains Access Token, Refresh Token and the Access Token's expiration time. If acquiring token without user credential is not possible, the method throws AdalException.</returns>
 public async Task <AuthenticationResult> AcquireTokenSilentAsync(string resource, ClientAssertion clientAssertion, UserIdentifier userId)
 {
     return(await this.AcquireTokenSilentCommonAsync(resource, new ClientKey(clientAssertion), userId, null));
 }
예제 #3
0
 /// <summary>
 /// 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 <see cref="AuthenticationContext.AcquireTokenSilentAsync(string, string, UserIdentifier)"/>.
 /// </summary>
 /// <param name="authorizationCode">The authorization code received from service authorization endpoint.</param>
 /// <param name="redirectUri">The redirect address used for obtaining authorization code.</param>
 /// <param name="clientAssertion">The client assertion to use for token acquisition.</param>
 /// <param name="resource">Identifier of the target resource that is the recipient of the requested token. It can be null if provided earlier to acquire authorizationCode.</param>
 /// <returns>It contains Access Token, Refresh Token and the Access Token's expiration time.</returns>
 public async Task <AuthenticationResult> AcquireTokenByAuthorizationCodeAsync(string authorizationCode, Uri redirectUri, ClientAssertion clientAssertion, string resource)
 {
     return(await this.AcquireTokenByAuthorizationCodeCommonAsync(authorizationCode, redirectUri, new ClientKey(clientAssertion), resource));
 }