X-Git-Url: http://git.cascardo.info/?a=blobdiff_plain;f=ipsilon%2Fproviders%2Fsaml2%2Fsessions.py;h=c9cfd9c4f7944c4a101348fcaf6fbcb46cdd7781;hb=485baf6ee7a315d1af1086fe5b5da8cff6c4ba37;hp=fb1f646bf4efb5988cf9c32515eafe9d00233da1;hpb=c84eaa4d5f44524ea37f8c2444cbd53520d75a0c;p=cascardo%2Fipsilon.git diff --git a/ipsilon/providers/saml2/sessions.py b/ipsilon/providers/saml2/sessions.py index fb1f646..c9cfd9c 100644 --- a/ipsilon/providers/saml2/sessions.py +++ b/ipsilon/providers/saml2/sessions.py @@ -1,19 +1,4 @@ -# Copyright (C) 2015 Rob Crittenden -# -# see file 'COPYING' for use and warranty information -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# Copyright (C) 2015 Ipsilon project Contributors, for license see COPYING from ipsilon.util.log import Log @@ -140,12 +125,16 @@ class SAMLSessionsContainer(Log): self.sessions_logging_out[session.provider_id] = session - def get_next_logout(self): + def get_next_logout(self, remove=True): """ Get the next session in the logged-in state and move it to the logging_out state. Return the session that is found. + :param remove: for IdP-initiated logout we can't remove the + session otherwise when the request comes back + in the user won't be seen as being logged-on. + Return None if no more sessions in login state. """ try: @@ -153,7 +142,10 @@ class SAMLSessionsContainer(Log): except IndexError: return None - session = self.sessions.pop(provider_id) + if remove: + session = self.sessions.pop(provider_id) + else: + session = self.sessions.itervalues().next() if provider_id in self.sessions_logging_out: self.sessions_logging_out.pop(provider_id)