protected override void ProcessAuthenticationStatement(Saml2AuthenticationStatement statement, ClaimsIdentity subject, string issuer)
        {
            if (statement.AuthenticationContext != null)
            {
                statement.AuthenticationContext.DeclarationReference = null;
            }
            base.ProcessAuthenticationStatement(statement, subject, issuer);

            if (statement.SessionIndex != null)
            {
                var nameIdClaim = subject.FindFirst(ClaimTypes.NameIdentifier);

                subject.AddClaim(
                    new Claim(
                        AuthServicesClaimTypes.LogoutNameIdentifier,
                        DelimitedString.Join(
                            nameIdClaim.Properties.GetValueOrEmpty(ClaimProperties.SamlNameIdentifierNameQualifier),
                            nameIdClaim.Properties.GetValueOrEmpty(ClaimProperties.SamlNameIdentifierSPNameQualifier),
                            nameIdClaim.Properties.GetValueOrEmpty(ClaimProperties.SamlNameIdentifierFormat),
                            nameIdClaim.Properties.GetValueOrEmpty(ClaimProperties.SamlNameIdentifierSPProvidedId),
                            nameIdClaim.Value),
                        null,
                        issuer));

                subject.AddClaim(
                    new Claim(AuthServicesClaimTypes.SessionIndex, statement.SessionIndex, null, issuer));
            }
        }
Пример #2
0
        public void DelimitedString_Join()
        {
            var actual = DelimitedString.Join("aaa", "b/b", "c,c", "d/,d", "/", "e");

            actual.Should().Be("aaa,b//b,c/,c,d///,d,//,e");
        }