Coder Social home page Coder Social logo

Comments (9)

oliemansm avatar oliemansm commented on June 30, 2024 1

from graphql-spring-boot.

oliemansm avatar oliemansm commented on June 30, 2024

I wouldn't configure Spring Security on servlets like that, but annotate the actual service methods that are being called by the GraphQL resolvers. That way you can authorize differently per query or mutation level, and filter response objects based on the principal.

from graphql-spring-boot.

rolandkozma avatar rolandkozma commented on June 30, 2024

Thanks oliemansm! Indeed, it would be great to be able to do it that way, but I'm struggling with the configurations. I asked for help here:
https://stackoverflow.com/questions/45959234/authentication-in-spring-boot-using-graphql
Could you help me out answering my question on stackoverflow?

from graphql-spring-boot.

rolandkozma avatar rolandkozma commented on June 30, 2024

Can you give me please a spring/spring-boot solution to have some graphql operation that can be anonymously accessed, while others are secured?
If I secure the "/graphgl" endpoint with .antMatchers("/graphql").authenticated(), I can use @PreAuthorize annotations on service methods to restrict existing roles, but anonymous users are not allowed access at all.

from graphql-spring-boot.

rolandkozma avatar rolandkozma commented on June 30, 2024

Thank you very much for your suggestions! I'm going to try to implement them right away. I'll let you know about my progress.

from graphql-spring-boot.

rolandkozma avatar rolandkozma commented on June 30, 2024

I'm happy to let you know that we solved the issue. The filter was not even needed. Spring is able to restore the session from redis if it is persisted as Spring expects. I answered my question on stackoverflow. Thanks a lot for your suggestions!
Is it a best practice to have the login/logout operations as mutations?

from graphql-spring-boot.

oliemansm avatar oliemansm commented on June 30, 2024

from graphql-spring-boot.

smastika avatar smastika commented on June 30, 2024

@rolandkozma @oliemansm Hi guys interesting thread, any possibility to show an example using JWT and some service? I saw the answer in the Stackoverflow question but would appreciate some more details, if you could share some code, it would be awesome.

KR/ Smas

from graphql-spring-boot.

roland-kozma avatar roland-kozma commented on June 30, 2024

Hi @smastika. I don't have anything with JWT and now I'm working on a different project.
But I still have the code of that project and if you want I can look into it and give you more details.
We can have a short chat on skype: roland.kozma or on email: [email protected]

Regards,
Roland

from graphql-spring-boot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.