Пример #1
0
        public string GetSaml11Token()
        {
            var      claimSets = new List <ClaimSet>(ServiceSecurityContext.Current.AuthorizationContext.ClaimSets);
            ClaimSet claimSet  = claimSets.Find((Predicate <ClaimSet>) delegate(ClaimSet target)
            {
                WindowsClaimSet defaultClaimSet = target.Issuer as WindowsClaimSet;
                return(defaultClaimSet != null);
            });

            var               accessControlClaims = claimSet.FindClaims(ClaimTypes.Sid, Rights.PossessProperty);
            SamlAssertion     assertion           = Saml11Helper.CreateSamlAssertionFromUserNameClaims(accessControlClaims);
            SamlSecurityToken token = new SamlSecurityToken(assertion);

            return(Saml11Helper.SerializeSamlToken(token));
        }
Пример #2
0
 private static void SerializeSamlTokenToFile(SamlSecurityToken token)
 {
     using (var sw = new StreamWriter(@"C:\Data\SVN-Client\dialog\Dialog\WindowsIdentityToClaimsConsole\saml.xml"))
     {
         try
         {
             var xml = Saml11Helper.SerializeSamlToken(token);
             sw.Write(xml);
             Console.WriteLine("Saml Token Successfully Written");
         }
         catch (Exception ex)
         {
             Console.WriteLine("Failed to save Saml Token to Disk");
         }
     }
 }