/// <inheritdoc /> public async Task ValidateClientAuthentication(ValidateClientAuthenticationContext context) { var data = await context.HttpContext.RequestFormDataDictionaryAsync(); if (data?.ContainsKey("grant_type") == true && data["grant_type"].ToString() == "password") { context.Validated(data.ContainsKey("username") ? data["username"].ToString() : string.Empty); } else { context.Rejected(); } }
/// <summary> /// Validates a Client Authentication /// </summary> /// <param name="context"></param> /// <returns></returns> public async Task ValidateClientAuthentication(ValidateClientAuthenticationContext context) { var data = context.HttpContext.RequestFormData(); if (data.ContainsKey("grant_type") == false || data["grant_type"] != "password") { context.Rejected(); } else { context.Validated(data.ContainsKey("username") ? data["username"] : string.Empty); } }