Esempio n. 1
0
        /// <summary>
        /// Returns whether the user is authorized based on their claims.
        /// </summary>
        /// <param name="identity">User claims identity.</param>
        /// <returns>true if the user is authorized; otherwise, false.</returns>
        public bool IsAuthorized(ClaimsIdentity identity)
        {
            var security = new SecurityAttribute
            {
                AllowAny                   = AllowAny,
                AllowInProduction          = AllowInProduction,
                AllowWindowsAuthentication = AllowWindowsAuthentication,
                Contracts                  = Contracts,
                OrganisationCodes          = OrganisationCodes,
                Roles = Roles,
                Users = Users
            };


            return(security.IsAuthorized(identity));
        }
Esempio n. 2
0
 /// <summary>
 /// Returns whether the user is authorized based on their claims.
 /// </summary>
 /// <param name="identity">User claims identity.</param>
 /// <param name="isPreprodOrProd">if set to <c>true</c> then environment is preprod or prod.</param>
 /// <returns>
 /// true if the user is authorized; otherwise, false.
 /// </returns>
 internal bool IsAuthorized(ClaimSubset identity, bool isPreprodOrProd)
 {
     return(SecurityAttribute.IsAuthorized(isPreprodOrProd, AllowInProduction, AllowWindowsAuthentication, AllowAny, Users, Roles, OrganisationCodes, Contracts, identity));
 }