Move projects to src; add Neutrino secret
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace RecNet.Application.Common.Security;
|
||||
|
||||
public static class ClaimsPrincipalExtensions
|
||||
{
|
||||
public static Guid GetProfileId(this ClaimsPrincipal user)
|
||||
{
|
||||
var value =
|
||||
user.FindFirst("sub")?.Value ??
|
||||
user.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||
|
||||
if (!Guid.TryParse(value, out var profileId))
|
||||
throw new UnauthorizedAccessException(
|
||||
"Account id claim is missing or invalid.");
|
||||
|
||||
return profileId;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user