Allow the addition of SessionIndexes to a LogoutRequest
This commit is contained in:
@@ -253,6 +253,7 @@ class Base(Entity):
|
|||||||
args["provider_name"] = self._my_name()
|
args["provider_name"] = self._my_name()
|
||||||
|
|
||||||
# Allow argument values either as class instances or as dictionaries
|
# Allow argument values either as class instances or as dictionaries
|
||||||
|
# all of these have cardinality 0..1
|
||||||
_msg = AuthnRequest()
|
_msg = AuthnRequest()
|
||||||
for param in ["scoping", "requested_authn_context", "conditions",
|
for param in ["scoping", "requested_authn_context", "conditions",
|
||||||
"subject", "scoping"]:
|
"subject", "scoping"]:
|
||||||
|
@@ -35,7 +35,7 @@ from saml2.s_utils import rndstr
|
|||||||
from saml2.s_utils import success_status_factory
|
from saml2.s_utils import success_status_factory
|
||||||
from saml2.s_utils import decode_base64_and_inflate
|
from saml2.s_utils import decode_base64_and_inflate
|
||||||
from saml2.s_utils import UnsupportedBinding
|
from saml2.s_utils import UnsupportedBinding
|
||||||
from saml2.samlp import AuthnRequest
|
from saml2.samlp import AuthnRequest, SessionIndex
|
||||||
from saml2.samlp import AuthzDecisionQuery
|
from saml2.samlp import AuthzDecisionQuery
|
||||||
from saml2.samlp import AuthnQuery
|
from saml2.samlp import AuthnQuery
|
||||||
from saml2.samlp import AssertionIDRequest
|
from saml2.samlp import AssertionIDRequest
|
||||||
@@ -673,7 +673,8 @@ class Entity(HTTPBase):
|
|||||||
def create_logout_request(self, destination, issuer_entity_id,
|
def create_logout_request(self, destination, issuer_entity_id,
|
||||||
subject_id=None, name_id=None,
|
subject_id=None, name_id=None,
|
||||||
reason=None, expire=None, message_id=0,
|
reason=None, expire=None, message_id=0,
|
||||||
consent=None, extensions=None, sign=False):
|
consent=None, extensions=None, sign=False,
|
||||||
|
session_indexes=None):
|
||||||
""" Constructs a LogoutRequest
|
""" Constructs a LogoutRequest
|
||||||
|
|
||||||
:param destination: Destination of the request
|
:param destination: Destination of the request
|
||||||
@@ -689,6 +690,7 @@ class Entity(HTTPBase):
|
|||||||
:param consent: Whether the principal have given her consent
|
:param consent: Whether the principal have given her consent
|
||||||
:param extensions: Possible extensions
|
:param extensions: Possible extensions
|
||||||
:param sign: Whether the query should be signed or not.
|
:param sign: Whether the query should be signed or not.
|
||||||
|
:param session_indexes: SessionIndex instances or just values
|
||||||
:return: A LogoutRequest instance
|
:return: A LogoutRequest instance
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -703,10 +705,20 @@ class Entity(HTTPBase):
|
|||||||
if not name_id:
|
if not name_id:
|
||||||
raise SAMLError("Missing subject identification")
|
raise SAMLError("Missing subject identification")
|
||||||
|
|
||||||
|
args = {}
|
||||||
|
if session_indexes:
|
||||||
|
sis = []
|
||||||
|
for si in session_indexes:
|
||||||
|
if isinstance(si, SessionIndex):
|
||||||
|
sis.append(si)
|
||||||
|
else:
|
||||||
|
sis.append(SessionIndex(text=si))
|
||||||
|
args["session_index"] = sis
|
||||||
|
|
||||||
return self._message(LogoutRequest, destination, message_id,
|
return self._message(LogoutRequest, destination, message_id,
|
||||||
consent, extensions, sign, name_id=name_id,
|
consent, extensions, sign, name_id=name_id,
|
||||||
reason=reason, not_on_or_after=expire,
|
reason=reason, not_on_or_after=expire,
|
||||||
issuer=self._issuer())
|
issuer=self._issuer(), **args)
|
||||||
|
|
||||||
def create_logout_response(self, request, bindings=None, status=None,
|
def create_logout_response(self, request, bindings=None, status=None,
|
||||||
sign=False, issuer=None):
|
sign=False, issuer=None):
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from saml2.s_utils import rndstr
|
|
||||||
from saml2.metadata import entity_descriptor, metadata_tostring_fix
|
from saml2.metadata import entity_descriptor, metadata_tostring_fix
|
||||||
from saml2.metadata import entities_descriptor
|
from saml2.metadata import entities_descriptor
|
||||||
from saml2.metadata import sign_entity_descriptor
|
from saml2.metadata import sign_entity_descriptor
|
||||||
|
Reference in New Issue
Block a user