Skip to content

[Security] Add docs about success handlers for login and logout #802

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

Closed
Seldaek opened this issue Oct 25, 2011 · 5 comments
Closed

[Security] Add docs about success handlers for login and logout #802

Seldaek opened this issue Oct 25, 2011 · 5 comments
Labels
actionable Clear and specific issues ready for anyone to take them. Security

Comments

@Seldaek
Copy link
Member

Seldaek commented Oct 25, 2011

Johannes says it's not recommended to use security.interactive_login for redirections and such because they should not apply to all firewalls, and not all auth types. In any case, if you ignore that and do it anyway, there is no event for logout, so you get stuck eventually if you try to cover that as well.

@weaverryan
Copy link
Member

+1 - a quick cookbook article on using both the success_handler under something like form login as well as for logout would be cool. For example, maybe on login you want to redirect to an account page if that user has some property. An on logout, maybe you do something (anyone think of a nice use-case here?) before redirecting, maybe to some page based on custom logic.

@Seldaek
Copy link
Member Author

Seldaek commented Apr 29, 2012

The main use case I've had for logout is to reply with json instead of a redirect on ajax logout.

@Sgoettschkes
Copy link
Contributor

I would write this and I'm trying to understand the handlers right now. One thing I don't understand is the constructor signature of the DefaultAuthenticationSuccessHandler. It has an $options parameter, but as it is used with the DI-Container, I don't see any way to pass any options. Does anybody know how this is supposed to work?

@Sgoettschkes
Copy link
Contributor

Actually, nevermind. I could overwrite the defaults passed to the service in my code. Makes sense to me. I'll see if I find the time tonight to write something!

As for a use case, I thought about saving the last successfull login and logout in the user object as an example. It's not what many people will end up doing, but it shows the usage of both handlers ans is short enough to not confuse people. If you got another idea please let me know!

@wouterj
Copy link
Member

wouterj commented Apr 25, 2015

Closing in favor of #4258, which contains a lot more details on how to fix it

@wouterj wouterj closed this as completed Apr 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
actionable Clear and specific issues ready for anyone to take them. Security
Projects
None yet
Development

No branches or pull requests

4 participants