-
Notifications
You must be signed in to change notification settings - Fork 144
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
SAML Session cookie not being deleted #262
Comments
Hi @Amertz08 feel free to do your considerations, discuss them here and then a PR. |
So first apparently did not have the middleware in use 😓 . Second it appears the session is not "empty". There is both a session key as well as values in the session cache. I don't have a great grasp of when a SAML session should be "empty". Obviously there is values in there but who should be emptying the session? Is this the IDPs responsibility? and then the SP can turn around and delete it. |
@Amertz08 is there something we can do for this issue, have you found a new bug or is this just a question? |
I am not sure if I have my SP/IDP misconfigured or this is a bug or a misunderstanding. Both django session cookies set in the IDP and SP get deleted but the SAML session cookie does not. The middleware shows it as being nonempty and thus does not delete it. What is supposed to empty the cookie? |
@Amertz08 you have at least two cookies, one from SP and another from IDP Now we have to face of the cookie management that belongs to this project needs some test and debug to see if It's a bug |
So what I am seeing is a Django cookie for both the IDP and SP defined via the |
Hi @Amertz08 |
Let's move "definitely" to this: bad times are coming for cookies, it's useless and too weak to keep using them for our needs |
For your question I suggest you to take a look here: djangosaml2/djangosaml2/tests/__init__.py Line 697 in 57ad2ba
as we can see saml_session cookie will be pruned after a month but you can even deal with this paramenter using Django global settings related to cookie behaviour
|
Hi @Amertz08 I hope your tests have confirmed what you expected it to be |
How do you set the SAML cookie expire time? We're not seeing any adverse affects to how it's working yet but we also don't have multiple SPs deployed. If the cookie expires after a while I guess that is fine. Is it recommended to expire on close? I will try this if this is the recommended implementation. |
Yes, is always recommended to expire on browser close in SSO systems BUT that would be your policy. djangosaml2/djangosaml2/middleware.py Line 72 in 9949c72
the argument "expires" MUST be configurable, in otherwords we MUST check that it takes SESSION_COOKIE_AGE and the django poroject global policy about cookie. that's why we use put a breakpoint() in it and check what's going on, you'll fined the answer. Let me know if there's the need to have a PR for this. thank you, really appreciate your help |
I made some step for you here
so, saml_session cookie always expires, you just have to decide when it MUST do that using django general config. |
@peppelinux thanks for your help on this. |
I think this is related to #146. I am seeing both the Django session cookies for the SP and IDP removed (named via
SESSION_COOKIE_NAME
) from my browser on an SP initiated logout. However the "saml_session" cookie is not being removed. Usingdjangosaml2==1.1.1
The text was updated successfully, but these errors were encountered: