mirror of https://github.com/abpframework/abp.git
committed by
GitHub
8 changed files with 99 additions and 14 deletions
@ -0,0 +1,21 @@ |
|||
using System; |
|||
using System.Linq; |
|||
using System.Security.Claims; |
|||
|
|||
namespace Volo.Abp.Identity |
|||
{ |
|||
public static class ClaimsIdentityExtensions |
|||
{ |
|||
public static ClaimsIdentity AddIfNotContains(this ClaimsIdentity claimsIdentity, Claim claim) |
|||
{ |
|||
if (!claimsIdentity.Claims.Any(existClaim => |
|||
existClaim != null && |
|||
string.Equals(existClaim.Type, claim.Type, StringComparison.OrdinalIgnoreCase))) |
|||
{ |
|||
claimsIdentity.AddClaim(claim); |
|||
} |
|||
|
|||
return claimsIdentity; |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue