Browse Source

Add conditional clients.

pull/8171/head
Halil İbrahim Kalkan 6 years ago
parent
commit
f787573400
  1. 15
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs

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

@ -142,15 +142,14 @@ namespace MyCompanyName.MyProjectName.IdentityServer
var configurationSection = _configuration.GetSection("IdentityServer:Clients"); var configurationSection = _configuration.GetSection("IdentityServer:Clients");
//<TEMPLATE-REMOVE IF-NOT='ui:mvc&&tiered'>
//Web Client //Web Client
var webClientId = configurationSection["MyProjectName_Web:ClientId"]; var webClientId = configurationSection["MyProjectName_Web:ClientId"];
if (!webClientId.IsNullOrWhiteSpace()) if (!webClientId.IsNullOrWhiteSpace())
{ {
var webClientRootUrl = configurationSection["MyProjectName_Web:RootUrl"].EnsureEndsWith('/'); var webClientRootUrl = configurationSection["MyProjectName_Web:RootUrl"].EnsureEndsWith('/');
/* MyProjectName_Web client is only needed if you created a tiered
* solution. Otherwise, you can delete this client. */
await CreateClientAsync( await CreateClientAsync(
name: webClientId, name: webClientId,
scopes: commonScopes, scopes: commonScopes,
@ -162,6 +161,8 @@ namespace MyCompanyName.MyProjectName.IdentityServer
corsOrigins: new[] { webClientRootUrl.RemovePostFix("/") } corsOrigins: new[] { webClientRootUrl.RemovePostFix("/") }
); );
} }
//</TEMPLATE-REMOVE>
//Console Test / Angular Client //Console Test / Angular Client
var consoleAndAngularClientId = configurationSection["MyProjectName_App:ClientId"]; var consoleAndAngularClientId = configurationSection["MyProjectName_App:ClientId"];
@ -180,6 +181,8 @@ namespace MyCompanyName.MyProjectName.IdentityServer
corsOrigins: new[] { webClientRootUrl.RemovePostFix("/") } corsOrigins: new[] { webClientRootUrl.RemovePostFix("/") }
); );
} }
//<TEMPLATE-REMOVE IF-NOT='ui:blazor'>
// Blazor Client // Blazor Client
var blazorClientId = configurationSection["MyProjectName_Blazor:ClientId"]; var blazorClientId = configurationSection["MyProjectName_Blazor:ClientId"];
@ -199,6 +202,10 @@ namespace MyCompanyName.MyProjectName.IdentityServer
); );
} }
//</TEMPLATE-REMOVE>
//<TEMPLATE-REMOVE IF-NOT='ui:blazor-server&&tiered'>
//Blazor Server Tiered Client //Blazor Server Tiered Client
var blazorServerTieredClientId = configurationSection["MyProjectName_BlazorServerTiered:ClientId"]; var blazorServerTieredClientId = configurationSection["MyProjectName_BlazorServerTiered:ClientId"];
if (!blazorServerTieredClientId.IsNullOrWhiteSpace()) if (!blazorServerTieredClientId.IsNullOrWhiteSpace())
@ -220,6 +227,8 @@ namespace MyCompanyName.MyProjectName.IdentityServer
); );
} }
//</TEMPLATE-REMOVE>
// Swagger Client // Swagger Client
var swaggerClientId = configurationSection["MyProjectName_Swagger:ClientId"]; var swaggerClientId = configurationSection["MyProjectName_Swagger:ClientId"];
if (!swaggerClientId.IsNullOrWhiteSpace()) if (!swaggerClientId.IsNullOrWhiteSpace())

Loading…
Cancel
Save