Skip to content

Commit a8c6320

Browse files
Merge pull request #559 from erakli/replace_mime_paos_literals
Replace string literals with MIME_PAOS
2 parents c07b12e + f15ad58 commit a8c6320

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

example/sp-wsgi/sp.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import re
1010
import sys
1111
import xml.dom.minidom
12+
13+
from saml2.client_base import MIME_PAOS
1214
from saml2.sigver import SignatureError
1315

1416
import six
@@ -470,7 +472,7 @@ def _pick_idp(self, came_from):
470472
logger.debug("[_pick_idp] %s", self.environ)
471473
if "HTTP_PAOS" in self.environ:
472474
if self.environ["HTTP_PAOS"] == PAOS_HEADER_INFO:
473-
if 'application/vnd.paos+xml' in self.environ["HTTP_ACCEPT"]:
475+
if MIME_PAOS in self.environ["HTTP_ACCEPT"]:
474476
# Where should I redirect the user to
475477
# entityid -> the IdP to use
476478
# relay_state -> when back from authentication

src/saml2/ecp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Contains classes used in the SAML ECP profile
77
"""
88
import logging
9-
from saml2.client_base import ACTOR
9+
from saml2.client_base import ACTOR, MIME_PAOS
1010
from saml2.ecp_client import SERVICE
1111

1212
from saml2 import element_to_extension_element
@@ -30,7 +30,7 @@
3030

3131

3232
def ecp_capable(headers):
33-
if "application/vnd.paos+xml" in headers["Accept"]:
33+
if MIME_PAOS in headers["Accept"]:
3434
if "PAOS" in headers:
3535
if 'ver="%s";"%s"' % (paos.NAMESPACE,
3636
SERVICE) in headers["PAOS"]:

src/saml2/s2repoze/plugins/sp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from paste.request import construct_url
2828
from saml2.extension.pefim import SPCertEnc
2929
from saml2.httputil import getpath, SeeOther
30-
from saml2.client_base import ECP_SERVICE
30+
from saml2.client_base import ECP_SERVICE, MIME_PAOS
3131
from zope.interface import implementer
3232

3333
from repoze.who.interfaces import IChallenger, IIdentifier, IAuthenticator
@@ -179,7 +179,7 @@ def _pick_idp(self, environ, came_from):
179179
logger.info("[_pick_idp] %s", environ)
180180
if "HTTP_PAOS" in environ:
181181
if environ["HTTP_PAOS"] == PAOS_HEADER_INFO:
182-
if 'application/vnd.paos+xml' in environ["HTTP_ACCEPT"]:
182+
if MIME_PAOS in environ["HTTP_ACCEPT"]:
183183
# Where should I redirect the user to
184184
# entityid -> the IdP to use
185185
# relay_state -> when back from authentication

0 commit comments

Comments
 (0)