コード例 #1
0
        public async Task <ClaimsPrincipal> TransformAsync(ClaimsPrincipal principal)
        {
            string roleName;

            try
            {
                roleName = _moneyUserManager.GetUserRole(principal.Identity.Name);
            }
            catch
            {
                return(principal);
            }

            IEnumerable <Claim> claims = await _permissionManager.GetRolePermissionsAsClaimsAsync(roleName);

            principal.AddIdentity(new ClaimsIdentity(claims));

            return(principal);
        }