Esempio n. 1
0
        public async Task CheckAsync(MethodInvocationAuthorizationContext context)
        {
            if (AllowAnonymous(context))
            {
                return;
            }

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

            if (authorizationPolicy == null)
            {
                return;
            }

            await _rocketAuthorizationService.CheckAsync(authorizationPolicy);
        }
Esempio n. 2
0
 protected virtual bool AllowAnonymous(MethodInvocationAuthorizationContext context)
 {
     return(context.Method.GetCustomAttributes(true).OfType <IAllowAnonymous> ().Any());
 }
 public Task CheckAsync(MethodInvocationAuthorizationContext context)
 {
     return(Task.CompletedTask);
 }