first commit
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
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!");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user