コード例 #1
0
        public AuthnRequestConfiguration(string requestId, EntityDesriptorConfiguration entityDesriptorConfiguration, FederationPartyAuthnRequestConfiguration federationPartyAuthnRequestConfiguration)
            : base(requestId, federationPartyAuthnRequestConfiguration.Version, entityDesriptorConfiguration)
        {
            if (entityDesriptorConfiguration == null)
            {
                throw new ArgumentNullException("entityDesriptorConfiguration");
            }

            if (federationPartyAuthnRequestConfiguration == null)
            {
                throw new ArgumentNullException("federationPartyAuthnRequestConfiguration");
            }
            this._federationPartyAuthnRequestConfiguration = federationPartyAuthnRequestConfiguration;
            this.AudienceRestriction = new List <string> {
                entityDesriptorConfiguration.EntityId
            };
            this.ForceAuthn                         = federationPartyAuthnRequestConfiguration.ForceAuthn;
            this.IsPassive                          = federationPartyAuthnRequestConfiguration.IsPassive;
            this.EncryptNameId                      = federationPartyAuthnRequestConfiguration.DefaultNameId.EncryptNameId;
            this.AllowCreateNameIdPolicy            = federationPartyAuthnRequestConfiguration.DefaultNameId.AllowCreate;
            this.SupportedNameIdentifierFormats     = new List <Uri>();
            this.DefaultNameIdFormat                = federationPartyAuthnRequestConfiguration.DefaultNameId.NameIdFormat;
            this.RequestedAuthnContextConfiguration = federationPartyAuthnRequestConfiguration.RequestedAuthnContextConfiguration;
            this.ScopingConfiguration               = federationPartyAuthnRequestConfiguration.ScopingConfiguration;
        }
コード例 #2
0
        public AuthnRequestConfiguration(EntityDesriptorConfiguration entityDesriptorConfiguration, ScopingConfiguration scopingConfiguration, FederationPartyAuthnRequestConfiguration federationPartyAuthnRequestConfiguration)
        {
            if (entityDesriptorConfiguration == null)
            {
                throw new ArgumentNullException("entityDesriptorConfiguration");
            }

            if (federationPartyAuthnRequestConfiguration == null)
            {
                throw new ArgumentNullException("federationPartyAuthnRequestConfiguration");
            }
            if (federationPartyAuthnRequestConfiguration.RequestedAuthnContextConfiguration == null)
            {
                throw new ArgumentNullException("requestedAuthnContextConfiguration");
            }

            this._entityDesriptorConfiguration = entityDesriptorConfiguration;
            this.EntityId  = entityDesriptorConfiguration.EntityId;
            this.RequestId = String.Format("{0}_{1}", entityDesriptorConfiguration.Id, Guid.NewGuid().ToString());
            this.AssertionConsumerServiceIndex = (ushort)entityDesriptorConfiguration.SPSSODescriptors.SelectMany(x => x.AssertionConsumerServices)
                                                 .Single(x => x.IsDefault.GetValueOrDefault()).Index;
            this.AudienceRestriction = new List <string> {
                entityDesriptorConfiguration.EntityId
            };
            this.ForceAuthn                         = federationPartyAuthnRequestConfiguration.ForceAuthn;
            this.IsPassive                          = federationPartyAuthnRequestConfiguration.IsPassive;
            this.Version                            = federationPartyAuthnRequestConfiguration.Version;
            this.EncryptNameId                      = federationPartyAuthnRequestConfiguration.DefaultNameId.EncryptNameId;
            this.AllowCreateNameIdPolicy            = federationPartyAuthnRequestConfiguration.DefaultNameId.AllowCreate;
            this.SupportedNameIdentifierFormats     = new List <Uri>();
            this.DefaultNameIdFormat                = federationPartyAuthnRequestConfiguration.DefaultNameId.NameIdFormat;
            this.RequestedAuthnContextConfiguration = federationPartyAuthnRequestConfiguration.RequestedAuthnContextConfiguration;
            this.ScopingConfiguration               = scopingConfiguration;
        }
コード例 #3
0
        public static EntityDesriptorConfiguration BuildEntityDesriptorConfiguration()
        {
            var federationId = String.Format("{0}_{1}", "flowz", Guid.NewGuid());
            var entityDescriptorConfiguration = new EntityDesriptorConfiguration
            {
                CacheDuration = TimeSpan.FromDays(100),
                EntityId      = "Imperial.flowz.co.uk",
                Id            = federationId,
                ValidUntil    = new DateTimeOffset(DateTime.Now.AddDays(30)),
                Organisation  = MetadataHelper.BuikdOrganisationConfiguration()
            };

            return(entityDescriptorConfiguration);
        }
コード例 #4
0
        protected virtual EntityDescriptor BuildEntityDesciptor(EntityDesriptorConfiguration configuration, IEnumerable <RoleDescriptor> descriptors)
        {
            var entityDescriptor = new EntityDescriptor()
            {
                EntityId     = new EntityId(configuration.EntityId),
                FederationId = configuration.Id
            };

            descriptors.Aggregate(entityDescriptor, (ed, next) =>
            {
                Assignment()(entityDescriptor, next);
                return(ed);
            });

            return(entityDescriptor);
        }
コード例 #5
0
        public static EntityDesriptorConfiguration BuildEntityDesriptorConfiguration(EntityDescriptorSettings entityDescriptorSettings)
        {
            var federationId = String.Format("{0}_{1}", "eca", Guid.NewGuid());
            var organisation = entityDescriptorSettings.IncludeOrganisationInfo ? MetadataHelper.BuidOrganisationConfiguration(entityDescriptorSettings.Organisation) : (OrganisationConfiguration)null;
            var entityDescriptorConfiguration = new EntityDesriptorConfiguration
            {
                CacheDuration = MetadataHelper.TimeSpanFromDatapartEntry(entityDescriptorSettings.CacheDuration),
                EntityId      = entityDescriptorSettings.EntityId,
                Id            = entityDescriptorSettings.FederationId,
                ValidUntil    = entityDescriptorSettings.ValidUntil,
                Organisation  = organisation,
            };
            var spDescriptor = MetadataHelper.BuildSPSSODescriptorConfiguration(entityDescriptorSettings.RoleDescriptors.OfType <SPDescriptorSettings>().Single(), organisation);

            entityDescriptorConfiguration.RoleDescriptors.Add(spDescriptor);
            return(entityDescriptorConfiguration);
        }
コード例 #6
0
        public static EntityDesriptorConfiguration BuildEntityDesriptorConfiguration(bool includeOrganisation = false)
        {
            var federationId = String.Format("{0}_{1}", "IdpFederation", Guid.NewGuid());
            var entityDescriptorConfiguration = new EntityDesriptorConfiguration
            {
                CacheDuration = TimeSpan.FromDays(100),
                EntityId      = "https://www.eca-international.com",
                Id            = federationId,
                ValidUntil    = new DateTimeOffset(DateTime.Now.AddDays(30)),
            };

            if (includeOrganisation)
            {
                entityDescriptorConfiguration.Organisation = MetadataHelper.BuildOrganisationConfiguration();
            }

            return(entityDescriptorConfiguration);
        }
コード例 #7
0
        protected virtual EntityDescriptor BuildEntityDesciptor(EntityDesriptorConfiguration configuration, IEnumerable <RoleDescriptor> descriptors)
        {
            var entityDescriptor = new EntityDescriptor()
            {
                EntityId     = new EntityId(configuration.EntityId),
                FederationId = configuration.Id
            };
            Organization organisation;

            if (SSODescriptorBuilderHelper.TryBuildOrganisation(configuration.Organisation, out organisation))
            {
                entityDescriptor.Organization = organisation;
            }
            SSODescriptorBuilderHelper.BuildContacts(entityDescriptor.Contacts, configuration.Organisation);
            descriptors.Aggregate(entityDescriptor, (ed, next) =>
            {
                Assignment()(entityDescriptor, next);
                return(ed);
            });

            return(entityDescriptor);
        }
コード例 #8
0
 public RequestConfiguration(string requestId, string version, EntityDesriptorConfiguration entityDesriptorConfiguration)
 {
     this.RequestId = requestId;
     this.Version   = version;
     this._entityDesriptorConfiguration = entityDesriptorConfiguration;
 }