From 9be612f93865290364908c891e4aa05c5fc7be0e Mon Sep 17 00:00:00 2001 From: Enis Necipoglu Date: Thu, 16 Jun 2022 16:16:16 +0300 Subject: [PATCH] Update IdentityServerDataSeedContributor.cs --- .../IdentityServerDataSeedContributor.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs index da0b56a6d0..466f36658e 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs @@ -152,6 +152,7 @@ public class IdentityServerDataSeedContributor : IDataSeedContributor, ITransien await CreateClientAsync( name: webClientId, + clientUri: webClientRootUrl, scopes: commonScopes, grantTypes: new[] { "hybrid" }, secret: (configurationSection["MyProjectName_Web:ClientSecret"] ?? "1q2w3e*").Sha256(), @@ -172,6 +173,7 @@ public class IdentityServerDataSeedContributor : IDataSeedContributor, ITransien await CreateClientAsync( name: consoleAndAngularClientId, + clientUri: webClientRootUrl, scopes: commonScopes, grantTypes: new[] { "password", "client_credentials", "authorization_code" }, secret: (configurationSection["MyProjectName_App:ClientSecret"] ?? "1q2w3e*").Sha256(), @@ -192,6 +194,7 @@ public class IdentityServerDataSeedContributor : IDataSeedContributor, ITransien await CreateClientAsync( name: blazorClientId, + clientUri: blazorRootUrl, scopes: commonScopes, grantTypes: new[] { "authorization_code" }, secret: configurationSection["MyProjectName_Blazor:ClientSecret"]?.Sha256(), @@ -217,6 +220,7 @@ public class IdentityServerDataSeedContributor : IDataSeedContributor, ITransien await CreateClientAsync( name: blazorServerTieredClientId, + clientUri: blazorServerTieredClientRootUrl, scopes: commonScopes, grantTypes: new[] { "hybrid" }, secret: (configurationSection["MyProjectName_BlazorServerTiered:ClientSecret"] ?? "1q2w3e*").Sha256(), @@ -237,6 +241,7 @@ public class IdentityServerDataSeedContributor : IDataSeedContributor, ITransien await CreateClientAsync( name: swaggerClientId, + clientUri: swaggerRootUrl, scopes: commonScopes, grantTypes: new[] { "authorization_code" }, secret: configurationSection["MyProjectName_Swagger:ClientSecret"]?.Sha256(), @@ -251,6 +256,7 @@ public class IdentityServerDataSeedContributor : IDataSeedContributor, ITransien string name, IEnumerable scopes, IEnumerable grantTypes, + string clientUri = null, string secret = null, string redirectUri = null, string postLogoutRedirectUri = null, @@ -270,6 +276,7 @@ public class IdentityServerDataSeedContributor : IDataSeedContributor, ITransien ) { ClientName = name, + ClientUri = clientUri, ProtocolType = "oidc", Description = name, AlwaysIncludeUserClaimsInIdToken = true, @@ -287,6 +294,11 @@ public class IdentityServerDataSeedContributor : IDataSeedContributor, ITransien ); } + if (client.ClientUri != clientUri) + { + client.ClientUri = clientUri; + } + foreach (var scope in scopes) { if (client.FindScope(scope) == null)