Schema Based Field Level Authorization with Spring Framework #2674
              
                Unanswered
              
          
                  
                    
                      git-addict
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 1 comment
-
| You are not telling us much about your tech-stack. Are you using a framework (like DGS Framework, Spring for GraphQL, or graphql-java-tools)? The best way to achieve this would probably be to inject your Authentication context into the GraphQLContext and access it via a wrapped datafetcher in your SchemaDirectiveWiring: You would edit the wrapping datafetcher:        DataFetcher dataFetcher = DataFetcherFactories.wrapDataFetcher(originalFetcher, ((dataFetchingEnvironment, value) -> {
            // Do Auth, throw error or return Try<YourType>
            return value;
        }));and return  | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Everyone,
Really excited to see a community here around graphQL. I am newbie and wondering how we can achieve attribute level authorization using graphql Java just like elaborated in this example here (https://blog.grandstack.io/authorization-in-graphql-using-custom-schema-directives-eafa6f5b4658) . It is just that I am not able to find any Java/Spring based example. Will a similar approach work for Java graphQL spring based project.
Beta Was this translation helpful? Give feedback.
All reactions