Exemplo n.º 1
0
 public AppUserAuthorizationService(IAuthTokenFactory tokenFactory, UserManager <AppUser> userManager,
                                    WavesDbContext context, IRolePolicyService policyService, SignInManager <AppUser> signInManager) : base(tokenFactory)
 {
     _context       = context;
     _userManager   = userManager;
     _policyService = policyService;
     _signInManager = signInManager;
 }
Exemplo n.º 2
0
        public static void AddRolePolicies(this AuthorizationOptions opt, IRolePolicyService service,
                                           Action <AuthorizationPolicyBuilder, AppRolePolicyModel> configureFunc = null)
        {
            if (service == null)
            {
                throw new ArgumentNullException(nameof(service));
            }

            if (configureFunc == null)
            {
                configureFunc = DefaultConfigurePolicyFunc;
            }

            foreach (AppRolePolicyModel model in service.GetRolePolicies())
            {
                opt.AddPolicy(model.PolicyName, policy => configureFunc(policy, model));
            }
        }