Files
2025-02-26 23:42:19 +01:00

42 lines
1.1 KiB
C#

using System.Diagnostics;
namespace OpenWarehouse.auth.api.Common.CustomIdentifyManager;
public static class AccountClaimsClass
{
private static readonly Dictionary<AccountClaims, string> AccountTypeDict = new()
{
{ AccountClaims.ServiceAdress, "Service_Adress" },
{ AccountClaims.ServiceName, "ServiceName" },
{ AccountClaims.IfUserCanChangeRole, "PrivilageFunct" }
};
public static Claim GetClaim(this AccountClaims claims, string val)
{
var isSuccess = AccountTypeDict.TryGetValue(claims,out var res);
if (isSuccess && res != null)
{
return new Claim(res, val);
}
else
{
throw new NotImplementedException("Claim not implemented!");
}
}
public static string GetName(AccountClaims claims)
{
var isSuccess = AccountTypeDict.TryGetValue(claims,out var res);
if (isSuccess && res != null)
{
return res;
}
else
{
throw new NotImplementedException("Claim not implemented!");
}
}
}