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); builder.Configuration.Bind("AuthServer", options.ProviderOptions);
options.UserOptions.RoleClaim = JwtClaimTypes.Role; options.UserOptions.RoleClaim = JwtClaimTypes.Role;
options.ProviderOptions.DefaultScopes.Add("EventHub"); options.ProviderOptions.DefaultScopes.Add("EventHubAdmin");
options.ProviderOptions.DefaultScopes.Add("role"); options.ProviderOptions.DefaultScopes.Add("role");
options.ProviderOptions.DefaultScopes.Add("email"); options.ProviderOptions.DefaultScopes.Add("email");
options.ProviderOptions.DefaultScopes.Add("phone"); options.ProviderOptions.DefaultScopes.Add("phone");

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

@ -29,6 +29,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.Autofac" Version="4.2.1" /> <PackageReference Include="Volo.Abp.Autofac" Version="4.2.1" />
<ProjectReference Include="..\EventHub.Application.Contracts\EventHub.Application.Contracts.csproj" /> <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" /> <ProjectReference Include="..\EventHub.EntityFrameworkCore.DbMigrations\EventHub.EntityFrameworkCore.DbMigrations.csproj" />
</ItemGroup> </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.Autofac;
using Volo.Abp.BackgroundJobs; using Volo.Abp.BackgroundJobs;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
@ -8,7 +9,8 @@ namespace EventHub.DbMigrator
[DependsOn( [DependsOn(
typeof(AbpAutofacModule), typeof(AbpAutofacModule),
typeof(EventHubEntityFrameworkCoreDbMigrationsModule), typeof(EventHubEntityFrameworkCoreDbMigrationsModule),
typeof(EventHubApplicationContractsModule) typeof(EventHubApplicationContractsModule),
typeof(EventHubAdminApplicationContractsModule)
)] )]
public class EventHubDbMigratorModule : AbpModule public class EventHubDbMigratorModule : AbpModule
{ {

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

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

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

@ -25,8 +25,6 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\EventHub.Application\EventHub.Application.csproj" /> <ProjectReference Include="..\EventHub.Application\EventHub.Application.csproj" />
<ProjectReference Include="..\EventHub.HttpApi\EventHub.HttpApi.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" /> <ProjectReference Include="..\EventHub.EntityFrameworkCore.DbMigrations\EventHub.EntityFrameworkCore.DbMigrations.csproj" />
</ItemGroup> </ItemGroup>

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

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

Loading…
Cancel
Save