Skip to content

Commit eb14c86

Browse files
authored
Merge pull request #47 from its-dirg/publish-metadata
Remove broken 'publish_metadata' SAML plugin config param.
2 parents 9a8c1dc + d8d12fc commit eb14c86

File tree

6 files changed

+3
-22
lines changed

6 files changed

+3
-22
lines changed

example/plugins/backends/saml2_backend.yaml.example

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,4 @@ config:
2424
- [<base_url>/<name>/disco, 'urn:oasis:names:tc:SAML:profiles:SSO:idp-discovery-protocol']
2525
name_id_format: 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient'
2626
# disco_srv must be defined if there is more than one IdP in the metadata specified above
27-
disco_srv: http://disco.example.com
28-
publish_metadata: <base_url>/<name>/metadata
27+
disco_srv: http://disco.example.com

example/plugins/frontends/saml2_frontend.yaml.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ config:
2828
"": default-LoA
2929
"https://accounts.google.com": LoA1
3030

31-
publish_metadata: <base_url>/<name>/metadata
3231
endpoints:
3332
single_sign_on_service: {'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST': sso/post,
3433
'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect': sso/redirect}

src/satosa/backends/saml2.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,6 @@ def register_endpoints(self):
231231
parsed_endp = urlparse(endp)
232232
url_map.append(("^%s$" % parsed_endp.path[1:], functools.partial(self.authn_response, binding=binding)))
233233

234-
if "publish_metadata" in self.config:
235-
metadata_path = urlparse(self.config["publish_metadata"])
236-
url_map.append(("^%s$" % metadata_path.path[1:], self._metadata_endpoint))
237-
238234
if self.discosrv:
239235
for endp, binding in sp_endpoints["discovery_response"]:
240236
parsed_endp = urlparse(endp)

src/satosa/frontends/saml2.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,6 @@ def _register_endpoints(self, providers):
348348
url_map.append(("%s/%s$" % (valid_providers, parsed_endp.path),
349349
functools.partial(self.handle_authn_request, binding_in=binding)))
350350

351-
if "publish_metadata" in self.config:
352-
metadata_path = urlparse(self.config["publish_metadata"])
353-
url_map.append(("^%s$" % metadata_path.path[1:], self._metadata_endpoint))
354-
355351
return url_map
356352

357353
def _build_idp_config_endpoints(self, config, providers):

tests/satosa/backends/test_saml2.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
}
2929
}
3030

31-
METADATA_URL = "http://example.com/SAML2IDP/metadata"
3231
DISCOSRV_URL = "https://my.dicso.com/role/idp.ds"
3332

3433

@@ -72,8 +71,7 @@ def setup_test_config(self, sp_conf, idp_conf):
7271
def create_backend(self, sp_conf, idp_conf):
7372
self.setup_test_config(sp_conf, idp_conf)
7473
self.samlbackend = SAMLBackend(Mock(), INTERNAL_ATTRIBUTES, {"sp_config": sp_conf,
75-
"disco_srv": DISCOSRV_URL,
76-
"publish_metadata": METADATA_URL},
74+
"disco_srv": DISCOSRV_URL},
7775
"base_url",
7876
"samlbackend")
7977

@@ -91,8 +89,6 @@ def get_path_from_url(url):
9189
for endp in all_sp_endpoints:
9290
assert any(p.match(endp) for p in compiled_regex)
9391

94-
assert any(p.match(get_path_from_url(METADATA_URL)) for p in compiled_regex)
95-
9692
def test_start_auth_defaults_to_redirecting_to_discovery_server(self, context, sp_conf):
9793
resp = self.samlbackend.start_auth(context, InternalRequest(None, None))
9894
self.assert_redirect_to_discovery_server(resp, sp_conf)
@@ -241,4 +237,3 @@ def test_get_metadata_desc_with_logo_without_lang(self, sp_conf, idp_conf):
241237
assert ui_info["display_name"] == expected_ui_info["display_name"]
242238
assert ui_info["description"] == expected_ui_info["description"]
243239
assert ui_info["logo"] == expected_ui_info["logo"]
244-

tests/satosa/frontends/test_saml2.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,7 @@ def test_register_endpoints(self, idp_conf):
116116
def get_path_from_url(url):
117117
return urlparse(url).path.lstrip("/")
118118

119-
metadata_url = "http://example.com/SAML2IDP/metadata"
120-
config = {"idp_config": idp_conf, "endpoints": ENDPOINTS,
121-
"publish_metadata": metadata_url}
119+
config = {"idp_config": idp_conf, "endpoints": ENDPOINTS}
122120

123121
base_url = self.construct_base_url_from_entity_id(idp_conf["entityid"])
124122
samlfrontend = SAMLFrontend(lambda context, internal_req: (context, internal_req),
@@ -131,8 +129,6 @@ def get_path_from_url(url):
131129
for endp in all_idp_endpoints:
132130
assert any(p.match(endp) for p in compiled_regex)
133131

134-
assert any(p.match(get_path_from_url(metadata_url)) for p in compiled_regex)
135-
136132
def test_handle_authn_request(self, context, idp_conf, sp_conf, internal_response):
137133
samlfrontend = self.setup_for_authn_req(context, idp_conf, sp_conf)
138134
_, internal_req = samlfrontend.handle_authn_request(context, BINDING_HTTP_REDIRECT)

0 commit comments

Comments
 (0)