builder.AddJwtBearer(options =>
{
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuer = true,
ValidateAudience = true,
ValidIssuer = authOptions.Issuer,
ValidAudience = authOptions.Audience,
ValidateIssuerSigningKey = true,
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(authOptions.Key)),
};
})
.AddScheme<AuthServerAuthenticationSchemeOptions, AuthServerAuthenticationHandler>("CustomAuth", options => { options.Authority = authOptions.Authority; });
}
As from above code multiple authentications are added, what I want to achieve is if AddJwtBearer succeeds then request should forwarded to CustomAuth. As per above code the CustomAuth does not get hit on HandleAuthenticateAsync, only JwtBearer is validating the request.