Skip to content

Commit

Permalink
Merge pull request #989 from colinin/fix-docker-openiddict
Browse files Browse the repository at this point in the history
Fix docker openiddict
  • Loading branch information
colinin authored Aug 16, 2024
2 parents d9a3d28 + e968202 commit 47aa6b5
Show file tree
Hide file tree
Showing 23 changed files with 97 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ namespace LY.MicroService.AuthServer;
typeof(AbpAuthorizationOrganizationUnitsModule),
typeof(AbpAuditLoggingElasticsearchModule),
typeof(AbpEmailingExceptionHandlingModule),
typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpIdentitySessionAspNetCoreModule),
typeof(AbpCAPEventBusModule),
typeof(AbpHttpClientModule),
typeof(AbpAliyunSmsModule),
typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpLocalizationCultureMapModule),
typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpIdentitySessionAspNetCoreModule),
typeof(AbpAspNetCoreHttpOverridesModule),
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpClaimsMappingModule),
Expand Down Expand Up @@ -130,12 +130,12 @@ public override void OnApplicationInitialization(ApplicationInitializationContex
// 认证
app.UseAuthentication();
app.UseJwtTokenMiddleware();
// 多租户
app.UseMultiTenancy();
// 会话
app.UseAbpSession();
// 动态身份
app.UseDynamicClaims();
// 多租户
app.UseMultiTenancy();
// 授权
app.UseAuthorization();
// Swagger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"tag": "AuthServer.Admin"
},
"App": {
"ShowPii": true,
"CorsOrigins": "http://127.0.0.1:3100",
"Urls": {
"Applications": {
Expand Down Expand Up @@ -86,7 +87,7 @@
"InstanceName": "LINGYUN.Abp.Application"
},
"AuthServer": {
"Authority": "http://127.0.0.1:44385/",
"Authority": "http://127.0.0.1:44385",
"Audience": "lingyun-abp-application",
"MapInboundClaims": false,
"RequireHttpsMetadata": false
Expand All @@ -103,9 +104,9 @@
"MinimumLevel": {
"Default": "Debug",
"Override": {
"System": "Warning",
"Microsoft": "Warning",
"DotNetCore": "Debug"
"System": "Information",
"Microsoft": "Information",
"DotNetCore": "Warning"
}
},
"WriteTo": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private void PreConfigureCertificate(IConfiguration configuration, IWebHostEnvir

builder.AddEncryptionCertificate(cer);

builder.UseDataProtection();
// builder.UseDataProtection();
});
}
}
Expand Down Expand Up @@ -181,7 +181,7 @@ private void PreConfigureCertificate(IConfiguration configuration, IWebHostEnvir
}


builder.UseDataProtection();
// builder.UseDataProtection();

// 禁用https
builder.UseAspNetCore()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ public override void OnApplicationInitialization(ApplicationInitializationContex
app.UseCors(DefaultCorsPolicyName);
app.UseAuthentication();
app.UseAbpOpenIddictValidation();
app.UseMultiTenancy();
app.UseAbpSession();
app.UseDynamicClaims();
app.UseMultiTenancy();
app.UseAuthorization();
app.UseAuditing();
app.UseAbpSerilogEnrichers();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<PackageReference Include="Serilog.Settings.Configuration" />
<PackageReference Include="Serilog.Sinks.File" />
<PackageReference Include="Serilog.Sinks.Elasticsearch" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" />
<!--<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.5">
<PrivateAssets>all</PrivateAssets>
Expand All @@ -44,7 +45,6 @@
<PackageReference Include="Volo.Abp.Account.Application" />
<PackageReference Include="Volo.Abp.Account.Web.OpenIddict" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" />
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" />
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" />
<PackageReference Include="Volo.Abp.Autofac" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.MySQL" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,12 @@ public override void OnApplicationInitialization(ApplicationInitializationContex
// 认证
app.UseAuthentication();
app.UseJwtTokenMiddleware();
// 多租户
app.UseMultiTenancy();
// 会话
app.UseAbpSession();
// jwt
app.UseDynamicClaims();
// 多租户
app.UseMultiTenancy();
// 授权
app.UseAuthorization();
// Swagger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ public override void OnApplicationInitialization(ApplicationInitializationContex
// 认证
app.UseAuthentication();
app.UseJwtTokenMiddleware();
// 多租户
app.UseMultiTenancy();
// 会话
app.UseAbpSession();
app.UseDynamicClaims();
// 多租户
app.UseMultiTenancy();
// 授权
app.UseAuthorization();
// Swagger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ public override void OnApplicationInitialization(ApplicationInitializationContex
// 认证
app.UseAuthentication();
app.UseJwtTokenMiddleware();
// 多租户
app.UseMultiTenancy();
// 会话
app.UseAbpSession();
app.UseDynamicClaims();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,11 @@ public override void OnApplicationInitialization(ApplicationInitializationContex
// 认证
app.UseAuthentication();
app.UseJwtTokenMiddleware();
// 多租户
app.UseMultiTenancy();
// 会话
app.UseAbpSession();
app.UseDynamicClaims();
// 多租户
app.UseMultiTenancy();
// 授权
app.UseAuthorization();
// Swagger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ public override void OnApplicationInitialization(ApplicationInitializationContex
// 认证
app.UseAuthentication();
app.UseJwtTokenMiddleware();
// 多租户
app.UseMultiTenancy();
// 会话
app.UseAbpSession();
app.UseDynamicClaims();
// 多租户
app.UseMultiTenancy();
// 授权
app.UseAuthorization();
// Swagger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@ public override void OnApplicationInitialization(ApplicationInitializationContex
app.UseRouting();
app.UseCors(DefaultCorsPolicyName);
app.UseAuthentication();
app.UseDynamicClaims();
app.UseJwtTokenMiddleware();
app.UseMultiTenancy();
app.UseDynamicClaims();
app.UseAuthorization();
app.UseSwagger();
app.UseAbpSwaggerUI(options =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ public override void OnApplicationInitialization(ApplicationInitializationContex
app.UseCors();
app.UseAuthentication();
app.UseJwtTokenMiddleware();
app.UseMultiTenancy();
app.UseAbpSession();
app.UseDynamicClaims();
app.UseMultiTenancy();
app.UseAuthorization();
app.UseSwagger();
app.UseAbpSwaggerUI(options =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ public override void OnApplicationInitialization(ApplicationInitializationContex
app.UseCors();
app.UseAuthentication();
app.UseJwtTokenMiddleware();
app.UseMultiTenancy();
app.UseAbpSession();
app.UseDynamicClaims();
app.UseMultiTenancy();
app.UseAuthorization();
app.UseSwagger();
app.UseAbpSwaggerUI(options =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ public override void OnApplicationInitialization(ApplicationInitializationContex
app.UseElsaFeatures();
app.UseAuthentication();
app.UseJwtTokenMiddleware();
app.UseMultiTenancy();
app.UseAbpSession();
app.UseDynamicClaims();
app.UseMultiTenancy();
app.UseAuthorization();
app.UseSwagger();
app.UseAbpSwaggerUI(options =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>net8.0</TargetFramework> <!-- 或其他适合的框架 -->
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>LINGYUN.Abp.MicroService.Templates</PackageId>
<Version>8.1.3</Version>
<Version>8.2.1</Version>
<Authors>[email protected]</Authors>
<Description>Abp framework micro-service template</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
6 changes: 3 additions & 3 deletions aspnet-core/templates/content/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

<!-- Abp Framework -->
<ItemGroup>
<PackageVersion Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="3.0.5" />
<PackageVersion Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="3.2.0" />
<PackageVersion Include="Volo.Abp.Core" Version="$(VoloAbpPackageVersion)" />
<PackageVersion Include="Volo.Abp.Account.Application" Version="$(VoloAbpPackageVersion)" />
<PackageVersion Include="Volo.Abp.Account.Application.Contracts" Version="$(VoloAbpPackageVersion)" />
Expand Down Expand Up @@ -195,7 +195,7 @@

<!-- .NET -->
<ItemGroup>
<PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="$(MicrosoftAspNetCorePackageVersion)" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.4" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="$(MicrosoftAspNetCorePackageVersion)" />
<PackageVersion Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="$(MicrosoftAspNetCorePackageVersion)" />
<PackageVersion Include="Microsoft.AspNetCore.SignalR.Protocols.Json" Version="$(MicrosoftAspNetCorePackageVersion)" />
Expand All @@ -211,7 +211,7 @@
<PackageVersion Include="Microsoft.Extensions.Http" Version="$(MicrosoftExtensionsPackageVersion)" />
<PackageVersion Include="Microsoft.Extensions.Http.Polly" Version="$(MicrosoftExtensionsPackageVersion)" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="$(MicrosoftExtensionsPackageVersion)" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="$(MicrosoftExtensionsPackageVersion)" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="8.0.2" />
</ItemGroup>

<!-- Elsa -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@
},
"AuthServer": {
"Authority": "http://127.0.0.1:44385/",
"ApiName": "lingyun-abp-application",
"Audience": "lingyun-abp-application",
"MapInboundClaims": false,
"RequireHttpsMetadata": false,
"SwaggerClientId": "InternalServiceClient",
"SwaggerClientSecret": "1q2w3E*"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
using PackageName.CompanyName.ProjectName.Localization;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Localization;

namespace PackageName.CompanyName.ProjectName.Authorization;

public class ProjectNamePermissionDefinitionProvider : PermissionDefinitionProvider
{
public override void Define(IPermissionDefinitionContext context)
{
var group = context.AddGroup(ProjectNamePermissions.GroupName, L("Permission:ProjectName"));

group.AddPermission(
ProjectNamePermissions.ManageSettings,
L("Permission:ManageSettings"));
}

private static LocalizableString L(string name)
{
return LocalizableString.Create<ProjectNameResource>(name);
}
}
using PackageName.CompanyName.ProjectName.Localization;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Localization;

namespace PackageName.CompanyName.ProjectName.Permissions;

public class ProjectNamePermissionDefinitionProvider : PermissionDefinitionProvider
{
public override void Define(IPermissionDefinitionContext context)
{
var group = context.AddGroup(ProjectNamePermissions.GroupName, L("Permission:ProjectName"));

group.AddPermission(
ProjectNamePermissions.ManageSettings,
L("Permission:ManageSettings"));
}

private static LocalizableString L(string name)
{
return LocalizableString.Create<ProjectNameResource>(name);
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace PackageName.CompanyName.ProjectName.Authorization;

public static class ProjectNamePermissions
{
public const string GroupName = "ProjectName";

public const string ManageSettings = GroupName + ".ManageSettings";
}
namespace PackageName.CompanyName.ProjectName.Permissions;

public static class ProjectNamePermissions
{
public const string GroupName = "ProjectName";

public const string ManageSettings = GroupName + ".ManageSettings";
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using LINGYUN.Abp.SettingManagement;
using Microsoft.AspNetCore.Authorization;
using PackageName.CompanyName.ProjectName.Authorization;
using PackageName.CompanyName.ProjectName.Permissions;
using PackageName.CompanyName.ProjectName.Localization;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using LINGYUN.Abp.SettingManagement;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using PackageName.CompanyName.ProjectName.Authorization;
using PackageName.CompanyName.ProjectName.Permissions;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;
Expand Down
Loading

0 comments on commit 47aa6b5

Please sign in to comment.