We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@mihirdilip when I use the context.ValidationFailed("Message") inside the OnValidateKey event, how to get the message in this custom middleware?
context.ValidationFailed("Message")
It´s not possible to get with PolicyAuthorizationResult.FailureReasons
public class AuthorizationMiddleware : IAuthorizationMiddlewareResultHandler { private readonly IAuthorizationMiddlewareResultHandler _handler; public AuthorizationMiddleware() { _handler = new AuthorizationMiddlewareResultHandler(); } public async Task HandleAsync(RequestDelegate requestDelegate, HttpContext httpContext, AuthorizationPolicy authorizationPolicy, PolicyAuthorizationResult policyAuthorizationResult) { if (!policyAuthorizationResult.Succeeded) { Models.ResponseDefault responseDefault = new(false, new[] { "O usuário não está autenticado" }); httpContext.Response.ContentType = "application/json"; httpContext.Response.StatusCode = 401; await httpContext.Response.WriteAsync(JsonConvert.SerializeObject(responseDefault)); return; } await _handler.HandleAsync(requestDelegate, httpContext, authorizationPolicy, policyAuthorizationResult); } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
@mihirdilip when I use the
context.ValidationFailed("Message")
inside the OnValidateKey event, how to get the message in this custom middleware?It´s not possible to get with PolicyAuthorizationResult.FailureReasons
The text was updated successfully, but these errors were encountered: