Browse Source
Add resource management providers for IdentityServer and OpenIddict
pull/24515/head
maliming
1 month ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
2 changed files with
32 additions and
2 deletions
-
modules/identityserver/src/Volo.Abp.PermissionManagement.Domain.IdentityServer/Volo/Abp/PermissionManagement/IdentityServer/AbpPermissionManagementDomainIdentityServerModule.cs
-
modules/openiddict/src/Volo.Abp.PermissionManagement.Domain.OpenIddict/Volo/Abp/PermissionManagement/OpenIddict/AbpPermissionManagementDomainOpenIddictModule.cs
|
|
|
@ -1,5 +1,8 @@ |
|
|
|
using Volo.Abp.Authorization.Permissions; |
|
|
|
using System; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Volo.Abp.Authorization.Permissions; |
|
|
|
using Volo.Abp.IdentityServer; |
|
|
|
using Volo.Abp.IdentityServer.Clients; |
|
|
|
using Volo.Abp.Modularity; |
|
|
|
|
|
|
|
namespace Volo.Abp.PermissionManagement.IdentityServer; |
|
|
|
@ -18,5 +21,17 @@ public class AbpPermissionManagementDomainIdentityServerModule : AbpModule |
|
|
|
|
|
|
|
options.ProviderPolicies[ClientPermissionValueProvider.ProviderName] = "IdentityServer.Client.ManagePermissions"; |
|
|
|
}); |
|
|
|
|
|
|
|
context.Services.AddAbpOptions<PermissionManagementOptions>().PostConfigure<IServiceProvider>((options, serviceProvider) => |
|
|
|
{ |
|
|
|
// The IClientFinder implementation in identity Server Pro module for tiered application.
|
|
|
|
if (serviceProvider.GetService<IClientFinder>() == null) |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
options.ResourceManagementProviders.Add<ClientResourcePermissionManagementProvider>(); |
|
|
|
options.ResourcePermissionProviderKeyLookupServices.Add<ClientResourcePermissionProviderKeyLookupService>(); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -1,6 +1,9 @@ |
|
|
|
using Volo.Abp.Authorization.Permissions; |
|
|
|
using System; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Volo.Abp.Authorization.Permissions; |
|
|
|
using Volo.Abp.Modularity; |
|
|
|
using Volo.Abp.OpenIddict; |
|
|
|
using Volo.Abp.OpenIddict.Applications; |
|
|
|
|
|
|
|
namespace Volo.Abp.PermissionManagement.OpenIddict; |
|
|
|
|
|
|
|
@ -17,5 +20,17 @@ public class AbpPermissionManagementDomainOpenIddictModule : AbpModule |
|
|
|
options.ManagementProviders.Add<ApplicationPermissionManagementProvider>(); |
|
|
|
options.ProviderPolicies[ClientPermissionValueProvider.ProviderName] = "OpenIddictPro.Application.ManagePermissions"; |
|
|
|
}); |
|
|
|
|
|
|
|
context.Services.AddAbpOptions<PermissionManagementOptions>().PostConfigure<IServiceProvider>((options, serviceProvider) => |
|
|
|
{ |
|
|
|
// The IApplicationFinder implementation in OpenIddict Pro module for tiered application.
|
|
|
|
if (serviceProvider.GetService<IApplicationFinder>() == null) |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
options.ResourceManagementProviders.Add<ApplicationResourcePermissionManagementProvider>(); |
|
|
|
options.ResourcePermissionProviderKeyLookupServices.Add<ApplicationResourcePermissionProviderKeyLookupService>(); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|