Browse Source

Remove admin API from eventhub API & fix permissions

pull/46/head
Halil İbrahim Kalkan 5 years ago
parent
commit
72872d91e1
  1. 2
      src/EventHub.Admin.Web/EventHubBlazorModule.cs
  2. 1
      src/EventHub.DbMigrator/EventHub.DbMigrator.csproj
  3. 6
      src/EventHub.DbMigrator/EventHubDbMigratorModule.cs
  4. 3
      src/EventHub.Domain/Data/IdentityServerDataSeedContributor.cs
  5. 2
      src/EventHub.HttpApi.Host/EventHub.HttpApi.Host.csproj
  6. 4
      src/EventHub.HttpApi.Host/EventHubHttpApiHostModule.cs

2
src/EventHub.Admin.Web/EventHubBlazorModule.cs

@ -69,7 +69,7 @@ namespace EventHub.Admin.Web
{
builder.Configuration.Bind("AuthServer", options.ProviderOptions);
options.UserOptions.RoleClaim = JwtClaimTypes.Role;
options.ProviderOptions.DefaultScopes.Add("EventHub");
options.ProviderOptions.DefaultScopes.Add("EventHubAdmin");
options.ProviderOptions.DefaultScopes.Add("role");
options.ProviderOptions.DefaultScopes.Add("email");
options.ProviderOptions.DefaultScopes.Add("phone");

1
src/EventHub.DbMigrator/EventHub.DbMigrator.csproj

@ -29,6 +29,7 @@
<ItemGroup>
<PackageReference Include="Volo.Abp.Autofac" Version="4.2.1" />
<ProjectReference Include="..\EventHub.Application.Contracts\EventHub.Application.Contracts.csproj" />
<ProjectReference Include="..\EventHub.Admin.Application.Contracts\EventHub.Admin.Application.Contracts.csproj" />
<ProjectReference Include="..\EventHub.EntityFrameworkCore.DbMigrations\EventHub.EntityFrameworkCore.DbMigrations.csproj" />
</ItemGroup>

6
src/EventHub.DbMigrator/EventHubDbMigratorModule.cs

@ -1,4 +1,5 @@
using EventHub.EntityFrameworkCore;
using EventHub.Admin;
using EventHub.EntityFrameworkCore;
using Volo.Abp.Autofac;
using Volo.Abp.BackgroundJobs;
using Volo.Abp.Modularity;
@ -8,7 +9,8 @@ namespace EventHub.DbMigrator
[DependsOn(
typeof(AbpAutofacModule),
typeof(EventHubEntityFrameworkCoreDbMigrationsModule),
typeof(EventHubApplicationContractsModule)
typeof(EventHubApplicationContractsModule),
typeof(EventHubAdminApplicationContractsModule)
)]
public class EventHubDbMigratorModule : AbpModule
{

3
src/EventHub.Domain/Data/IdentityServerDataSeedContributor.cs

@ -67,6 +67,7 @@ namespace EventHub.Data
private async Task CreateApiScopesAsync()
{
await CreateApiScopeAsync("EventHub");
await CreateApiScopeAsync("EventHubAdmin");
}
private async Task CreateApiResourcesAsync()
@ -154,7 +155,7 @@ namespace EventHub.Data
await CreateClientAsync(
name: webClientId,
scopes: commonScopes.Union(new []{"EventHubAdmin"}),
scopes: commonScopes.Union(new []{"EventHub"}),
grantTypes: new[] { "hybrid" },
secret: (configurationSection["EventHub_Web:ClientSecret"] ?? "1q2w3e*").Sha256(),
redirectUri: $"{webClientRootUrl}signin-oidc",

2
src/EventHub.HttpApi.Host/EventHub.HttpApi.Host.csproj

@ -25,8 +25,6 @@
<ItemGroup>
<ProjectReference Include="..\EventHub.Application\EventHub.Application.csproj" />
<ProjectReference Include="..\EventHub.HttpApi\EventHub.HttpApi.csproj" />
<ProjectReference Include="..\EventHub.Admin.Application\EventHub.Admin.Application.csproj" />
<ProjectReference Include="..\EventHub.Admin.HttpApi\EventHub.Admin.HttpApi.csproj" />
<ProjectReference Include="..\EventHub.EntityFrameworkCore.DbMigrations\EventHub.EntityFrameworkCore.DbMigrations.csproj" />
</ItemGroup>

4
src/EventHub.HttpApi.Host/EventHubHttpApiHostModule.cs

@ -3,12 +3,10 @@ using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using EventHub.Admin;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
@ -35,8 +33,6 @@ namespace EventHub
[DependsOn(
typeof(EventHubApplicationModule),
typeof(EventHubHttpApiModule),
typeof(EventHubAdminApplicationModule),
typeof(EventHubAdminHttpApiModule),
typeof(EventHubEntityFrameworkCoreDbMigrationsModule),
typeof(AbpAutofacModule),
typeof(AbpCachingStackExchangeRedisModule),

Loading…
Cancel
Save