From a90470cf28ced42482e20aa8c9073363af1271b6 Mon Sep 17 00:00:00 2001 From: Enis Necipoglu Date: Thu, 16 Jun 2022 16:16:12 +0300 Subject: [PATCH 1/8] Change IdentityServer Index page --- .../Pages/Index.cshtml | 119 ++++++++++++++---- .../Pages/Index.cshtml.cs | 19 ++- 2 files changed, 111 insertions(+), 27 deletions(-) diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Pages/Index.cshtml b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Pages/Index.cshtml index db9f1f100a..c61632e453 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Pages/Index.cshtml +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Pages/Index.cshtml @@ -1,34 +1,103 @@ @page +@using Microsoft.AspNetCore.Mvc.Localization @using MyCompanyName.MyProjectName.Pages +@using MyCompanyName.MyProjectName.Localization @using Volo.Abp.Users +@using Volo.Abp.AspNetCore.Mvc.UI.Theming +@using Volo.Abp.Ui.Branding @model IndexModel +@inject IHtmlLocalizer L @inject ICurrentUser CurrentUser -@if (CurrentUser.IsAuthenticated) -{ -
+@inject IBrandingProvider BrandingProvider +@inject ITheme Theme + +@{ + Layout = Theme.GetEmptyLayout(); +} + +
+
- - - Logout - - -

@CurrentUser.UserName

-
@CurrentUser.Email
-
- Roles: @CurrentUser.Roles.JoinAsString(", ") -
- Claims:
- @Html.Raw(CurrentUser.GetAllClaims().Select(c => $"{c.Type}={c.Value}").JoinAsString("
")) + + -} + + + + +
+
+
+ +
+
+ @if (CurrentUser.IsAuthenticated) + { + + @L["Welcome"] @CurrentUser.UserName + + @CurrentUser.Email + + } + else + { + @L["Login"] + } +
+
-@if (!CurrentUser.IsAuthenticated) -{ -
-

- Login +
+ + + + @foreach (var client in Model.Clients.Where(x => x.RedirectUris.Count > 0)) + { + + + + + @if (!client.LogoUri.IsNullOrEmpty()) + { +
+ +
+ } + +

@client.ClientName

+ @{ + var redirectUri = new Uri(@client.RedirectUris.First().RedirectUri); + var url = @redirectUri.AbsoluteUri.RemovePostFix(redirectUri.AbsolutePath); + } + @url +
+ Visit +
+
+
+
+ } + +
+
+ + + + +
+ +
-} +
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Pages/Index.cshtml.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Pages/Index.cshtml.cs index e8230ee00c..df43e3a798 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Pages/Index.cshtml.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Pages/Index.cshtml.cs @@ -1,10 +1,25 @@ using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; +using IdentityServer4.Stores; +using Volo.Abp.IdentityServer.Clients; +using System.Threading.Tasks; +using System.Collections.Generic; namespace MyCompanyName.MyProjectName.Pages; public class IndexModel : AbpPageModel { - public void OnGet() + public List Clients { get; protected set; } + + // TODO: Consider using IClientStore here. + protected IClientRepository ClientRepository { get; } + + public IndexModel(IClientRepository clientRepository) + { + this.ClientRepository = clientRepository; + } + + public async Task OnGetAsync() { + Clients = await ClientRepository.GetListAsync(includeDetails: true); } -} +} \ No newline at end of file From 9be612f93865290364908c891e4aa05c5fc7be0e Mon Sep 17 00:00:00 2001 From: Enis Necipoglu Date: Thu, 16 Jun 2022 16:16:16 +0300 Subject: [PATCH 2/8] 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) From 0db591f4d1cd6b5b67f91396a67904a8910bcbc4 Mon Sep 17 00:00:00 2001 From: Enis Necipoglu Date: Thu, 16 Jun 2022 16:18:54 +0300 Subject: [PATCH 3/8] Update Index.cshtml.cs --- .../Pages/Index.cshtml.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Pages/Index.cshtml.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Pages/Index.cshtml.cs index df43e3a798..dee9e692d8 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Pages/Index.cshtml.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Pages/Index.cshtml.cs @@ -9,8 +9,7 @@ namespace MyCompanyName.MyProjectName.Pages; public class IndexModel : AbpPageModel { public List Clients { get; protected set; } - - // TODO: Consider using IClientStore here. + protected IClientRepository ClientRepository { get; } public IndexModel(IClientRepository clientRepository) From 05fbf30c71ad29e60b871602a4a2144736276633 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Sat, 18 Jun 2022 13:48:57 +0800 Subject: [PATCH 4/8] Initialize rebus event bus before use rebus --- .../Volo/Abp/EventBus/Rebus/AbpEventBusRebusModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/AbpEventBusRebusModule.cs b/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/AbpEventBusRebusModule.cs index e5c045f316..351f575f46 100644 --- a/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/AbpEventBusRebusModule.cs +++ b/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/AbpEventBusRebusModule.cs @@ -41,11 +41,11 @@ public class AbpEventBusRebusModule : AbpModule public override void OnApplicationInitialization(ApplicationInitializationContext context) { - context.ServiceProvider.UseRebus(); - context .ServiceProvider .GetRequiredService() .Initialize(); + + context.ServiceProvider.UseRebus(); } } From 4f67be5f82079452c08bd6e2f84163ae176b0c41 Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 20 Jun 2022 17:21:27 +0800 Subject: [PATCH 5/8] Use the appropriate `Builder` object and call `Build`. --- .../Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs index d488da98a9..8c72e7f023 100644 --- a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs +++ b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs @@ -95,14 +95,17 @@ public class MinioBlobProvider : BlobProviderBase, ITransientDependency protected virtual MinioClient GetMinioClient(BlobProviderArgs args) { var configuration = args.Configuration.GetMinioConfiguration(); - var client = new MinioClient(configuration.EndPoint, configuration.AccessKey, configuration.SecretKey); + + var client = new MinioClient() + .WithEndpoint(configuration.EndPoint) + .WithCredentials(configuration.AccessKey, configuration.SecretKey); if (configuration.WithSSL) { client.WithSSL(); } - return client; + return client.Build(); } protected virtual async Task CreateBucketIfNotExists(MinioClient client, string containerName) From 5d8ae9540e5275e634f2ae030c01be01c4fa0ff2 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Mon, 20 Jun 2022 14:52:55 +0300 Subject: [PATCH 6/8] Cli: Don't run npm/yarn install in the directory the doesn't have package.json --- .../Volo/Abp/Cli/LIbs/InstallLibsService.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs index 71cf789c9c..1ca2ad987b 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs @@ -78,8 +78,15 @@ public class InstallLibsService : IInstallLibsService, ITransientDependency } // MVC or BLAZOR SERVER - if (projectPath.EndsWith("csproj")) + if (projectPath.EndsWith(".csproj")) { + var packageJsonFilePath = Path.Combine(Path.GetDirectoryName(projectPath), "package.json"); + + if (!File.Exists(packageJsonFilePath)) + { + continue; + } + if (IsYarnAvailable()) { RunYarn(projectDirectory); From 02087ca45ac9a36bea7501ddca981c5587750d0a Mon Sep 17 00:00:00 2001 From: Engincan VESKE Date: Mon, 20 Jun 2022 21:25:14 +0300 Subject: [PATCH 7/8] Update Application.md --- docs/en/Startup-Templates/Application.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/en/Startup-Templates/Application.md b/docs/en/Startup-Templates/Application.md index a262ef2d88..f2791a020c 100644 --- a/docs/en/Startup-Templates/Application.md +++ b/docs/en/Startup-Templates/Application.md @@ -34,6 +34,7 @@ This template provides multiple UI frameworks: * `mvc`: ASP.NET Core MVC UI with Razor Pages (default) * `blazor`: Blazor UI +* `blazor-server`: Blazor Server UI * `angular`: Angular UI Use the `-u` or `--ui` option to specify the UI framework: From cb327cde3923bd70dd6392880c27122b6afdf3e1 Mon Sep 17 00:00:00 2001 From: maliming Date: Tue, 21 Jun 2022 09:26:49 +0800 Subject: [PATCH 8/8] Undo changes to the Index page. --- .../Pages/Index.cshtml | 119 ++++-------------- .../Pages/Index.cshtml.cs | 18 +-- 2 files changed, 27 insertions(+), 110 deletions(-) diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/Pages/Index.cshtml b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/Pages/Index.cshtml index c61632e453..db9f1f100a 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/Pages/Index.cshtml +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/Pages/Index.cshtml @@ -1,103 +1,34 @@ @page -@using Microsoft.AspNetCore.Mvc.Localization @using MyCompanyName.MyProjectName.Pages -@using MyCompanyName.MyProjectName.Localization @using Volo.Abp.Users -@using Volo.Abp.AspNetCore.Mvc.UI.Theming -@using Volo.Abp.Ui.Branding @model IndexModel -@inject IHtmlLocalizer L @inject ICurrentUser CurrentUser -@inject IBrandingProvider BrandingProvider -@inject ITheme Theme - -@{ - Layout = Theme.GetEmptyLayout(); -} - -
-
+@if (CurrentUser.IsAuthenticated) +{ +
- - -
+} + +@if (!CurrentUser.IsAuthenticated) +{ +
+

+ Login +
+} diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Pages/Index.cshtml.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Pages/Index.cshtml.cs index dee9e692d8..e8230ee00c 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Pages/Index.cshtml.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Pages/Index.cshtml.cs @@ -1,24 +1,10 @@ using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; -using IdentityServer4.Stores; -using Volo.Abp.IdentityServer.Clients; -using System.Threading.Tasks; -using System.Collections.Generic; namespace MyCompanyName.MyProjectName.Pages; public class IndexModel : AbpPageModel { - public List Clients { get; protected set; } - - protected IClientRepository ClientRepository { get; } - - public IndexModel(IClientRepository clientRepository) + public void OnGet() { - this.ClientRepository = clientRepository; } - - public async Task OnGetAsync() - { - Clients = await ClientRepository.GetListAsync(includeDetails: true); - } -} \ No newline at end of file +}