Skip to content

Looping on login action with entity provider... #59

@matthieuPouille

Description

@matthieuPouille

Hi everyone.

I'm actualy working on a project using your bundle with Symfony 2.4. I configured my project as shown in exemple.md. Sadly, it works only with users defined in security.yml (in memory provider).

If i use an entity provider (users defined in database), or if the user doesn't exist, it creates an inifnite loop :
login -> cas login -> login_check -> login -> cas login -> ...

Am I doing something wrong ?

config.yml

# Sso Bundle
be_simple_sso_auth: 
    admin_sso:
        protocol:
            id: cas
            version: 2
        server:
            id: cas
            login_url: https://auth.XXX.fr/cas/login
            logout_url: https://auth.XXXfr/cas/logout
            validation_url: https://auth.XXX.fr/cas/serviceValidate

security.yml

encoders:
    MyApp\G2CBundle\Entity\HarpUtilisateur:
        algorithm:        sha1
        encode_as_base64: false
        iterations:       1

role_hierarchy:
    ROLE_ADMIN:       ROLE_USER
    ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]

    providers:
        in_memory:
            memory:
                users:
                    login-test : { password: pwd-test , roles: ROLE_USER }
        in_database:
            entity: { class: MyAppG2CBundle:HarpUtilisateur, property: uid }
firewalls:
    my_firewall:
        pattern: ^/g2c/.*$
        provider : in_database # this cause an infinite loop, it works using in_memory
        trusted_sso:
            manager:             admin_sso
            login_path:          /g2c/login
            check_path:          /g2c/login_check
            default_target_path: /g2c/hello/toto  
            login_action:         false
            logout_action:       false
            create_users:        false
        logout:
            path:   /g2c/logout
            target: /

PS: I put some var_dump() in SsoAuthenticationProvider, the SsoToken is built properly, the user is provided (a MyApp\G2CBundle\Entity\HarpUtilisateur object).

Thank you in advance for any help you can provide me !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions