using OpenIddict.Abstractions; namespace MemberCenter.Api.Extensions; public static class ClaimsExtensions { public static IEnumerable GetScopesOrDefault(this string? scope) { if (string.IsNullOrWhiteSpace(scope)) { return new[] { OpenIddictConstants.Scopes.OpenId, OpenIddictConstants.Scopes.Email, OpenIddictConstants.Scopes.Profile }; } return scope.Split(' ', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); } public static IEnumerable GetDestinations(System.Security.Claims.Claim claim) { return claim.Type switch { OpenIddictConstants.Claims.Name or OpenIddictConstants.Claims.Email => new[] { OpenIddictConstants.Destinations.AccessToken, OpenIddictConstants.Destinations.IdentityToken }, _ => new[] { OpenIddictConstants.Destinations.AccessToken } }; } }