GithubHelp home page GithubHelp logo

Comments (7)

VincentClair avatar VincentClair commented on May 29, 2024 1

I don't know if its related, but i have a problem to get user in resolve property.
I'm fully authenticated for rest routes, but when I attempted to access graphql, user is set anonymous.
It's probably a misconfiguration at symfony level, but maybe you have a suggestion?
Thanks

If I try setting access: "@=isAuthenticated()", i got "Access denied to this field." message.

from graphqlbundle.

VincentClair avatar VincentClair commented on May 29, 2024 1

Here the solution for me: http://dev.apollodata.com/angular2/auth.html#Cookie

from graphqlbundle.

mcg-web avatar mcg-web commented on May 29, 2024

Hi @lube,
can you give an example to explain the difference between what you asking for and the current access feature please?

from graphqlbundle.

ooflorent avatar ooflorent commented on May 29, 2024

@lube have you tried using the Symfony security layer?

  1. Add a firewall targeting your endpoint

    firewalls:
      graphql:
        pattern: ^/graphql
        stateless: true
        <YOUR_PROVIDER>: <CONFIG>
  2. Set an access_control

    access_control:
      - { path: ^/graphql, roles: IS_AUTHENTICATED_FULLY }

from graphqlbundle.

VincentClair avatar VincentClair commented on May 29, 2024

I have only set this in routing:

overblog_graphql_endpoint:
    path: /graphql
    defaults:
        _controller: OverblogGraphQLBundle:Graph:endpoint
        _format: "json"

and in security:

    access_control:
        - { path: ^/graphql,               roles: IS_AUTHENTICATED_ANONYMOUSLY, methods: [POST] }

and finally the firewalls:

    firewalls:
        # disables authentication for assets and the profiler, adapt it according to your needs
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false

        login:
            pattern: ^/auth/form$
            anonymous: true

        token:
            pattern: ^/token$
            security: false

        secured:
            pattern: ^/
            guard:
                authenticators:
                    - acme_superadmin.token_authenticator
                    - acme_app.token_authenticator
                entry_point: acme_app.token_authenticator
            saml:
                username_attribute: '%sso_saml_username_attribute%'
                check_path: /saml/acs
                login_path: /saml/login
                always_use_default_target_path: true
                user_factory: acme_user.user_manipulator
            form_login_ldap:
                login_path: /#/sign-in
                check_path: /auth/login
                service: ldap
                dn_string: '%ldap_binddn%'
                require_previous_session: false
                always_use_default_target_path: true
            form_login:
                login_path: /#/sign-in
                check_path: /auth/login
                require_previous_session: false
                always_use_default_target_path: true
            logout:
                path: /saml/logout
            anonymous: ~
            remember_me:
                secret:   '%secret%'
                lifetime: '%remember_me_lifetime%'

from graphqlbundle.

VincentClair avatar VincentClair commented on May 29, 2024

Ok, it seems to be a problem with Apollo Client, not Symfony or this bundle. I will put the solution here as soon as i found to pass cookies. Something related to https://github.com/github/fetch/blob/7f71c9bdccedaf65cf91b450b74065f8bed26d36/README.md#sending-cookies

from graphqlbundle.

mcg-web avatar mcg-web commented on May 29, 2024

closing this feel free to reopen if needed...

from graphqlbundle.

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.