maliming
4 years ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
5 changed files with
44 additions and
1 deletions
-
modules/openiddict/app/OpenIddict.Demo.Server/Migrations/20230404033745_Initial.Designer.cs
-
modules/openiddict/app/OpenIddict.Demo.Server/Migrations/20230404033745_Initial.cs
-
modules/openiddict/app/OpenIddict.Demo.Server/Migrations/ServerDbContextModelSnapshot.cs
-
modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/AbpOpenIddictAspNetCoreModule.cs
-
modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Scopes/AttachScopes.cs
|
|
|
@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; |
|
|
|
namespace OpenIddict.Demo.Server.Migrations |
|
|
|
{ |
|
|
|
[DbContext(typeof(ServerDbContext))] |
|
|
|
[Migration("20230307054116_Initial")] |
|
|
|
[Migration("20230404033745_Initial")] |
|
|
|
partial class Initial |
|
|
|
{ |
|
|
|
/// <inheritdoc />
|
|
|
|
@ -455,6 +455,9 @@ namespace OpenIddict.Demo.Server.Migrations |
|
|
|
.HasColumnType("uniqueidentifier") |
|
|
|
.HasColumnName("LastModifierId"); |
|
|
|
|
|
|
|
b.Property<DateTimeOffset?>("LastPasswordChangeTime") |
|
|
|
.HasColumnType("datetimeoffset"); |
|
|
|
|
|
|
|
b.Property<bool>("LockoutEnabled") |
|
|
|
.ValueGeneratedOnAdd() |
|
|
|
.HasColumnType("bit") |
|
|
|
@ -283,6 +283,7 @@ namespace OpenIddict.Demo.Server.Migrations |
|
|
|
AccessFailedCount = table.Column<int>(type: "int", nullable: false, defaultValue: 0), |
|
|
|
ShouldChangePasswordOnNextLogin = table.Column<bool>(type: "bit", nullable: false), |
|
|
|
EntityVersion = table.Column<int>(type: "int", nullable: false), |
|
|
|
LastPasswordChangeTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true), |
|
|
|
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|
|
|
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true), |
|
|
|
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
|
|
|
@ -452,6 +452,9 @@ namespace OpenIddict.Demo.Server.Migrations |
|
|
|
.HasColumnType("uniqueidentifier") |
|
|
|
.HasColumnName("LastModifierId"); |
|
|
|
|
|
|
|
b.Property<DateTimeOffset?>("LastPasswordChangeTime") |
|
|
|
.HasColumnType("datetimeoffset"); |
|
|
|
|
|
|
|
b.Property<bool>("LockoutEnabled") |
|
|
|
.ValueGeneratedOnAdd() |
|
|
|
.HasColumnType("bit") |
|
|
|
|
|
|
|
@ -5,6 +5,7 @@ using OpenIddict.Server; |
|
|
|
using Volo.Abp.AspNetCore.MultiTenancy; |
|
|
|
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; |
|
|
|
using Volo.Abp.Modularity; |
|
|
|
using Volo.Abp.OpenIddict.Scopes; |
|
|
|
using Volo.Abp.OpenIddict.WildcardDomains; |
|
|
|
using Volo.Abp.Security.Claims; |
|
|
|
|
|
|
|
@ -133,6 +134,7 @@ public class AbpOpenIddictAspNetCoreModule : AbpModule |
|
|
|
} |
|
|
|
|
|
|
|
builder.AddEventHandler(RemoveClaimsFromClientCredentialsGrantType.Descriptor); |
|
|
|
builder.AddEventHandler(AttachScopes.Descriptor); |
|
|
|
|
|
|
|
services.ExecutePreConfiguredActions(builder); |
|
|
|
}); |
|
|
|
|
|
|
|
@ -0,0 +1,34 @@ |
|
|
|
using System; |
|
|
|
using System.Linq; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using OpenIddict.Server; |
|
|
|
|
|
|
|
namespace Volo.Abp.OpenIddict.Scopes; |
|
|
|
|
|
|
|
public class AttachScopes : IOpenIddictServerHandler<OpenIddictServerEvents.HandleConfigurationRequestContext> |
|
|
|
{ |
|
|
|
public static OpenIddictServerHandlerDescriptor Descriptor { get; } |
|
|
|
= OpenIddictServerHandlerDescriptor.CreateBuilder<OpenIddictServerEvents.HandleConfigurationRequestContext>() |
|
|
|
.UseSingletonHandler<AttachScopes>() |
|
|
|
.SetOrder(OpenIddictServerHandlers.Discovery.AttachScopes.Descriptor.Order + 1) |
|
|
|
.SetType(OpenIddictServerHandlerType.Custom) |
|
|
|
.Build(); |
|
|
|
|
|
|
|
private readonly IOpenIddictScopeRepository _scopeRepository; |
|
|
|
|
|
|
|
public AttachScopes(IOpenIddictScopeRepository scopeRepository) |
|
|
|
{ |
|
|
|
_scopeRepository = scopeRepository; |
|
|
|
} |
|
|
|
|
|
|
|
public async ValueTask HandleAsync(OpenIddictServerEvents.HandleConfigurationRequestContext context) |
|
|
|
{ |
|
|
|
if (context is null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException(nameof(context)); |
|
|
|
} |
|
|
|
|
|
|
|
var scopes = await _scopeRepository.GetListAsync(); |
|
|
|
context.Scopes.UnionWith(scopes.Select(x => x.Name)); |
|
|
|
} |
|
|
|
} |