public AuthorizationManager(
            IUserClaimsProvider claimsProvider, IUserRepository userRepository)
        {
            _userRepository = userRepository;

            if (claimsProvider.WithinWebRequest())
            {
                _executionWithinBackgroundTask = false;
                _claimsUser = new ClaimsUser(claimsProvider.GetUserClaims());
            }
            else
            {
                _executionWithinBackgroundTask = true;
            }
        }
示例#2
0
        public Authorization(
            IUserClaimsProvider claimsProvider, IUserRepository userRepository)
        {
            _userRepository = userRepository;

            if (claimsProvider.WithinWebRequest())
            {
                _executionWithinBackgroundTask = false;

                ClaimsPrincipal claims = claimsProvider.GetUserClaims();

                if (!claims.HasClaims())
                {
                    throw new NoPermissionsException("Web request has no claims");
                }

                _identityUser = new IdentityUser(claims);
            }
            else
            {
                _executionWithinBackgroundTask = true;
            }
        }