Skip to content

Commit

Permalink
cleanup client config
Browse files Browse the repository at this point in the history
  • Loading branch information
leastprivilege committed Jun 17, 2020
1 parent a62171d commit 7a1328e
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions src/IdentityServer4/host/Configuration/ClientsConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,21 @@ public static IEnumerable<Client> Get()
new Client
{
ClientId = "client",
ClientSecrets = {new Secret("secret".Sha256())},
ClientSecrets = { new Secret("secret".Sha256()) },
AllowedGrantTypes = GrantTypes.ClientCredentials,
AllowedScopes = { "resource1.scope1", "resource2.scope1", IdentityServerConstants.LocalApi.ScopeName}
AllowedScopes =
{
"resource1.scope1", "resource2.scope1", IdentityServerConstants.LocalApi.ScopeName
}
},

///////////////////////////////////////////
// Console Structured Scope Sample
//////////////////////////////////////////
new Client
{
ClientId = "parameterized.client",
ClientSecrets = {new Secret("secret".Sha256())},
ClientSecrets = { new Secret("secret".Sha256()) },
AllowedGrantTypes = GrantTypes.ClientCredentials,
AllowedScopes = { "transaction" }
},
Expand All @@ -57,7 +60,6 @@ public static IEnumerable<Client> Get()
Type = IdentityServerConstants.SecretTypes.X509CertificateThumbprint
},
},

AccessTokenType = AccessTokenType.Jwt,
AllowedGrantTypes = GrantTypes.ClientCredentials,
AllowedScopes = { "resource1.scope1", "resource2.scope1" }
Expand All @@ -84,7 +86,6 @@ public static IEnumerable<Client> Get()
"{'e':'AQAB','kid':'ZzAjSnraU3bkWGnnAqLapYGpTyNfLbjbzgAPbbW2GEA','kty':'RSA','n':'wWwQFtSzeRjjerpEM5Rmqz_DsNaZ9S1Bw6UbZkDLowuuTCjBWUax0vBMMxdy6XjEEK4Oq9lKMvx9JzjmeJf1knoqSNrox3Ka0rnxXpNAz6sATvme8p9mTXyp0cX4lF4U2J54xa2_S9NF5QWvpXvBeC4GAJx7QaSw4zrUkrc6XyaAiFnLhQEwKJCwUw4NOqIuYvYp_IXhw-5Ti_icDlZS-282PcccnBeOcX7vc21pozibIdmZJKqXNsL1Ibx5Nkx1F1jLnekJAmdaACDjYRLL_6n3W4wUp19UvzB1lGtXcJKLLkqB6YDiZNu16OSiSprfmrRXvYmvD8m6Fnl5aetgKw'}"
}
},

AllowedGrantTypes = GrantTypes.ClientCredentials,
AllowedScopes = { "resource1.scope1", "resource2.scope1" }
},
Expand All @@ -95,8 +96,8 @@ public static IEnumerable<Client> Get()
new Client
{
ClientId = "client.custom",
ClientSecrets = {new Secret("secret".Sha256())},
AllowedGrantTypes = {"custom", "custom.nosubject"},
ClientSecrets = { new Secret("secret".Sha256()) },
AllowedGrantTypes = { "custom", "custom.nosubject" },
AllowedScopes = { "resource1.scope1", "resource2.scope1" }
},

Expand All @@ -106,14 +107,15 @@ public static IEnumerable<Client> Get()
new Client
{
ClientId = "roclient",
ClientSecrets = {new Secret("secret".Sha256())},
ClientSecrets = { new Secret("secret".Sha256()) },
AllowedGrantTypes = GrantTypes.ResourceOwnerPassword,
AllowOfflineAccess = true,
AllowedScopes =
{
IdentityServerConstants.StandardScopes.OpenId,
"custom.profile",
"resource1.scope1", "resource2.scope1"
"resource1.scope1",
"resource2.scope1"
}
},

Expand All @@ -130,7 +132,8 @@ public static IEnumerable<Client> Get()
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Email,
"resource1.scope1", "resource2.scope1"
"resource1.scope1",
"resource2.scope1"
}
},

Expand All @@ -144,14 +147,15 @@ public static IEnumerable<Client> Get()
RequireClientSecret = false,
AllowedGrantTypes = GrantTypes.Code,
RequirePkce = true,
RedirectUris = {"http://127.0.0.1"},
RedirectUris = { "http://127.0.0.1" },
AllowOfflineAccess = true,
AllowedScopes =
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
IdentityServerConstants.StandardScopes.Email,
"resource1.scope1", "resource2.scope1"
"resource1.scope1",
"resource2.scope1"
}
},
///////////////////////////////////////////
Expand All @@ -164,16 +168,17 @@ public static IEnumerable<Client> Get()
RequireClientSecret = false,
AllowedGrantTypes = GrantTypes.Code,
RequirePkce = true,
RedirectUris = {"sample-windows-client://callback"},
RedirectUris = { "sample-windows-client://callback" },
RequireConsent = false,
AllowOfflineAccess = true,
AllowedIdentityTokenSigningAlgorithms = {"ES256"},
AllowedIdentityTokenSigningAlgorithms = { "ES256" },
AllowedScopes =
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
IdentityServerConstants.StandardScopes.Email,
"resource1.scope1", "resource2.scope1"
"resource1.scope1",
"resource2.scope1"
}
},

Expand All @@ -184,31 +189,29 @@ public static IEnumerable<Client> Get()
new Client
{
ClientId = "roclient.reference",
ClientSecrets = {new Secret("secret".Sha256())},
ClientSecrets = { new Secret("secret".Sha256()) },
AllowedGrantTypes = GrantTypes.ResourceOwnerPassword,
AllowedScopes = { "resource1.scope1", "resource2.scope1" },
AccessTokenType = AccessTokenType.Reference
},

///////////////////////////////////////////
// Device Flow Sample
//////////////////////////////////////////
new Client
{
ClientId = "device",
ClientName = "Device Flow Client",

AllowedGrantTypes = GrantTypes.DeviceFlow,
RequireClientSecret = false,

AllowOfflineAccess = true,

AllowedScopes =
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
IdentityServerConstants.StandardScopes.Email,
"resource1.scope1", "resource2.scope1"
"resource1.scope1",
"resource2.scope1"
}
}
};
Expand Down

0 comments on commit 7a1328e

Please sign in to comment.