I am looking to write a MVC5 application that uses Windows Authentication.
As per the boilerplate code the @User.Identity.Name
claims are populated automatically.
I would like to transform incoming claims with my own logic and enrich them so roles are assigned for users:
class SimpleClaimsAuthenticatonManager : ClaimsAuthenticationManager
{
public override ClaimsPrincipal Authenticate(string resourceName, ClaimsPrincipal incomingPrincipal)
{
if (incomingPrincipal != null && incomingPrincipal.Identity.IsAuthenticated == true)
{
((ClaimsIdentity)incomingPrincipal.Identity).AddClaim(new Claim(ClaimTypes.Role, "User"));
}
return incomingPrincipal;
}
}
Does Thinktecture identity model library support a way to wire up the above custom AuthenticationManager in to the MVC5 pipeline?