How can I reject a person? My class inherits from OAuthBearerAuthenticationProvider and do I have a ValidateIdentity override?
I tried setting context.Rejected (); or context.SetError (); and throwing an exception, but my controllers are still being called. OAuthBearerAuthenticationHandler really calls my class, so I know that I have the correct setting.
my current error code
public void ConfigureAuth ( IAppBuilder app )
{
app.UseCookieAuthentication(new CookieAuthenticationOptions());
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
app.UseOAuthBearerAuthentication ( new OAuthBearerAuthenticationOptions ()
{
Provider = new OAuthBearerAuthenticationProvider ()
{
OnValidateIdentity = async ctx => { ctx.Rejected (); }
}
} );
app.UseOAuthBearerTokens(OAuthOptions);
}
source
share