コード例 #1
0
 public LayoutController(IUserNavigationManager userNavigationManager, ILocalizationManager localizationManager, ISecurityAppService securityAppService, IMultiTenancyConfig multiTenancyConfig)
 {
     _userNavigationManager = userNavigationManager;
     _localizationManager = localizationManager;
     _securityAppService = securityAppService;
     _multiTenancyConfig = multiTenancyConfig;
 }
コード例 #2
0
 public CustomProfileService(
     ILogger <CustomProfileService> logger,
     ISecurityAppService securityAppService)
 {
     Logger = logger;
     _securityAppService = securityAppService;
 }
コード例 #3
0
        /// <summary>
        /// When overridden, provides an entry point for custom authorization checks.
        /// </summary>
        /// <param name="httpContext">The HTTP context, which encapsulates all HTTP-specific information about an individual HTTP request.</param>
        /// <returns>
        /// true if the user is authorized; otherwise, false.
        /// </returns>
        /// <exception cref="T:System.ArgumentNullException">The <paramref name="httpContext"/> parameter is null.</exception>
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            ISecurityAppService securityservice = ObjectFactory.GetInstance <ISecurityAppService>();
            IUserAppService     userAppService  = ObjectFactory.GetInstance <IUserAppService>();
            var user = userAppService.GetUserByUserName(httpContext.User.Identity.Name);

            if (!string.IsNullOrEmpty(Roles))
            {
                foreach (string role in this.Roles.Split(','))
                {
                    foreach (var roleViewModel in user.Roles)
                    {
                        if (role.Trim().ToLower().Equals(roleViewModel.Title.Trim().ToLower()))
                        {
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
コード例 #4
0
 public SecurityController(ISecurityAppService securityAppService)
 {
     _securityAppService = securityAppService;
 }
コード例 #5
0
ファイル: PolicyController.cs プロジェクト: Lumbar/RoleWebApi
 public PolicyController(ISecurityAppService securityAppService,
                         IPolicyAppService policyAppService)
 {
     _securityAppService = securityAppService;
     _policyAppService   = policyAppService;
 }
コード例 #6
0
 public CustomResourceOwnerPasswordValidator(ISecurityAppService authenticationAppService)
 {
     _securityAppService = authenticationAppService;
 }