I downloaded the katana project and wanted to try the client / server in the sandbox project.
I got into a problem for OAuthValidateClientAuthenticationContext:
public bool TryGetFormCredentials(out string clientId, out string clientSecret) { clientId = Parameters.Get(Constants.Parameters.ClientId); if (!String.IsNullOrEmpty(clientId)) { clientSecret = Parameters.Get(Constants.Parameters.ClientSecret); ClientId = clientId; return true; } clientId = null; clientSecret = null; return false; }
clientSecret is null and therefore the following does not validate the client.
private Task ValidateClientAuthentication(OAuthValidateClientAuthenticationContext context) { string clientId; string clientSecret; if (context.TryGetBasicCredentials(out clientId, out clientSecret) || context.TryGetFormCredentials(out clientId, out clientSecret)) { if (clientId == "123456" && clientSecret == "abcdef") { context.Validated(); } else if (context.ClientId == "7890ab" && clientSecret == "7890ab") { context.Validated(); } } return Task.FromResult(0); }
source share