I have a .Net Core 2.0 application that uses JWT tokens to authorize the user. This all works fine but I want to have some sort of API Key mechanism to allow other applicati
Applying Claim("role", "Admin")
to GenericPrincipal
will not affect anything, because GenericPrincipal
have nothing to do with Role Claims. So if you want to apply admin role to GenericPrincipal
, you need to add it in constructor parameter:
var principal = new GenericPrincipal(identity, new[] {"Admin","ApiUser"});
context.User = principal;