コード例 #1
0
        /// <summary>
        /// Creates the mobile application client.
        /// </summary>
        /// <param name="seedingType">Type of the seeding.</param>
        /// <returns></returns>
        private static Client CreateGolfHandicapTestDataGeneratorClient(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)
            {
                client = new Client
                {
                    ClientId      = "golfhandicap.testdatagenerator",
                    ClientName    = "Test Data Generator Client",
                    ClientSecrets =
                    {
                        new Secret("golfhandicap.testdatagenerator".Sha256())
                    },
                    AllowedGrantTypes = GrantTypes.ClientCredentials,
                    AllowedScopes     = scopes
                };
            }

            return(client);
        }
コード例 #2
0
        /// <summary>
        /// Creates the developer client.
        /// </summary>
        /// <param name="seedingType">Type of the seeding.</param>
        /// <returns></returns>
        private static Client CreateDeveloperClient(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);

                client = new Client
                {
                    ClientId      = "developerClient",
                    ClientName    = "Developer Client",
                    ClientSecrets =
                    {
                        new Secret("developerClient".Sha256())
                    },
                    AllowedGrantTypes = GrantTypes.ResourceOwnerPassword,
                    AllowedScopes     = scopes
                };
            }

            return(client);
        }
コード例 #3
0
        /// <summary>
        /// Creates the mobile application client.
        /// </summary>
        /// <param name="seedingType">Type of the seeding.</param>
        /// <returns></returns>
        private static Client CreateGolfHandicapSubscriptionServiceClient(SeedingType seedingType)
        {
            Client client = null;

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

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

            // Add in the standard scopes for GetUserInfo
            scopes.Add(IdentityServerConstants.StandardScopes.OpenId);
            scopes.Add(IdentityServerConstants.StandardScopes.Profile);
            scopes.Add(IdentityServerConstants.StandardScopes.Email);

            if (seedingType == SeedingType.IntegrationTest || seedingType == SeedingType.Development || seedingType == SeedingType.Staging)
            {
                client = new Client
                {
                    ClientId      = "golfhandicap.subscriptionservice",
                    ClientName    = "Subscription Service Client",
                    ClientSecrets =
                    {
                        new Secret("golfhandicap.subscriptionservice".Sha256())
                    },
                    AllowedGrantTypes = GrantTypes.ClientCredentials,
                    AllowedScopes     = scopes
                };
            }

            return(client);
        }
コード例 #4
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);
        }