Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible values of HttpContext.User.Identity.AuthenticationType

In ASP.NET Core, with Identity, I always get this:

HttpContext.User.Identity.AuthenticationType == "Identity.Application"

What is the significance of this? Are there any other values it could be?

like image 375
grokky Avatar asked Jun 19 '26 17:06

grokky


1 Answers

When I setup everything to use Windows authentication, I get HttpContext.User.Identity.AuthenticationType = Kerberos, that would be an example.

Also, when I do my own login:

        ClaimsPrincipal principal = new ClaimsPrincipal(new ClaimsIdentity(
            new List<Claim>{
                new Claim(ClaimTypes.Name, username),
                new Claim(PartnersUserDataClaim, userData),
                new Claim(ModuleNameClaim, moduleName)
            },
            "SSO/Windows"));

        await HttpContext.Authentication.SignInAsync(APIAuthSchemeName, principal);

"SSO/Windows" ends up being the value of HttpContext.User.Identity.AuthenticationType

So, I would say this attribute can be set by whatever layer is able of creating your principal, whether it's a provided middleware like the IIS one for Kerberos, or your own layer.

like image 81
Daboul Avatar answered Jun 24 '26 08:06

Daboul



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!