Exemple #1
0
        public void AddClaim(IdentityClaim claim)
        {
            var ucEC = UserClaim.NewUserClaimEC();

            ucEC.UserId     = claim.UserId;
            ucEC.ClaimValue = claim.ClaimValue;
            ucEC.ClaimType  = claim.ClaimType;
            ucEC            = ucEC.Save();
        }
Exemple #2
0
        /// <summary>
        ///     Removes a claim from a user
        /// </summary>
        /// <param name="user">The user</param>
        /// <param name="claim">Claim to remove</param>
        /// <returns>The task representing the asynchronous operation.</returns>
        public Task RemoveClaimAsync(TUser user, Claim claim)
        {
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }
            if (claim == null)
            {
                throw new ArgumentNullException("claim");
            }
            var userClaim = new IdentityClaim(user.Id, claim);

            userClaimsTable.RemoveClaim(userClaim);
            return(Task.CompletedTask);
        }
Exemple #3
0
 public void RemoveClaim(IdentityClaim claim)
 {
     UserClaim.DeleteUserClaimEC(claim.UserId, claim.ClaimType, claim.ClaimValue);
 }