将当前服务作为git.we965.cn的认证源
This commit is contained in:
@@ -10,6 +10,11 @@
|
|||||||
"Demo_Swagger": {
|
"Demo_Swagger": {
|
||||||
"ClientId": "Demo_Swagger",
|
"ClientId": "Demo_Swagger",
|
||||||
"RootUrl": "https://localhost:44322/"
|
"RootUrl": "https://localhost:44322/"
|
||||||
|
},
|
||||||
|
"Demo_Git": {
|
||||||
|
"ClientId": "Demo_Git",
|
||||||
|
"ClientSecret": "88077533-3e06-4447-818d-29472e340a6e",
|
||||||
|
"RootUrl": "https://git.we965.cn"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.Extensions.Configuration;
|
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<string> {
|
||||||
|
OpenIddictConstants.GrantTypes.AuthorizationCode,
|
||||||
|
OpenIddictConstants.GrantTypes.RefreshToken
|
||||||
|
},
|
||||||
|
scopes: commonScopes,
|
||||||
|
redirectUris: new List<string> {
|
||||||
|
$"{gitRootUrl}/users/auth/openid_connect/callback",
|
||||||
|
$"{gitRootUrl}/user/oauth2/Abp.Demo/callback"
|
||||||
|
},
|
||||||
|
postLogoutRedirectUris: new List<string> { $"{gitRootUrl}" },
|
||||||
|
clientUri: gitRootUrl
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,6 +85,14 @@ public class DemoHttpApiHostModule : AbpModule
|
|||||||
serverBuilder.SetIssuer(new Uri(configuration["AuthServer:Authority"]!));
|
serverBuilder.SetIssuer(new Uri(configuration["AuthServer:Authority"]!));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// DEV ONLY: Allow Gitea to connect via HTTP without forcing HTTPS metadata
|
||||||
|
PreConfigure<OpenIddictServerBuilder>(serverBuilder =>
|
||||||
|
{
|
||||||
|
serverBuilder.UseAspNetCore().DisableTransportSecurityRequirement();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
"Hua.Abp.Demo.HttpApi.Host": {
|
"Hua.Abp.Demo.HttpApi.Host": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"applicationUrl": "https://localhost:44322",
|
"applicationUrl": "https://localhost:44322;http://0.0.0.0:5000",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
"Default": "Host=localhost;Port=5432;Database=Demo;User ID=postgres;Password=123456;"
|
"Default": "Host=localhost;Port=5432;Database=Demo;User ID=postgres;Password=123456;"
|
||||||
},
|
},
|
||||||
"AuthServer": {
|
"AuthServer": {
|
||||||
"Authority": "https://localhost:44322",
|
"Authority": "http://192.168.31.2:5000",
|
||||||
"RequireHttpsMetadata": true,
|
"RequireHttpsMetadata": false,
|
||||||
"SwaggerClientId": "Demo_Swagger",
|
"SwaggerClientId": "Demo_Swagger",
|
||||||
"CertificatePassPhrase": "a8dad6bd-08cf-40f9-baaf-873686b50b75"
|
"CertificatePassPhrase": "a8dad6bd-08cf-40f9-baaf-873686b50b75"
|
||||||
},
|
},
|
||||||
@@ -20,6 +20,11 @@
|
|||||||
"WeGit": {
|
"WeGit": {
|
||||||
"ClientId": "your-client-id",
|
"ClientId": "your-client-id",
|
||||||
"ClientSecret": "your-client-secret"
|
"ClientSecret": "your-client-secret"
|
||||||
|
},
|
||||||
|
"Demo_Git": {
|
||||||
|
"ClientId": "Demo_Git",
|
||||||
|
"ClientSecret": "88077533-3e06-4447-818d-29472e340a6e",
|
||||||
|
"RootUrl": "https://git.we965.cn"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"StringEncryption": {
|
"StringEncryption": {
|
||||||
|
|||||||
Reference in New Issue
Block a user