Skip to content

Commit b4b8df8

Browse files
committed
frontends/openid_connect: support issuer override via provider
Even though the OIDC provider configuration has an element for setting the issuer, for some reason it was rewritten to BASE unconditionally, but this has broken provider endpoint discovery when multiple OIDC frontends were in use.
1 parent 8cb44d6 commit b4b8df8

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

example/plugins/frontends/openid_connect_frontend.yaml.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ config:
3333
sub_hash_salt: randomSALTvalue
3434

3535
provider:
36+
# If you do not specify the issuer here, then BASE will be used as Issuer.
37+
# Note that even though this setting must be specified as a full URL,
38+
# provider discovery will only work, if the request can be routed back to
39+
# SATOSA.
40+
issuer: https://op.example.com/satosa/OIDC
3641
client_registration_supported: Yes
3742
response_types_supported: ["code", "id_token token"]
3843
subject_types_supported: ["pairwise"]

src/satosa/frontends/openid_connect.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ def __init__(self, auth_req_callback_func, internal_attributes, conf, base_url,
6262

6363
self.config = conf
6464
provider_config = self.config["provider"]
65-
provider_config["issuer"] = base_url
65+
if not provider_config.get("issuer"):
66+
provider_config["issuer"] = base_url
6667

6768
self.signing_key = RSAKey(
6869
key=rsa_load(self.config["signing_key_path"]),

tests/satosa/frontends/test_openid_connect.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
EXTRA_SCOPES = {
4545
"eduperson": ["eduperson_scoped_affiliation", "eduperson_principal_name"]
4646
}
47+
ISSUER = "https://other-op.example.com/satosa/other-op"
4748

4849
class TestOpenIDConnectFrontend(object):
4950
@pytest.fixture
@@ -394,6 +395,16 @@ def test_register_endpoints_handles_path_in_issuer(self, frontend_config, issuer
394395
frontend.userinfo_endpoint,
395396
) in urls
396397

398+
def test_discovery_endpoint_honours_issuer_override(self, frontend_config):
399+
frontend_config["provider"]["issuer"] = ISSUER
400+
frontend = self.create_frontend(frontend_config)
401+
discovery_path = urlparse(ISSUER).path[1:]
402+
urls = frontend.register_endpoints(["test"])
403+
assert (
404+
"^{}/{}$".format(discovery_path, ".well-known/openid-configuration"),
405+
frontend.provider_config,
406+
) in urls
407+
397408
def test_register_endpoints_token_and_userinfo_endpoint_is_not_published_if_only_implicit_flow(
398409
self, frontend_config, context):
399410
frontend_config["provider"]["response_types_supported"] = ["id_token", "id_token token"]

0 commit comments

Comments
 (0)