Browse Source

Merge pull request #17660 from abpframework/EngincanV/update-dataseeder

Improve auth-server homepage design & update dataseeder
pull/17683/head
Engincan VESKE 3 years ago
committed by GitHub
parent
commit
cfe42dd7a1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs
  2. 4
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs
  3. 73
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/Pages/Index.cshtml
  4. 8
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.DbMigrator/appsettings.json
  5. 10
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/OpenIddict/OpenIddictDataSeedContributor.cs

7
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs

@ -174,6 +174,7 @@ public abstract class AppTemplateBase : TemplateInfo
{ {
steps.Add(new MauiChangeApplicationIdGuidStep()); steps.Add(new MauiChangeApplicationIdGuidStep());
steps.Add(new MauiChangePortStep()); steps.Add(new MauiChangePortStep());
context.Symbols.Add("mobile:maui");
} }
else else
{ {
@ -192,10 +193,12 @@ public abstract class AppTemplateBase : TemplateInfo
context.BuildArgs.ExtraProperties.ContainsKey("separate-auth-server")) context.BuildArgs.ExtraProperties.ContainsKey("separate-auth-server"))
{ {
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web.Public")); steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web.Public"));
context.Symbols.Add("ui:mvc-public-host");
} }
else else
{ {
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web.Public.Host")); steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web.Public.Host"));
context.Symbols.Add("ui:mvc-public");
} }
} }
} }
@ -399,6 +402,7 @@ public abstract class AppTemplateBase : TemplateInfo
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.HttpApi.Host")); steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.HttpApi.Host"));
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.AuthServer")); steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.AuthServer"));
steps.Add(new TemplateProjectRenameStep("MyCompanyName.MyProjectName.HttpApi.HostWithIds", "MyCompanyName.MyProjectName.HttpApi.Host")); steps.Add(new TemplateProjectRenameStep("MyCompanyName.MyProjectName.HttpApi.HostWithIds", "MyCompanyName.MyProjectName.HttpApi.Host"));
context.Symbols.Add("HostWithIds");
steps.Add(new AppTemplateChangeConsoleTestClientPortSettingsStep("44305")); steps.Add(new AppTemplateChangeConsoleTestClientPortSettingsStep("44305"));
} }
} }
@ -424,6 +428,7 @@ public abstract class AppTemplateBase : TemplateInfo
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.IdentityServer")); steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.IdentityServer"));
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.AuthServer")); steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.AuthServer"));
steps.Add(new TemplateProjectRenameStep("MyCompanyName.MyProjectName.HttpApi.HostWithIds", "MyCompanyName.MyProjectName.HttpApi.Host")); steps.Add(new TemplateProjectRenameStep("MyCompanyName.MyProjectName.HttpApi.HostWithIds", "MyCompanyName.MyProjectName.HttpApi.Host"));
context.Symbols.Add("HostWithIds");
steps.Add(new AppTemplateChangeConsoleTestClientPortSettingsStep("44305")); steps.Add(new AppTemplateChangeConsoleTestClientPortSettingsStep("44305"));
} }
@ -517,6 +522,7 @@ public abstract class AppTemplateBase : TemplateInfo
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.IdentityServer")); steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.IdentityServer"));
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.AuthServer")); steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.AuthServer"));
steps.Add(new TemplateProjectRenameStep("MyCompanyName.MyProjectName.HttpApi.HostWithIds", "MyCompanyName.MyProjectName.HttpApi.Host")); steps.Add(new TemplateProjectRenameStep("MyCompanyName.MyProjectName.HttpApi.HostWithIds", "MyCompanyName.MyProjectName.HttpApi.Host"));
context.Symbols.Add("HostWithIds");
steps.Add(new AppTemplateChangeConsoleTestClientPortSettingsStep("44305")); steps.Add(new AppTemplateChangeConsoleTestClientPortSettingsStep("44305"));
} }
@ -554,6 +560,7 @@ public abstract class AppTemplateBase : TemplateInfo
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.IdentityServer")); steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.IdentityServer"));
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.AuthServer")); steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.AuthServer"));
steps.Add(new TemplateProjectRenameStep("MyCompanyName.MyProjectName.HttpApi.HostWithIds", "MyCompanyName.MyProjectName.HttpApi.Host")); steps.Add(new TemplateProjectRenameStep("MyCompanyName.MyProjectName.HttpApi.HostWithIds", "MyCompanyName.MyProjectName.HttpApi.Host"));
context.Symbols.Add("HostWithIds");
steps.Add(new AppTemplateChangeConsoleTestClientPortSettingsStep("44305")); steps.Add(new AppTemplateChangeConsoleTestClientPortSettingsStep("44305"));
} }
} }

4
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs

@ -35,6 +35,7 @@ using Volo.Abp.OpenIddict;
using Volo.Abp.UI.Navigation.Urls; using Volo.Abp.UI.Navigation.Urls;
using Volo.Abp.UI; using Volo.Abp.UI;
using Volo.Abp.VirtualFileSystem; using Volo.Abp.VirtualFileSystem;
using Volo.Abp.Account.Localization;
namespace MyCompanyName.MyProjectName; namespace MyCompanyName.MyProjectName;
@ -90,7 +91,8 @@ public class MyProjectNameAuthServerModule : AbpModule
options.Resources options.Resources
.Get<MyProjectNameResource>() .Get<MyProjectNameResource>()
.AddBaseTypes( .AddBaseTypes(
typeof(AbpUiResource) typeof(AbpUiResource),
typeof(AccountResource)
); );
}); });

73
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/Pages/Index.cshtml

@ -16,6 +16,14 @@
Layout = Theme.GetEmptyLayout(); Layout = Theme.GetEmptyLayout();
} }
@section styles {
<style>
body {
background-color: white;
}
</style>
}
<div class="d-flex align-items-center" style="min-height: 100vh;"> <div class="d-flex align-items-center" style="min-height: 100vh;">
<div class="container"> <div class="container">
<abp-row> <abp-row>
@ -30,37 +38,30 @@
<h1>@BrandingProvider.AppName</h1> <h1>@BrandingProvider.AppName</h1>
} }
</div> </div>
<abp-card> <abp-card>
<abp-card-body> <abp-card-body>
<div class="container"> <div class="container">
<abp-row> <abp-row>
<abp-column size="_9"> <abp-column size="_6">
<div class="mr-auto p-2 float-start">
<div class="d-flex align-items-center"> <div class="">
<div class="me-3 p-2"> @if (CurrentUser.IsAuthenticated)
<i class="fa fa-user d-block" style="font-size: 10em; color: #12b900"></i> {
</div> <div class="">
<div class="p2"> <a abp-button="Outline_Primary" asp-controller="Manage" asp-action="Index" asp-area="Account" class="me-2">@L["MyAccount"]</a>
@if (CurrentUser.IsAuthenticated) <a abp-button="Primary" asp-controller="Logout" asp-action="Index" asp-area="Account" asp-route-returnUrl="/" >@L["Logout"]</a>
{ </div>
<span class="fs-16"> }
@L["Welcome"] <span class="fw-7">@CurrentUser.UserName</span> else
</span> {
<span class="fs-14 d-block text-dark-800 opacity-75 mb-1">@CurrentUser.Email</span> <a abp-button="Primary" asp-controller="Login" asp-action="Index" asp-area="Account">@L["Login"]</a>
<div class="d-grid gap-2"> }
<a abp-button="Outline_Primary" asp-controller="Manage" asp-action="Index" asp-area="Account">@L["MyAccount"]</a> </div>
<a abp-button="Primary" asp-controller="Logout" asp-action="Index" asp-area="Account">@L["Logout"]</a>
</div>
}
else
{
<a abp-button="Primary" asp-controller="Login" asp-action="Index" asp-area="Account">@L["Login"]</a>
}
</div>
</div> </div>
</abp-column> </abp-column>
<abp-column size="_3">
<abp-column size="_6">
<div class="ml-auto p-2 float-end"> <div class="ml-auto p-2 float-end">
<abp-dropdown> <abp-dropdown>
<abp-dropdown-button text="@Model.CurrentLanguage" /> <abp-dropdown-button text="@Model.CurrentLanguage" />
@ -78,16 +79,17 @@
</div> </div>
</abp-column> </abp-column>
</abp-row> </abp-row>
<hr class="m-4" />
<abp-row> @if (Model.Applications != null)
@if (Model.Applications != null) {
{ <hr class="m-2" />
foreach (var application in Model.Applications)
<abp-row class="mt-3">
@foreach (var application in Model.Applications)
{ {
<abp-column size-md="@Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Grid.ColumnSize._4" class="mb-2"> <abp-column size-md="@Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Grid.ColumnSize._4" class="mb-2">
<abp-card> <abp-card>
<abp-card-body> <abp-card-body>
@if (!application.LogoUri.IsNullOrEmpty()) @if (!application.LogoUri.IsNullOrEmpty())
{ {
<div class="mx-auto"> <div class="mx-auto">
@ -96,16 +98,13 @@
} }
<h4>@application.DisplayName</h4> <h4>@application.DisplayName</h4>
<span class="text-muted">@application.ClientUri</span> <a href="@application.ClientUri" class="text-muted stretched-link">@application.ClientUri</a>
<div class="mt-1">
<a abp-button="@Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Button.AbpButtonType.Outline_Secondary" href="@application.ClientUri">@L["Visit"]</a>
</div>
</abp-card-body> </abp-card-body>
</abp-card> </abp-card>
</abp-column> </abp-column>
} }
} </abp-row>
</abp-row> }
</div> </div>
</abp-card-body> </abp-card-body>
</abp-card> </abp-card>

8
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.DbMigrator/appsettings.json

@ -9,24 +9,32 @@
//</TEMPLATE-REMOVE> //</TEMPLATE-REMOVE>
"OpenIddict": { "OpenIddict": {
"Applications": { "Applications": {
//<TEMPLATE-REMOVE IF-NOT='ui:mvc'>
"MyProjectName_Web": { "MyProjectName_Web": {
"ClientId": "MyProjectName_Web", "ClientId": "MyProjectName_Web",
"ClientSecret": "1q2w3e*", "ClientSecret": "1q2w3e*",
"RootUrl": "https://localhost:44302" "RootUrl": "https://localhost:44302"
}, },
//</TEMPLATE-REMOVE>
//<TEMPLATE-REMOVE IF-NOT='ui:blazor'>
"MyProjectName_Blazor": { "MyProjectName_Blazor": {
"ClientId": "MyProjectName_Blazor", "ClientId": "MyProjectName_Blazor",
"RootUrl": "https://localhost:44307" "RootUrl": "https://localhost:44307"
}, },
//</TEMPLATE-REMOVE>
//<TEMPLATE-REMOVE IF-NOT='ui:angular'>
"MyProjectName_App": { "MyProjectName_App": {
"ClientId": "MyProjectName_App", "ClientId": "MyProjectName_App",
"RootUrl": "http://localhost:4200" "RootUrl": "http://localhost:4200"
}, },
//</TEMPLATE-REMOVE>
//<TEMPLATE-REMOVE IF-NOT='ui:blazor-server&&TIERED'>
"MyProjectName_BlazorServerTiered": { "MyProjectName_BlazorServerTiered": {
"ClientId": "MyProjectName_BlazorServerTiered", "ClientId": "MyProjectName_BlazorServerTiered",
"ClientSecret": "1q2w3e*", "ClientSecret": "1q2w3e*",
"RootUrl": "https://localhost:44309" "RootUrl": "https://localhost:44309"
}, },
//</TEMPLATE-REMOVE>
"MyProjectName_Swagger": { "MyProjectName_Swagger": {
"ClientId": "MyProjectName_Swagger", "ClientId": "MyProjectName_Swagger",
"RootUrl": "https://localhost:44305" "RootUrl": "https://localhost:44305"

10
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/OpenIddict/OpenIddictDataSeedContributor.cs

@ -79,6 +79,7 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
var configurationSection = _configuration.GetSection("OpenIddict:Applications"); var configurationSection = _configuration.GetSection("OpenIddict:Applications");
//<TEMPLATE-REMOVE IF-NOT='ui:mvc'>
//Web Client //Web Client
var webClientId = configurationSection["MyProjectName_Web:ClientId"]; var webClientId = configurationSection["MyProjectName_Web:ClientId"];
if (!webClientId.IsNullOrWhiteSpace()) if (!webClientId.IsNullOrWhiteSpace())
@ -103,7 +104,9 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
postLogoutRedirectUri: $"{webClientRootUrl}signout-callback-oidc" postLogoutRedirectUri: $"{webClientRootUrl}signout-callback-oidc"
); );
} }
//</TEMPLATE-REMOVE>
//<TEMPLATE-REMOVE IF-NOT='ui:angular'>
//Console Test / Angular Client //Console Test / Angular Client
var consoleAndAngularClientId = configurationSection["MyProjectName_App:ClientId"]; var consoleAndAngularClientId = configurationSection["MyProjectName_App:ClientId"];
if (!consoleAndAngularClientId.IsNullOrWhiteSpace()) if (!consoleAndAngularClientId.IsNullOrWhiteSpace())
@ -127,7 +130,9 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
postLogoutRedirectUri: consoleAndAngularClientRootUrl postLogoutRedirectUri: consoleAndAngularClientRootUrl
); );
} }
//</TEMPLATE-REMOVE>
//<TEMPLATE-REMOVE IF-NOT='ui:blazor'>
// Blazor Client // Blazor Client
var blazorClientId = configurationSection["MyProjectName_Blazor:ClientId"]; var blazorClientId = configurationSection["MyProjectName_Blazor:ClientId"];
if (!blazorClientId.IsNullOrWhiteSpace()) if (!blazorClientId.IsNullOrWhiteSpace())
@ -147,7 +152,9 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
postLogoutRedirectUri: $"{blazorRootUrl}/authentication/logout-callback" postLogoutRedirectUri: $"{blazorRootUrl}/authentication/logout-callback"
); );
} }
//</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())
@ -170,7 +177,9 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
postLogoutRedirectUri: $"{blazorServerTieredRootUrl}signout-callback-oidc" postLogoutRedirectUri: $"{blazorServerTieredRootUrl}signout-callback-oidc"
); );
} }
//</TEMPLATE-REMOVE>
//<TEMPLATE-REMOVE IF-NOT='HostWithIds'>
// Swagger Client // Swagger Client
var swaggerClientId = configurationSection["MyProjectName_Swagger:ClientId"]; var swaggerClientId = configurationSection["MyProjectName_Swagger:ClientId"];
if (!swaggerClientId.IsNullOrWhiteSpace()) if (!swaggerClientId.IsNullOrWhiteSpace())
@ -189,6 +198,7 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
clientUri: swaggerRootUrl clientUri: swaggerRootUrl
); );
} }
//</TEMPLATE-REMOVE>
} }
private async Task CreateApplicationAsync( private async Task CreateApplicationAsync(

Loading…
Cancel
Save