Quantcast
Channel: Grafikart | Derniers Sujets du forum
Viewing all articles
Browse latest Browse all 1542

Remember me cookie

$
0
0

Bonjour,

Voila je rencontre un petit problème avec mon code. J'ai implementé la fonction remember me qui n'est que quelques lignes dans le security.yml et cela fonctionne qu'en local.
Quand je teste sur le serveur live, le rememberme cookie est bien créé.
Mais quand je ferme et ouvre à nouveau mon navigateur, je ne suis pas auto logué alors qu'en local cela fonctionne très bien.

security:

    encoders:
            FOS\UserBundle\Model\UserInterface: sha512

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

    # http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
    providers:
        fos_userbundle:
            id: fos_user.user_provider.username_email
        in_memory:
            memory: ~
        token_provider:
            mongodb: {class: Ribambel\UserBundle\Document\User, property: id}

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

        main:
            pattern: ^/
            form_login:
                provider: fos_userbundle
                csrf_provider: security.csrf.token_manager # Use form.csrf_provider instead for Symfony <2.4
                failure_path: register # since the login form is on the same page with the register form
                success_handler: ribambel_user.authentication_handler
                failure_handler: ribambel_user.authentication_handler
            logout:
                path: /logout
                success_handler: ribambel_user.authentication_handler
            remember_me:
                secret: '%secret%'
                lifetime: 31536000  # 365 days in seconds
                path: /
                domain: ~
            anonymous:    true
            guard:
                authenticators:
                    - ribambel_user.token_authenticator


    access_control:
        - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/moncompte, role: ROLE_USER }
        - { path: ^/admin/, role: ROLE_ADMIN }
#        - { path: ^/api/v1/users, role: IS_AUTHENTICATED_ANONYMOUSLY }
#        - { path: ^/api/v1/brands, role: IS_AUTHENTICATED_ANONYMOUSLY }
#        - { path: ^/api/v1/likes/avg, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/v1, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/(panier)(?!/impressions), role: ROLE_USER }

Quel peut être le problème car tout semble ok dans le code? A moins que quelque chose m'échappe.


Viewing all articles
Browse latest Browse all 1542

Trending Articles