Exemplo n.º 1
0
        public async Task <ClaimResult> CreateClaimAsync(string key, string value, IdentityClaimTypes type)
        {
            switch (type)
            {
            case IdentityClaimTypes.UserClaim:
                return(await claimsManager.CreateUserClaimAsync(new T()
                {
                    Key = key,
                    Value = value,
                    Type = IdentityClaimTypes.UserClaim.ToString()
                }));

            case IdentityClaimTypes.RoleClaim:
                return(await claimsManager.CreateRoleClaimAsync(new T()
                {
                    Key = key,
                    Value = value,
                    Type = IdentityClaimTypes.RoleClaim.ToString()
                }));

            default:
                return(new ClaimResult()
                {
                    Succeed = false
                });
            }
        }