Ejemplo n.º 1
0
 /// <summary>
 /// Acquires security token without asking for user credential.
 /// </summary>
 /// <param name="ctx">Authentication context instance</param>
 /// <param name="resource">Identifier of the target resource that is the recipient of the requested token.</param>
 /// <param name="clientCredential">The client credential 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, its expiration time, user information. If acquiring token without user credential is not possible, the method throws AdalException.</returns>
 public static async Task <AuthenticationResult> AcquireTokenSilentAsync(this AuthenticationContext ctx,
                                                                         string resource,
                                                                         ClientCredential clientCredential, UserIdentifier userId)
 {
     return(await ctx.AcquireTokenSilentCommonAsync(resource, new ClientKey(clientCredential), userId, null)
            .ConfigureAwait(false));
 }