Пример #1
0
        public override void Seed(IDbContext context)
        {
            var descriptor = new EntityDescriptorSettings
            {
                //EntityId = "https://imperial.flowz_test.co.uk/",
                EntityId      = "https://www.eca-international-dev.com",
                FederationId  = String.Format("{0}_{1}", "eca", Guid.NewGuid()),
                CacheDuration = new DatepartValue {
                    Value = 100, Datepart = Datapart.Day
                },
                ValidUntil = DateTimeOffset.Now.AddDays(90),
            };

            //organisation
            if (Seeder._cache.ContainsKey(Seeder.Organisation))
            {
                var organisation = Seeder._cache[Seeder.Organisation] as OrganisationSettings;
                descriptor.Organisation = organisation;
            }
            //sp descriptors
            var spDescriptors = Seeder._cache[Seeder.SPDescriptorsKey] as IEnumerable <SPDescriptorSettings>;

            spDescriptors.Aggregate(descriptor, (d, next) => { d.RoleDescriptors.Add(next); return(d); });

            context.Add <EntityDescriptorSettings>(descriptor);
            Seeder._cache[Seeder.EntityDescriptor] = descriptor;
        }
        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);
        }
Пример #3
0
        public override void Seed(IDbContext context)
        {
            var descriptor = new EntityDescriptorSettings
            {
                EntityId      = "Imperial.flowz.co.uk",
                FederationId  = String.Format("{0}_{1}", "flowz", Guid.NewGuid()),
                CacheDuration = new DatepartValue {
                    Value = 100, Datepart = Datapart.Day
                },
                ValidUntil = DateTimeOffset.Now.AddDays(90),
            };

            //organisation
            var organisation = Seeder._cache[Seeder.Organisation] as OrganisationSettings;

            descriptor.Organisation = organisation;

            //sp descriptors
            var spDescriptors = Seeder._cache[Seeder.SPDescriptorsKey] as IEnumerable <SPDescriptorSettings>;

            spDescriptors.Aggregate(descriptor, (d, next) => { d.RoleDescriptors.Add(next); return(d); });

            context.Add <EntityDescriptorSettings>(descriptor);
        }