diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/TemplateRandomSslPortStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/TemplateRandomSslPortStep.cs index 3b980801e7..bcb3a36862 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/TemplateRandomSslPortStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/TemplateRandomSslPortStep.cs @@ -49,7 +49,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates var consoleTestApp = appSettings.FirstOrDefault(x => x.Name.Equals("/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/appsettings.json", StringComparison.InvariantCultureIgnoreCase)); - consoleTestApp?.SetContent(consoleTestApp.Content.Replace("https://localhost:44302", "https://localhost:44303")); + consoleTestApp?.SetContent(consoleTestApp.Content.Replace("https://localhost:44300", "https://localhost:44303")); consoleTestApp?.SetContent(consoleTestApp.Content.Replace("https://localhost:44301", "https://localhost:44303")); } } diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionCache.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionCache.cs index 06b16afb57..a865dd7a48 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionCache.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionCache.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Newtonsoft.Json; @@ -42,7 +43,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying { using (var client = _httpClientFactory.Create()) { - var response = await client.GetAsync(baseUrl + "api/abp/api-definition"); + var response = await client.GetAsync(baseUrl.EnsureEndsWith('/') + "api/abp/api-definition"); if (!response.IsSuccessStatusCode) { throw new AbpException("Remote service returns error!"); diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs index 5b200daf85..222cfdfd1f 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs @@ -135,7 +135,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying var action = await ApiDescriptionFinder.FindActionAsync(remoteServiceConfig.BaseUrl, typeof(TService), invocation.Method); var apiVersion = GetApiVersionInfo(action); - var url = remoteServiceConfig.BaseUrl + UrlBuilder.GenerateUrlWithParameters(action, invocation.ArgumentsDictionary, apiVersion); + var url = remoteServiceConfig.BaseUrl.EnsureEndsWith('/') + UrlBuilder.GenerateUrlWithParameters(action, invocation.ArgumentsDictionary, apiVersion); var requestMessage = new HttpRequestMessage(action.GetHttpMethod(), url) { diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.DbMigrator/appsettings.json b/templates/mvc/src/MyCompanyName.MyProjectName.DbMigrator/appsettings.json index b4307d8d92..2ccb7a6103 100644 --- a/templates/mvc/src/MyCompanyName.MyProjectName.DbMigrator/appsettings.json +++ b/templates/mvc/src/MyCompanyName.MyProjectName.DbMigrator/appsettings.json @@ -6,10 +6,12 @@ "Clients": { "MyProjectName_Web": { "ClientId": "MyProjectName_Web", + "ClientSecret": "1q2w3e*", "RootUrl": "https://localhost:44302" }, "MyProjectName_ConsoleTestApp": { - "ClientId": "MyProjectName_ConsoleTestApp" + "ClientId": "MyProjectName_ConsoleTestApp", + "ClientSecret": "1q2w3e*" } } } diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs b/templates/mvc/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs index 48d82dae90..16d4a88dd1 100644 --- a/templates/mvc/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs +++ b/templates/mvc/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using IdentityServer4.Models; using Volo.Abp.Authorization.Permissions; using Volo.Abp.Configuration; using Volo.Abp.Data; @@ -11,6 +12,8 @@ using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.IdentityResources; using Volo.Abp.PermissionManagement; using Volo.Abp.Uow; +using ApiResource = Volo.Abp.IdentityServer.ApiResources.ApiResource; +using Client = Volo.Abp.IdentityServer.Clients.Client; namespace MyCompanyName.MyProjectName.IdentityServer { @@ -90,8 +93,6 @@ namespace MyCompanyName.MyProjectName.IdentityServer private async Task CreateClientsAsync() { - const string commonSecret = "E5Xd4yMqjP5kjWFKrYgySBju6JVfCzMyFp7n2QmMrME="; - var commonScopes = new[] { "email", @@ -118,7 +119,7 @@ namespace MyCompanyName.MyProjectName.IdentityServer webClientId, commonScopes, new[] { "hybrid" }, - commonSecret, + (configurationSection["MyProjectName_Web:ClientSecret"] ?? "1q2w3e*").Sha256(), redirectUri: $"{webClientRootUrl}signin-oidc", postLogoutRedirectUri: $"{webClientRootUrl}signout-callback-oidc" ); @@ -132,7 +133,7 @@ namespace MyCompanyName.MyProjectName.IdentityServer consoleClientId, commonScopes, new[] { "password", "client_credentials" }, - commonSecret + (configurationSection["MyProjectName_ConsoleTestApp:ClientSecret"] ?? "1q2w3e*").Sha256() ); } } diff --git a/templates/mvc/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/appsettings.json b/templates/mvc/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/appsettings.json index a42c448646..22fd42a0ae 100644 --- a/templates/mvc/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/appsettings.json +++ b/templates/mvc/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/appsettings.json @@ -1,7 +1,7 @@ { "RemoteServices": { "Default": { - "BaseUrl": "https://localhost:44302" + "BaseUrl": "https://localhost:44300" } }, "IdentityClients": {