1

Good Day Everyone

I have this wierd happening to our application, I have a Blazor Server Side application that has a ITFoxtec as our SAML2 authentication with our global company as a provider, then I add a controller where the authentication will start.

We have 2 SAML2 provider, one is for our production and one is for our stage environment, last year, we test the SAML2 on our staging and it's working, then when we deployed it on our production environment it is also working, it provides authorization on both the MVC and Blazor components, and it's working properly

Then for our staging we switch the authentication to simple login, in order for us to test different users and roles, then months after, when we used the SAML2 to our staging environment, a strange things happened, the Blazor components can get the authenticated user but the MVC are not, the authentication is true, but the User.Identity.Name is null

We didn't change anything on the setup of our SAML2 coding, only the IdPMetadata, Issuer and Saml2 config on our appsettings.json

It's very strange as it works on our production normally but on staging is not.

Does anyone encounter this wierd thing in SAML2 and ITFoxtec?

Thanks and regards

  • Can you be sure that the changed IdPMetadata and Issuer are correct? If it's correct, it's possible that you don't have a claim that matches the default name claim type. You have the NameIdentifier claim (which is what the idp supplies by default). But you don't have a claim with the default `NameClaimType`. – Chen Oct 18 '22 at 07:33
  • You can refer to [this link](https://stackoverflow.com/a/53906240/18789859). – Chen Oct 18 '22 at 07:35

1 Answers1

0

I think it is because the IdP do not return an NameID value which is interpreted as ClaimTypes.NameIdentifier = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier" in .NET.

You can change the ClaimTypes.NameIdentifier parameter to a claim you get return in the ClaimsTransform.cs, pleass see: https://github.com/ITfoxtec/ITfoxtec.Identity.Saml2/blob/master/test/TestWebAppCore/Identity/ClaimsTransform.cs#L31

Anders Revsgaard
  • 3,636
  • 1
  • 9
  • 25