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

Question: Where to add listeners for events? #65

Open
happenpappen opened this issue May 3, 2023 · 4 comments
Open

Question: Where to add listeners for events? #65

happenpappen opened this issue May 3, 2023 · 4 comments

Comments

@happenpappen
Copy link

Hi,

the readme says under "Authentication events", that you should "add listeners on Slides\Saml2\SignedIn and Slides\Saml2\SignedOut events.", but it does not tell where (in which file) one should do that - is there any example showing exactly what to do?

kind regards,

Christoph

@chris5tu88s
Copy link

chris5tu88s commented May 4, 2023

Run this command:
php artisan make:listener SsoLoginListener --event=\Slides\Saml2\Events\SignedIn

This will create a new Listener class under the app\Listeners dir.

@mohamed-salah-tawfik
Copy link

Auth::login here doesn't work!

@chris5tu88s
Copy link

@mohamed-salah-tawfik The same thing happened to me. I could login the user in the listener but once they were redirected to the app, they were not logged in.

Check you have routesMiddleware set in your config/saml2.php file. Mine is set to 'web'. You need to make sure the middleware group is using StartSession in Kernel.php (the 'web' middleware group will do this by default).

@imhaggarwal
Copy link

@mohamed-salah-tawfik The same thing happened to me. I could login the user in the listener but once they were redirected to the app, they were not logged in.

Check you have routesMiddleware set in your config/saml2.php file. Mine is set to 'web'. You need to make sure the middleware group is using StartSession in Kernel.php (the 'web' middleware group will do this by default).

Thank you so much. This really helped a lot.
To anyone who experiences 419 error, you need to edit your VerifyCsrfToken Middleware.

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

4 participants