- Created MemberCenter.Installer project with references to Infrastructure, Application, and Domain projects. - Added Program.cs with a basic console output. - Generated MemberCenterDbContextModelSnapshot for database schema representation.
32 lines
1012 B
C#
32 lines
1012 B
C#
using OpenIddict.Abstractions;
|
|
|
|
namespace MemberCenter.Api.Extensions;
|
|
|
|
public static class ClaimsExtensions
|
|
{
|
|
public static IEnumerable<string> 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<string> 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 }
|
|
};
|
|
}
|
|
}
|