Пример #1
0
        public Saml2LogoutRequest(Saml2Configuration config) : base(config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            Destination  = config.SingleLogoutDestination;
            NotOnOrAfter = DateTimeOffset.UtcNow.AddMinutes(10);
        }
 public Saml2LogoutRequest(Saml2Configuration config, ClaimsPrincipal currentPrincipal) : this(config)
 {
     var identity = currentPrincipal.Identities.First();
     if (identity.IsAuthenticated)
     {
         var nameIdFormat = ReadClaimValue(identity, Saml2ClaimTypes.NameIdFormat, false);
         if (string.IsNullOrEmpty(nameIdFormat))
         {
             NameId = new Saml2NameIdentifier(ReadClaimValue(identity, Saml2ClaimTypes.NameId));
         }
         else
         {
             NameId = new Saml2NameIdentifier(ReadClaimValue(identity, Saml2ClaimTypes.NameId), new Uri(nameIdFormat));
         }
         SessionIndex = ReadClaimValue(identity, Saml2ClaimTypes.SessionIndex, false);
     }
 }
        public Saml2Request(Saml2Configuration config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            Config = config;
            Issuer = config.Issuer;
            IdentityConfiguration = Saml2IdentityConfiguration.GetIdentityConfiguration(config);

            Id           = new Saml2Id();
            Version      = Saml2Constants.VersionNumber;
            IssueInstant = DateTimeOffset.UtcNow;
#if DEBUG
            Debug.WriteLine("Message ID: " + Id);
#endif
        }
        public Saml2AuthnResponse(Saml2Configuration config) : base(config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            Destination = config.SingleSignOnDestination;

            if (config.DecryptionCertificate != null)
            {
                DecryptionCertificate = config.DecryptionCertificate;
                if (config.DecryptionCertificate.GetSamlRSAPrivateKey() == null)
                {
                    throw new ArgumentException("No RSA Private Key present in Decryption Certificate or missing private key read credentials.");
                }
            }
            Saml2SecurityTokenHandler = Saml2ResponseSecurityTokenHandler.GetSaml2SecurityTokenHandler(IdentityConfiguration);
        }
Пример #5
0
 public Saml2Response(Saml2Configuration config) : base(config)
 {
 }