public HasClaim ( string type, string value ) : bool | ||
type | string | the type of the claim to match. |
value | string | the value of the claim to match. |
return | bool |
public virtual bool HasClaim(string type, string value)
{
if (type == null)
{
throw new ArgumentNullException(nameof(type));
}
if (value == null)
{
throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
for (int i = 0; i < _identities.Count; i++)
{
if (_identities[i] != null)
{
if (_identities[i].HasClaim(type, value))
{
return true;
}
}
}
return false;
}
public static bool HasClaimCanEditProducts(ClaimsPrincipal user) { if (user.HasClaim("CanEditProducts", "true")) { return true; }; return false; }