IdentityPython / djangosaml2

Django SAML2 Service Provider based on pySAML2
Apache License 2.0
258 stars 143 forks source link

[Question] Redirect after logout #390

Open gregorjerse opened 10 months ago

gregorjerse commented 10 months ago

Hi,

I have implemented SSO using djangosaml2. It works perfectly, except for the part where I would like to redirect the user to a specific (dynamic) page after the logout (initiated by the application).

I see the "RelayState" is used to redirect the user to a specific page after login. Is there a similar feature for logging out? As far I could see from the source code, the saml2 library sets the RelayState when doing logout and it is not possible to override it without changing the code.

peppelinux commented 10 months ago

Actually the logout uses the logout url defined in the general settings, is there any kind of relay for the saml2 logout? If not we cannot proceed.

at the same time you can even create a parameter in the user session and have a redirect to the value set to this parameter if present

gregorjerse commented 10 months ago

Yes, it uses the default logout URL (and this works) but I would like the logout URL to be user-specific.

Is the user not already logged out when post to the LogoutView is performed so I can not use user session to perform the redirect?

peppelinux commented 10 months ago

even if the user is not authenticated the session is available (AnonUser)