Skip to content

Commit 123620d

Browse files
Merge pull request #225 from alexstuart/redirect-binding
Warn when AssertionConsumerService binding is HTTP-Redirect
2 parents 04e7743 + e79d780 commit 123620d

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

example/plugins/backends/saml2_backend.yaml.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ config:
5050
endpoints:
5151
assertion_consumer_service:
5252
- [<base_url>/<name>/acs/post, 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST']
53-
- [<base_url>/<name>/acs/redirect, 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect']
5453
discovery_response:
5554
- [<base_url>/<name>/disco, 'urn:oasis:names:tc:SAML:profiles:SSO:idp-discovery-protocol']
5655
name_id_format: 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient'

src/satosa/backends/saml2.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
import functools
66
import json
77
import logging
8+
import warnings as _warnings
89
from base64 import urlsafe_b64encode
910
from urllib.parse import urlparse
1011

12+
from saml2 import BINDING_HTTP_REDIRECT
1113
from saml2.client_base import Base
1214
from saml2.config import SPConfig
1315
from saml2.extension.ui import NAMESPACE as UI_NAMESPACE
@@ -429,6 +431,20 @@ def register_endpoints(self):
429431
for endp, binding in sp_endpoints["assertion_consumer_service"]:
430432
parsed_endp = urlparse(endp)
431433
url_map.append(("^%s$" % parsed_endp.path[1:], functools.partial(self.authn_response, binding=binding)))
434+
if binding == BINDING_HTTP_REDIRECT:
435+
msg = " ".join(
436+
[
437+
"AssertionConsumerService endpoint with binding",
438+
BINDING_HTTP_REDIRECT,
439+
"is not recommended.",
440+
"Quoting section 4.1.2 of",
441+
"'Profiles for the OASIS Security Assertion Markup Language (SAML) V2.0':",
442+
"The HTTP Redirect binding MUST NOT be used,",
443+
"as the response will typically exceed the URL length",
444+
"permitted by most user agents.",
445+
]
446+
)
447+
_warnings.warn(msg, DeprecationWarning)
432448

433449
if self.discosrv:
434450
for endp, binding in sp_endpoints["discovery_response"]:

0 commit comments

Comments
 (0)