User don't get authorized
zoranpro opened this issue · 3 comments
zoranpro commented
I tried your implementation but when I enter credentials and try access the resource I always get 401
.
Here is the code that I placed in Startup.cs
. I am using 1.0.0-beta4
packages.
app.UseBasicAuthentication(options =>
{
options.Authenticator = new GenericAuthenticator((username, password) => {
if (username != "admin") return null;
var claimIdentity = new ClaimsIdentity();
return claimIdentity;
});
});
Do I miss something here?
Kukkimonsuta commented
I think you need to use constructor of ClaimsIdentity
with authenticationType
parameter, otherwise IsAuthenticated
returns false -> you get 401.
zoranpro commented
Yes. That was the issue. Thank you so much.
Kukkimonsuta commented
No problem. Let me know if you run into some other troubles.