Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logout problem #42

Open
bOnepain opened this issue Aug 12, 2013 · 4 comments
Open

Logout problem #42

bOnepain opened this issue Aug 12, 2013 · 4 comments

Comments

@bOnepain
Copy link

Hello,

I'm trying to use BeSimpleSsoAuthBundle along with FOSUserBundle and FR3DLdapBundle. It works almost fine but I got a problem when I log out.
Once logged out, I try to log in again but I get the famous "The controller must return a response (null given). Did you forget to add a return statement somewhere in your controller?" on login_check.
Actually, if I clear the cache and try to log in, I don't have any problem.
But if I try to log in after having logged out, without clearing the cache in the meantime, I come out with the exception above.

Am I at the right place to ask this question ? Anyway thanks forward for your help

@ethanhann
Copy link
Contributor

@jekif Can you share the contents of your security.yml and routing.yml files?

@bOnepain
Copy link
Author

No problem. Here they are. I have checked them several times but I didn't notice anything wrong. Maybe something I don't know...

# Routing.yml 
logout:
    pattern: /logout
my_cmt:
    resource: "@MyBundle/Controller/"
    type:     annotation
    prefix:   /
fos_user_profile:
    resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
    prefix: /profile
fos_user_register:
    resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
    prefix: /register
fos_user_resetting:
    resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
    prefix: /resetting
fos_user_change_password:
    resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
    prefix: /profile
# Security.yml
security:
    encoders:
        Me\MyBundle\Entity\User:    plaintext
    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
    providers:
        chain_provider:
            chain:
                providers: [fos_userbundle, fr3d_ldapbundle]
        fr3d_ldapbundle:
            id: fr3d_ldap.security.user.provider
        fos_userbundle:
            id: fos_user.user_manager
    firewalls:
        dev:
            pattern:  ^/(_(profiler|wdt)|css|images|js)/
            security: false
        sso:
            pattern: ^/
            security: true
            trusted_sso:
                manager: my_sso_cas
                login_action: false
                logout_action: false
                login_path: /
                check_path: /login_check
            logout:
                path:   /logout
                target: /

    access_control:
        - { path: ^/, role: IS_AUTHENTICATED_FULLY }
#ControlPanelController
class ControlPanelController extends CMTController
{
    /**
     * @Route("/", name="homepage")
     * @Template()
     */
    public function indexAction()
    {
        return array();
    }

    /**
     * @Route("/login_check")
     */
    public function loginCheckAction()
    {
    }
}

@ethanhann
Copy link
Contributor

@jekif based on the error message, and the code you shared, it looks like you need to return a response in the loginCheckAction method. Is there a reason why you are hooking the routes up to a controller in the first place? To my knowledge, the minimum you need to do is just specify the routes in routing.yml. Something like this:

# app/config/routing.yml
security_login_check:
    pattern: /login_check

security_login:
    pattern: /login

security_logout:
    pattern: /logout

security_login_failure:
    pattern: /login_failure

@bOnepain
Copy link
Author

Well, that's what I did at the beginning. I just hooked the route to a controller so that I could go on with the development of my app, but I'd appreciate understanding what's going on and if it's possible, how to not make use of that hook...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants