Example #1
0
        /// <summary>
        /// Gets the clients.
        /// </summary>
        /// <param name="seedingType">Type of the seeding.</param>
        /// <returns></returns>
        public static List <Client> GetClients(SeedingType seedingType)
        {
            List <Client> clients = new List <Client>();

            // Developer Client
            clients.Add(ClientSeedData.CreateDeveloperClient(seedingType));

            // Golf Handicapping Clients
            clients.Add(ClientSeedData.CreateGolfHandicapMobileClient(seedingType));
            clients.Add(ClientSeedData.CreateGolfHandicapSubscriptionServiceClient(seedingType));
            clients.Add(ClientSeedData.CreateGolfHandicapTestDataGeneratorClient(seedingType));
            clients.Add(ClientSeedData.CreateGolfHandicapAdminWebsiteClient(seedingType));
            clients.Add(ClientSeedData.CreateGolfHandicapPlayerWebsiteClient(seedingType));

            return(clients);
        }
Example #2
0
        /// <summary>
        /// Creates the golf handicap admin website client.
        /// </summary>
        /// <param name="seedingType">Type of the seeding.</param>
        /// <returns></returns>
        private static Client CreateGolfHandicapAdminWebsiteClient(SeedingType seedingType)
        {
            Client client = null;

            // Setup the scopes
            List <String> scopes = new List <String>();

            scopes.AddRange(ApiResourceSeedData.GetApiResources(seedingType).Select(y => y.Name).ToList());

            if (seedingType == SeedingType.IntegrationTest || seedingType == SeedingType.Development || seedingType == SeedingType.Staging)
            {
                // Add in the standard scopes for GetUserInfo
                scopes.Add(IdentityServerConstants.StandardScopes.OpenId);
                scopes.Add(IdentityServerConstants.StandardScopes.Profile);
                scopes.Add(IdentityServerConstants.StandardScopes.Email);

                String clientId = "golfhandicap.adminwebsite";
                client = new Client
                {
                    ClientId      = clientId,
                    ClientName    = "Golf Club Admin Website Client",
                    ClientSecrets =
                    {
                        new Secret(clientId.Sha256())
                    },
                    AllowedGrantTypes      = GrantTypes.Hybrid,
                    AllowedScopes          = scopes,
                    AllowOfflineAccess     = true,
                    RedirectUris           = ClientSeedData.SetRedirectUris(clientId, seedingType),
                    PostLogoutRedirectUris = ClientSeedData.SetPostLogoutRedirectUris(clientId, seedingType),
                    RequireConsent         = false
                };
            }

            return(client);
        }