diff options
author | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2018-11-19 18:29:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-19 18:29:46 +0200 |
commit | a8c6320095a73c61353b6c10df60cf3688dfedd3 (patch) | |
tree | f57f99af4e7b17aa9a73387e023a66f14f8cb661 | |
parent | c07b12e208d6246b2d6219635884c184f1c11649 (diff) | |
parent | f15ad580d7f8d6cd933963ea69f3fb3896cfa254 (diff) | |
download | pysaml2-a8c6320095a73c61353b6c10df60cf3688dfedd3.tar.gz |
Merge pull request #559 from erakli/replace_mime_paos_literals
Replace string literals with MIME_PAOS
-rwxr-xr-x | example/sp-wsgi/sp.py | 4 | ||||
-rw-r--r-- | src/saml2/ecp.py | 4 | ||||
-rw-r--r-- | src/saml2/s2repoze/plugins/sp.py | 4 |
3 files changed, 7 insertions, 5 deletions
diff --git a/example/sp-wsgi/sp.py b/example/sp-wsgi/sp.py index 9de43abe..90d7838c 100755 --- a/example/sp-wsgi/sp.py +++ b/example/sp-wsgi/sp.py @@ -9,6 +9,8 @@ import os import re import sys import xml.dom.minidom + +from saml2.client_base import MIME_PAOS from saml2.sigver import SignatureError import six @@ -470,7 +472,7 @@ class SSO(object): logger.debug("[_pick_idp] %s", self.environ) if "HTTP_PAOS" in self.environ: if self.environ["HTTP_PAOS"] == PAOS_HEADER_INFO: - if 'application/vnd.paos+xml' in self.environ["HTTP_ACCEPT"]: + if MIME_PAOS in self.environ["HTTP_ACCEPT"]: # Where should I redirect the user to # entityid -> the IdP to use # relay_state -> when back from authentication diff --git a/src/saml2/ecp.py b/src/saml2/ecp.py index 5817cda4..56448e9c 100644 --- a/src/saml2/ecp.py +++ b/src/saml2/ecp.py @@ -6,7 +6,7 @@ Contains classes used in the SAML ECP profile """ import logging -from saml2.client_base import ACTOR +from saml2.client_base import ACTOR, MIME_PAOS from saml2.ecp_client import SERVICE from saml2 import element_to_extension_element @@ -30,7 +30,7 @@ logger = logging.getLogger(__name__) def ecp_capable(headers): - if "application/vnd.paos+xml" in headers["Accept"]: + if MIME_PAOS in headers["Accept"]: if "PAOS" in headers: if 'ver="%s";"%s"' % (paos.NAMESPACE, SERVICE) in headers["PAOS"]: diff --git a/src/saml2/s2repoze/plugins/sp.py b/src/saml2/s2repoze/plugins/sp.py index 897f31f1..14d19c05 100644 --- a/src/saml2/s2repoze/plugins/sp.py +++ b/src/saml2/s2repoze/plugins/sp.py @@ -27,7 +27,7 @@ from paste.request import parse_dict_querystring from paste.request import construct_url from saml2.extension.pefim import SPCertEnc from saml2.httputil import getpath, SeeOther -from saml2.client_base import ECP_SERVICE +from saml2.client_base import ECP_SERVICE, MIME_PAOS from zope.interface import implementer from repoze.who.interfaces import IChallenger, IIdentifier, IAuthenticator @@ -179,7 +179,7 @@ class SAML2Plugin(object): logger.info("[_pick_idp] %s", environ) if "HTTP_PAOS" in environ: if environ["HTTP_PAOS"] == PAOS_HEADER_INFO: - if 'application/vnd.paos+xml' in environ["HTTP_ACCEPT"]: + if MIME_PAOS in environ["HTTP_ACCEPT"]: # Where should I redirect the user to # entityid -> the IdP to use # relay_state -> when back from authentication |