Browse Source

Update IdentityServerDataSeedContributor.cs

pull/13026/head
Enis Necipoglu 4 years ago
parent
commit
9be612f938
  1. 12
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs

12
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs

@ -152,6 +152,7 @@ public class IdentityServerDataSeedContributor : IDataSeedContributor, ITransien
await CreateClientAsync( await CreateClientAsync(
name: webClientId, name: webClientId,
clientUri: webClientRootUrl,
scopes: commonScopes, scopes: commonScopes,
grantTypes: new[] { "hybrid" }, grantTypes: new[] { "hybrid" },
secret: (configurationSection["MyProjectName_Web:ClientSecret"] ?? "1q2w3e*").Sha256(), secret: (configurationSection["MyProjectName_Web:ClientSecret"] ?? "1q2w3e*").Sha256(),
@ -172,6 +173,7 @@ public class IdentityServerDataSeedContributor : IDataSeedContributor, ITransien
await CreateClientAsync( await CreateClientAsync(
name: consoleAndAngularClientId, name: consoleAndAngularClientId,
clientUri: webClientRootUrl,
scopes: commonScopes, scopes: commonScopes,
grantTypes: new[] { "password", "client_credentials", "authorization_code" }, grantTypes: new[] { "password", "client_credentials", "authorization_code" },
secret: (configurationSection["MyProjectName_App:ClientSecret"] ?? "1q2w3e*").Sha256(), secret: (configurationSection["MyProjectName_App:ClientSecret"] ?? "1q2w3e*").Sha256(),
@ -192,6 +194,7 @@ public class IdentityServerDataSeedContributor : IDataSeedContributor, ITransien
await CreateClientAsync( await CreateClientAsync(
name: blazorClientId, name: blazorClientId,
clientUri: blazorRootUrl,
scopes: commonScopes, scopes: commonScopes,
grantTypes: new[] { "authorization_code" }, grantTypes: new[] { "authorization_code" },
secret: configurationSection["MyProjectName_Blazor:ClientSecret"]?.Sha256(), secret: configurationSection["MyProjectName_Blazor:ClientSecret"]?.Sha256(),
@ -217,6 +220,7 @@ public class IdentityServerDataSeedContributor : IDataSeedContributor, ITransien
await CreateClientAsync( await CreateClientAsync(
name: blazorServerTieredClientId, name: blazorServerTieredClientId,
clientUri: blazorServerTieredClientRootUrl,
scopes: commonScopes, scopes: commonScopes,
grantTypes: new[] { "hybrid" }, grantTypes: new[] { "hybrid" },
secret: (configurationSection["MyProjectName_BlazorServerTiered:ClientSecret"] ?? "1q2w3e*").Sha256(), secret: (configurationSection["MyProjectName_BlazorServerTiered:ClientSecret"] ?? "1q2w3e*").Sha256(),
@ -237,6 +241,7 @@ public class IdentityServerDataSeedContributor : IDataSeedContributor, ITransien
await CreateClientAsync( await CreateClientAsync(
name: swaggerClientId, name: swaggerClientId,
clientUri: swaggerRootUrl,
scopes: commonScopes, scopes: commonScopes,
grantTypes: new[] { "authorization_code" }, grantTypes: new[] { "authorization_code" },
secret: configurationSection["MyProjectName_Swagger:ClientSecret"]?.Sha256(), secret: configurationSection["MyProjectName_Swagger:ClientSecret"]?.Sha256(),
@ -251,6 +256,7 @@ public class IdentityServerDataSeedContributor : IDataSeedContributor, ITransien
string name, string name,
IEnumerable<string> scopes, IEnumerable<string> scopes,
IEnumerable<string> grantTypes, IEnumerable<string> grantTypes,
string clientUri = null,
string secret = null, string secret = null,
string redirectUri = null, string redirectUri = null,
string postLogoutRedirectUri = null, string postLogoutRedirectUri = null,
@ -270,6 +276,7 @@ public class IdentityServerDataSeedContributor : IDataSeedContributor, ITransien
) )
{ {
ClientName = name, ClientName = name,
ClientUri = clientUri,
ProtocolType = "oidc", ProtocolType = "oidc",
Description = name, Description = name,
AlwaysIncludeUserClaimsInIdToken = true, AlwaysIncludeUserClaimsInIdToken = true,
@ -287,6 +294,11 @@ public class IdentityServerDataSeedContributor : IDataSeedContributor, ITransien
); );
} }
if (client.ClientUri != clientUri)
{
client.ClientUri = clientUri;
}
foreach (var scope in scopes) foreach (var scope in scopes)
{ {
if (client.FindScope(scope) == null) if (client.FindScope(scope) == null)

Loading…
Cancel
Save