예제 #1
0
        protected override void Seed(AdminContext context)
        {
            if (context.TenantMappings.FirstOrDefault() != null)
            {
                return;
            }

            var mappings = new List <TenantMapping>();

            if (_debug)
            {
                context.TenantMappings.AddRange(DataFileLoader.Load <TenantMapping>("tenantmappings.json"));
                context.WsFedMappings.AddRange(DataFileLoader.Load <WsFedMapping>("wsfedmappings.json"));
                context.WsFedProtocolMappings.AddRange(DataFileLoader.Load <WsFedProtocolMapping>("wsfedprotocolmappings.json"));
            }
            else
            {
                context.TenantMappings.Add(
                    new TenantMapping
                {
                    TenantMappingId = GuidCombGenerator.Generate(),
                    TenantId        = AppSettings.AdminDomain,
                    TenantName      = AppSettings.IamClientName,
                    ClientId        = AppSettings.IamClientId
                });
            }

            context.SaveChanges();
        }
예제 #2
0
 void Event_OpenDb(object sender, RoutedEventArgs args)
 {
     database.Load();
     if (!database.IsLoaded)
     {
         return;
     }
 }
예제 #3
0
        protected override void Seed(ClientConfigurationDbContext context)
        {
            var clients = new List <Client>();

            if (_debug)
            {
                clients.AddRange(DataFileLoader.Load <Client>("clients.json"));
            }
            else
            {
                clients.Add(new Client
                {
                    ClientId       = AppSettings.IamClientId,
                    ClientName     = AppSettings.IamClientName,
                    Flow           = Flows.Implicit,
                    RequireConsent = false,
                    RedirectUris   = new List <string>
                    {
                        AppSettings.IamAdminFullUrl
                    },
                    PostLogoutRedirectUris = new List <string>
                    {
                        AppSettings.IamAdminFullUrl
                    },
                    IdentityProviderRestrictions = new List <string>
                    {
                        Constants.PrimaryAuthenticationType
                    },
                    AllowedScopes = new List <string>
                    {
                        "openid",
                        "profile",
                        "email",
                        "role"
                    }
                });
            }

            context.Clients.AddOrUpdate(c => c.ClientId,
                                        clients.Select(m => m.ToEntity()).ToArray());
        }