diff --git a/src/Hua.Abp.Demo.DbMigrator/appsettings.json b/src/Hua.Abp.Demo.DbMigrator/appsettings.json index 8a9e5f4..b3c028a 100644 --- a/src/Hua.Abp.Demo.DbMigrator/appsettings.json +++ b/src/Hua.Abp.Demo.DbMigrator/appsettings.json @@ -10,6 +10,11 @@ "Demo_Swagger": { "ClientId": "Demo_Swagger", "RootUrl": "https://localhost:44322/" + }, + "Demo_Git": { + "ClientId": "Demo_Git", + "ClientSecret": "88077533-3e06-4447-818d-29472e340a6e", + "RootUrl": "https://git.we965.cn" } } } diff --git a/src/Hua.Abp.Demo.Domain/OpenIddict/OpenIddictDataSeedContributor.cs b/src/Hua.Abp.Demo.Domain/OpenIddict/OpenIddictDataSeedContributor.cs index 7c2841e..58a2c67 100644 --- a/src/Hua.Abp.Demo.Domain/OpenIddict/OpenIddictDataSeedContributor.cs +++ b/src/Hua.Abp.Demo.Domain/OpenIddict/OpenIddictDataSeedContributor.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.Extensions.Configuration; @@ -113,6 +113,34 @@ public class OpenIddictDataSeedContributor : OpenIddictDataSeedContributorBase, ); } + // Git Client + var gitClientId = configurationSection["Demo_Git:ClientId"]; + if (!gitClientId.IsNullOrWhiteSpace()) + { + var gitRootUrl = configurationSection["Demo_Git:RootUrl"]?.TrimEnd('/'); + var gitClientSecret = configurationSection["Demo_Git:ClientSecret"]; + + await CreateOrUpdateApplicationAsync( + applicationType: OpenIddictConstants.ApplicationTypes.Web, + name: gitClientId!, + type: OpenIddictConstants.ClientTypes.Confidential, + consentType: OpenIddictConstants.ConsentTypes.Implicit, + displayName: "Git Application", + secret: gitClientSecret, + grantTypes: new List { + OpenIddictConstants.GrantTypes.AuthorizationCode, + OpenIddictConstants.GrantTypes.RefreshToken + }, + scopes: commonScopes, + redirectUris: new List { + $"{gitRootUrl}/users/auth/openid_connect/callback", + $"{gitRootUrl}/user/oauth2/Abp.Demo/callback" + }, + postLogoutRedirectUris: new List { $"{gitRootUrl}" }, + clientUri: gitRootUrl + ); + } + } } diff --git a/src/Hua.Abp.Demo.HttpApi.Host/DemoHttpApiHostModule.cs b/src/Hua.Abp.Demo.HttpApi.Host/DemoHttpApiHostModule.cs index 432f9ba..5f65fd3 100644 --- a/src/Hua.Abp.Demo.HttpApi.Host/DemoHttpApiHostModule.cs +++ b/src/Hua.Abp.Demo.HttpApi.Host/DemoHttpApiHostModule.cs @@ -85,6 +85,14 @@ public class DemoHttpApiHostModule : AbpModule serverBuilder.SetIssuer(new Uri(configuration["AuthServer:Authority"]!)); }); } + else + { + // DEV ONLY: Allow Gitea to connect via HTTP without forcing HTTPS metadata + PreConfigure(serverBuilder => + { + serverBuilder.UseAspNetCore().DisableTransportSecurityRequirement(); + }); + } } public override void ConfigureServices(ServiceConfigurationContext context) diff --git a/src/Hua.Abp.Demo.HttpApi.Host/Properties/launchSettings.json b/src/Hua.Abp.Demo.HttpApi.Host/Properties/launchSettings.json index c1210c0..e839c00 100644 --- a/src/Hua.Abp.Demo.HttpApi.Host/Properties/launchSettings.json +++ b/src/Hua.Abp.Demo.HttpApi.Host/Properties/launchSettings.json @@ -18,7 +18,7 @@ "Hua.Abp.Demo.HttpApi.Host": { "commandName": "Project", "launchBrowser": true, - "applicationUrl": "https://localhost:44322", + "applicationUrl": "https://localhost:44322;http://0.0.0.0:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/src/Hua.Abp.Demo.HttpApi.Host/appsettings.json b/src/Hua.Abp.Demo.HttpApi.Host/appsettings.json index 0d00351..d2f9d32 100644 --- a/src/Hua.Abp.Demo.HttpApi.Host/appsettings.json +++ b/src/Hua.Abp.Demo.HttpApi.Host/appsettings.json @@ -11,8 +11,8 @@ "Default": "Host=localhost;Port=5432;Database=Demo;User ID=postgres;Password=123456;" }, "AuthServer": { - "Authority": "https://localhost:44322", - "RequireHttpsMetadata": true, + "Authority": "http://192.168.31.2:5000", + "RequireHttpsMetadata": false, "SwaggerClientId": "Demo_Swagger", "CertificatePassPhrase": "a8dad6bd-08cf-40f9-baaf-873686b50b75" }, @@ -20,6 +20,11 @@ "WeGit": { "ClientId": "your-client-id", "ClientSecret": "your-client-secret" + }, + "Demo_Git": { + "ClientId": "Demo_Git", + "ClientSecret": "88077533-3e06-4447-818d-29472e340a6e", + "RootUrl": "https://git.we965.cn" } }, "StringEncryption": {