forked from ddrilling/AsbCloudServer
20 lines
482 B
C#
20 lines
482 B
C#
using AsbCloudDb.Model;
|
|
using System.Security.Claims;
|
|
|
|
namespace AsbCloudWebApi
|
|
{
|
|
public static class Extensions
|
|
{
|
|
public static int? GetCustomerId(this ClaimsPrincipal user)
|
|
{
|
|
var claimIdCustomer = user.FindFirst(nameof(User.IdCustomer));
|
|
if (claimIdCustomer is null)
|
|
return null;
|
|
|
|
return int.TryParse(claimIdCustomer.Value, out int uid)
|
|
? uid
|
|
: null;
|
|
}
|
|
}
|
|
}
|