Skip to content

Commit 2920f74

Browse files
committed
Add capability to also set the discovery service policy
Added the capability to also set the discovery service policy from the context in addition to the discovery service URL.
1 parent f47710d commit 2920f74

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/satosa/backends/saml2.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class SAMLBackend(BackendModule, SAMLBaseModule):
4141
"""
4242
KEY_DISCO_SRV = 'disco_srv'
4343
KEY_SAML_DISCOVERY_SERVICE_URL = 'saml_discovery_service_url'
44+
KEY_SAML_DISCOVERY_SERVICE_POLICY = 'saml_discovery_service_policy'
4445
KEY_SP_CONFIG = 'sp_config'
4546
VALUE_ACR_COMPARISON_DEFAULT = 'exact'
4647

@@ -121,12 +122,19 @@ def disco_query(self, context):
121122
return_url = endpoints["discovery_response"][0][0]
122123

123124
disco_url = context.get_decoration(self.KEY_SAML_DISCOVERY_SERVICE_URL)
125+
disco_policy = (
126+
context.get_decoration(self.KEY_SAML_DISCOVERY_SERVICE_POLICY)
127+
)
128+
124129
if not disco_url:
125130
disco_url = self.discosrv
126131

132+
args = {"return" : return_url}
133+
if disco_policy:
134+
args["policy"] = disco_policy
135+
127136
loc = self.sp.create_discovery_service_request(
128-
disco_url,
129-
self.sp.config.entityid, **{"return": return_url})
137+
disco_url, self.sp.config.entityid, **args)
130138

131139
return SeeOther(loc)
132140

0 commit comments

Comments
 (0)