Example #1
0
        public async Task CheckAsync(MethodInvocationAuthorizationContext context)
        {
            if (AllowAnonymous(context))
            {
                return;
            }

            var authorizationPolicy = await AuthorizationPolicy.CombineAsync(
                _PlusAuthorizationPolicyProvider,
                GetAuthorizationDataAttributes(context.Method)
                );

            if (authorizationPolicy == null)
            {
                return;
            }

            await _PlusAuthorizationService.CheckAsync(authorizationPolicy);
        }
 public Task CheckAsync(MethodInvocationAuthorizationContext context)
 {
     return(Task.CompletedTask);
 }
Example #3
0
 protected virtual bool AllowAnonymous(MethodInvocationAuthorizationContext context)
 {
     return(context.Method.GetCustomAttributes(true).OfType <IAllowAnonymous>().Any());
 }