Exemple #1
0
 public AuthorizeDirective(
     string?policy = null,
     IReadOnlyList <string>?roles = null,
     ApplyPolicy apply            = ApplyPolicy.BeforeResolver)
 {
     Policy = policy;
     Roles  = roles;
     Apply  = apply;
 }
Exemple #2
0
 public AuthorizeDirective(
     string?policy = null,
     IReadOnlyList <string>?roles = null,
     ApplyPolicy executeResolver  = ApplyPolicy.AfterResolver)
 {
     Policy = policy;
     Roles  = roles;
     Apply  = executeResolver;
 }
        public static IObjectFieldDescriptor Authorize(
            this IObjectFieldDescriptor descriptor,
            ApplyPolicy apply = ApplyPolicy.BeforeResolver)
        {
            if (descriptor == null)
            {
                throw new ArgumentNullException(nameof(descriptor));
            }

            return(descriptor.Directive(new AuthorizeDirective()));
        }
Exemple #4
0
    public static IObjectTypeDescriptor <T> Authorize <T>(
        this IObjectTypeDescriptor <T> descriptor,
        ApplyPolicy apply = ApplyPolicy.BeforeResolver)
    {
        if (descriptor == null)
        {
            throw new ArgumentNullException(nameof(descriptor));
        }

        return(descriptor.Directive(new AuthorizeDirective(apply: apply)));
    }
Exemple #5
0
 public AuthorizeDirective(
     IReadOnlyList <string> roles,
     ApplyPolicy apply = ApplyPolicy.BeforeResolver)
     : this(null, roles, apply)
 {
 }
Exemple #6
0
 public AuthorizeDirective(
     IReadOnlyList <string> roles,
     ApplyPolicy executeResolver = ApplyPolicy.AfterResolver)
     : this(null, roles, executeResolver)
 {
 }