Browse Source
Set `claim`'s `destinations` in `AuthorizeController`.
pull/18476/head
maliming
2 years ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
2 changed files with
4 additions and
8 deletions
-
modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Claims/AbpDefaultOpenIddictClaimsPrincipalHandler.cs
-
modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/AuthorizeController.cs
|
|
|
@ -26,12 +26,6 @@ public class AbpDefaultOpenIddictClaimsPrincipalHandler : IAbpOpenIddictClaimsPr |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
if (claim.Type == AbpClaimTypes.RememberMe) |
|
|
|
{ |
|
|
|
claim.SetDestinations(OpenIddictConstants.Destinations.AccessToken); |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
switch (claim.Type) |
|
|
|
{ |
|
|
|
case OpenIddictConstants.Claims.PreferredUsername: |
|
|
|
|
|
|
|
@ -127,7 +127,8 @@ public class AuthorizeController : AbpOpenIdDictControllerBase |
|
|
|
|
|
|
|
if (result.Properties != null && result.Properties.IsPersistent) |
|
|
|
{ |
|
|
|
principal.AddClaim(AbpClaimTypes.RememberMe, true.ToString()); |
|
|
|
var claim = new Claim(AbpClaimTypes.RememberMe, true.ToString()).SetDestinations(OpenIddictConstants.Destinations.AccessToken); |
|
|
|
principal.Identities.FirstOrDefault()?.AddClaim(claim); |
|
|
|
} |
|
|
|
|
|
|
|
// Note: in this sample, the granted scopes match the requested scope
|
|
|
|
@ -226,7 +227,8 @@ public class AuthorizeController : AbpOpenIdDictControllerBase |
|
|
|
var result = await HttpContext.AuthenticateAsync(IdentityConstants.ApplicationScheme); |
|
|
|
if (result.Succeeded && result.Properties != null && result.Properties.IsPersistent) |
|
|
|
{ |
|
|
|
principal.AddClaim(AbpClaimTypes.RememberMe, true.ToString()); |
|
|
|
var claim = new Claim(AbpClaimTypes.RememberMe, true.ToString()).SetDestinations(OpenIddictConstants.Destinations.AccessToken); |
|
|
|
principal.Identities.FirstOrDefault()?.AddClaim(claim); |
|
|
|
} |
|
|
|
|
|
|
|
// Note: in this sample, the granted scopes match the requested scope
|
|
|
|
|