ellenfieldn / IdentityServer4.WsFederation

Full .Net Core implementation of WsFederation for IdentityServer4
Apache License 2.0
12 stars 6 forks source link

NameID Missing in SAML 2 token #43

Open dimef opened 5 years ago

dimef commented 5 years ago

Name Identifier is missing in the WS Federation token, here is the XML tag:

      <saml:Subject>
        <saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer" />
      </saml:Subject>

a very fast fix:

        public async Task<string> GenerateSerializedRstr(ValidatedWsFederationSigninRequest request)
        {
            var principal = request.Subject.Identity as ClaimsIdentity;
            if (principal.FindFirst(ClaimTypes.NameIdentifier) == null) {
                principal.AddClaim(new Claim(ClaimTypes.NameIdentifier, principal.Name));
            }
          .......

I may create a PR with the code change

ellenfieldn commented 5 years ago

I'll try to put a fix in this weekend.

ellenfieldn commented 5 years ago

I have a PR out #45 if you want to look.

I'll complete it in a day or so along with whatever else I decide to put in the next version