Add authorization for multitenancy pages. use add...store extension methods for IDS4.

pull/221/head
Halil İbrahim Kalkan 7 years ago
parent 9d1c0f5ad1
commit 56adbd8cbb

@ -1,6 +1,7 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AutoMapper;
using Volo.Abp.Identity;
using Volo.Abp.IdentityServer.AspNetIdentity;
using Volo.Abp.IdentityServer.Clients;
using Volo.Abp.Modularity;
using Volo.Abp.Security;
@ -38,6 +39,8 @@ namespace Volo.Abp.IdentityServer
identityServerBuilder
.AddDeveloperSigningCredential() //TODO: Should be able to change this!
.AddClientStore<ClientStore>()
.AddResourceStore<ResourceStore>()
.AddAbpIdentityServer();
services.ExecutePreConfiguredActions(identityServerBuilder);

@ -1,11 +1,10 @@
using System.Threading.Tasks;
using IdentityServer4.Stores;
using Volo.Abp.DependencyInjection;
using Volo.Abp.ObjectMapping;
namespace Volo.Abp.IdentityServer.Clients
{
public class ClientStore : IClientStore, ITransientDependency
public class ClientStore : IClientStore
{
private readonly IClientRepository _clientRepository;
private readonly IObjectMapper _objectMapper;

@ -3,14 +3,13 @@ using System.Linq;
using System.Threading.Tasks;
using IdentityServer4.Models;
using IdentityServer4.Stores;
using Volo.Abp.DependencyInjection;
using Volo.Abp.IdentityServer.IdentityResources;
using Volo.Abp.ObjectMapping;
using IdentityResource = Volo.Abp.IdentityServer.IdentityResources.IdentityResource;
namespace Volo.Abp.IdentityServer
{
public class ResourceStore : IResourceStore, ITransientDependency
public class ResourceStore : IResourceStore
{
private readonly IIdentityResourceRepository _identityResourceRepository;
private readonly IObjectMapper _objectMapper;

@ -1,4 +1,5 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap;
using Volo.Abp.AutoMapper;
@ -26,8 +27,6 @@ namespace Volo.Abp.MultiTenancy.Web
public override void ConfigureServices(IServiceCollection services)
{
services.AddAssemblyOf<AbpMultiTenancyWebModule>();
services.Configure<NavigationOptions>(options =>
{
options.MenuContributors.Add(new AbpMultiTenancyWebMainMenuContributor());
@ -47,6 +46,15 @@ namespace Volo.Abp.MultiTenancy.Web
{
options.AddProfile<AbpMultiTenancyWebAutoMapperProfile>(validate: true);
});
services.Configure<RazorPagesOptions>(options =>
{
options.Conventions.AuthorizePage("/MultiTenancy/Tenants/Index", TenantManagementPermissions.Tenants.Default);
options.Conventions.AuthorizePage("/MultiTenancy/Tenants/CreateModal", TenantManagementPermissions.Tenants.Create);
options.Conventions.AuthorizePage("/MultiTenancy/Tenants/EditModal", TenantManagementPermissions.Tenants.Update);
});
services.AddAssemblyOf<AbpMultiTenancyWebModule>();
}
}
}
Loading…
Cancel
Save