Contains information about the client credentials.
Inheritance: BaseValidatingClientContext
 private Task ValidateClientAuthentication(OAuthValidateClientAuthenticationContext context)
 {
     string clientId;
     string clientSecret;
     if (context.TryGetBasicCredentials(out clientId, out clientSecret) ||
         context.TryGetFormCredentials(out clientId, out clientSecret))
     {
         if (clientId == Clients.Client1.Id && clientSecret == Clients.Client1.Secret)
         {
             context.Validated();
         }
         else if (clientId == Clients.Client2.Id && clientSecret == Clients.Client2.Secret)
         {
             context.Validated();
         }
     }
     return Task.FromResult(0);
 }
 /// <summary>
 /// Called to validate that the origin of the request is a registered "client_id", and that the correct credentials for that client are
 /// present on the request. If the web application accepts Basic authentication credentials, 
 /// context.TryGetBasicCredentials(out clientId, out clientSecret) may be called to acquire those values if present in the request header. If the web 
 /// application accepts "client_id" and "client_secret" as form encoded POST parameters, 
 /// context.TryGetFormCredentials(out clientId, out clientSecret) may be called to acquire those values if present in the request body.
 /// If context.Validated is not called the request will not proceed further. 
 /// </summary>
 /// <param name="context">The context of the event carries information in and results out.</param>
 /// <returns>Task to enable asynchronous execution</returns>
 public virtual Task ValidateClientAuthentication(OAuthValidateClientAuthenticationContext context)
 {
     return OnValidateClientAuthentication.Invoke(context);
 }
Example #3
0
 /// <summary>
 /// Called to validate that the origin of the request is a registered "client_id", and that the correct credentials for that client are
 /// present on the request. If the web application accepts Basic authentication credentials,
 /// context.TryGetBasicCredentials(out clientId, out clientSecret) may be called to acquire those values if present in the request header. If the web
 /// application accepts "client_id" and "client_secret" as form encoded POST parameters,
 /// context.TryGetFormCredentials(out clientId, out clientSecret) may be called to acquire those values if present in the request body.
 /// If context.Validated is not called the request will not proceed further.
 /// </summary>
 /// <param name="context">The context of the event carries information in and results out.</param>
 /// <returns>Task to enable asynchronous execution</returns>
 public virtual Task ValidateClientAuthentication(OAuthValidateClientAuthenticationContext context)
 {
     return(OnValidateClientAuthentication.Invoke(context));
 }