Beispiel #1
0
        /// <summary>
        /// Construct the options from the given configuration section
        /// </summary>
        /// <param name="configSection"></param>
        public SPOptions(KentorAuthServicesSection configSection)
        {
            if (configSection == null)
            {
                throw new ArgumentNullException(nameof(configSection));
            }
            systemIdentityModelIdentityConfiguration = new IdentityConfiguration(true);

            ReturnUrl = configSection.ReturnUrl;
            MetadataCacheDuration = configSection.MetadataCacheDuration;
            DiscoveryServiceUrl = configSection.DiscoveryServiceUrl;
            EntityId = configSection.EntityId;
            ModulePath = configSection.ModulePath;
            Organization = configSection.Organization;
            AuthenticateRequestSigningBehavior = configSection.AuthenticateRequestSigningBehavior;

            configSection.ServiceCertificates.RegisterServiceCertificates(this);

            foreach (var acs in configSection.AttributeConsumingServices)
            {
                AttributeConsumingServices.Add(acs);
            }

            foreach (var contact in configSection.Contacts)
            {
                Contacts.Add(contact);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Construct the options from the given configuration section
        /// </summary>
        /// <param name="configSection"></param>
        public SPOptions(KentorAuthServicesSection configSection)
        {
            if (configSection == null)
            {
                throw new ArgumentNullException(nameof(configSection));
            }
            systemIdentityModelIdentityConfiguration = new IdentityConfiguration(true);

            ReturnUrl = configSection.ReturnUrl;
            MetadataCacheDuration = configSection.Metadata.CacheDuration;
            MetadataValidDuration = configSection.Metadata.ValidUntil;
            WantAssertionsSigned = configSection.Metadata.WantAssertionsSigned;
            ValidateCertificates = configSection.ValidateCertificates;
            DiscoveryServiceUrl = configSection.DiscoveryServiceUrl;
            EntityId = configSection.EntityId;
            ModulePath = configSection.ModulePath;
            PublicOrigin = configSection.PublicOrigin;
            Organization = configSection.Organization;
            AuthenticateRequestSigningBehavior = configSection.AuthenticateRequestSigningBehavior;
            NameIdPolicy = new Saml2NameIdPolicy(
                configSection.NameIdPolicyElement.AllowCreate, configSection.NameIdPolicyElement.Format);
            RequestedAuthnContext = new Saml2RequestedAuthnContext(configSection.RequestedAuthnContext);

            configSection.ServiceCertificates.RegisterServiceCertificates(this);

            foreach (var acs in configSection.AttributeConsumingServices)
            {
                AttributeConsumingServices.Add(acs);
            }

            foreach (var contact in configSection.Contacts)
            {
                Contacts.Add(contact);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Construct the options from the given configuration section
        /// </summary>
        /// <param name="configSection"></param>
        public SPOptions(KentorAuthServicesSection configSection)
        {
            if (configSection == null)
            {
                throw new ArgumentNullException(nameof(configSection));
            }
            systemIdentityModelIdentityConfiguration = new IdentityConfiguration(true);

            ReturnUrl             = configSection.ReturnUrl;
            MetadataCacheDuration = configSection.Metadata.CacheDuration;
            MetadataValidDuration = configSection.Metadata.ValidUntil;
            WantAssertionsSigned  = configSection.Metadata.WantAssertionsSigned;
            ValidateCertificates  = configSection.ValidateCertificates;
            DiscoveryServiceUrl   = configSection.DiscoveryServiceUrl;
            EntityId     = configSection.EntityId;
            ModulePath   = configSection.ModulePath;
            PublicOrigin = configSection.PublicOrigin;
            Organization = configSection.Organization;
            AuthenticateRequestSigningBehavior = configSection.AuthenticateRequestSigningBehavior;
            NameIdPolicy = new Saml2NameIdPolicy(
                configSection.NameIdPolicyElement.AllowCreate, configSection.NameIdPolicyElement.Format);
            RequestedAuthnContext = new Saml2RequestedAuthnContext(configSection.RequestedAuthnContext);

            configSection.ServiceCertificates.RegisterServiceCertificates(this);

            foreach (var acs in configSection.AttributeConsumingServices)
            {
                AttributeConsumingServices.Add(acs);
            }

            foreach (var contact in configSection.Contacts)
            {
                Contacts.Add(contact);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Construct the options from the given configuration section
        /// </summary>
        /// <param name="configSection"></param>
        public SPOptions(KentorAuthServicesSection configSection)
        {
            if (configSection == null)
            {
                throw new ArgumentNullException(nameof(configSection));
            }
            systemIdentityModelIdentityConfiguration = new IdentityConfiguration(true);

            ReturnUrl             = configSection.ReturnUrl;
            MetadataCacheDuration = configSection.MetadataCacheDuration;
            DiscoveryServiceUrl   = configSection.DiscoveryServiceUrl;
            EntityId     = configSection.EntityId;
            ModulePath   = configSection.ModulePath;
            Organization = configSection.Organization;
            AuthenticateRequestSigningBehavior = configSection.AuthenticateRequestSigningBehavior;
            NameIdPolicy = configSection.NameIdPolicy;

            configSection.ServiceCertificates.RegisterServiceCertificates(this);

            foreach (var acs in configSection.AttributeConsumingServices)
            {
                AttributeConsumingServices.Add(acs);
            }

            foreach (var contact in configSection.Contacts)
            {
                Contacts.Add(contact);
            }
        }
        public void KentorAuthServicesSection_Attributes_EmptyIfNotConfigured()
        {
            var subject = new KentorAuthServicesSection();
            subject.AllowChange(true);
            subject.Metadata = new MetadataElement();

            subject.AttributeConsumingServices.Should().BeEmpty();
        }
        public void KentorAuthServicesSection_PendingAuthStorageContainer_DefaultsToInMemoryIfNotConfigured()
        {
            var subject = new KentorAuthServicesSection();

            subject.PendingAuthStorageContainer.Should().BeOfType(typeof(Kentor.AuthServices.Internal.PendingAuthnInMemoryStorage));
        }