Skip to content

Commit 1700c68

Browse files
Merge pull request #383 from smalihaider-daasi/add-kid-in-oidc-jwks-endpoint
Make "kid" configurable for the openid_connect frontend
2 parents b1ea01d + d8cc208 commit 1700c68

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

example/plugins/frontends/openid_connect_frontend.yaml.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module: satosa.frontends.openid_connect.OpenIDConnectFrontend
22
name: OIDC
33
config:
44
signing_key_path: frontend.key
5+
signing_key_id: frontend.key1
56
db_uri: mongodb://db.example.com # optional: only support MongoDB, will default to in-memory storage if not specified
67
client_db_path: /path/to/your/cdb.json
78
sub_hash_salt: randomSALTvalue # if not specified, it is randomly generated on every startup

src/satosa/frontends/openid_connect.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ def __init__(self, auth_req_callback_func, internal_attributes, conf, base_url,
4444
super().__init__(auth_req_callback_func, internal_attributes, base_url, name)
4545

4646
self.config = conf
47-
self.signing_key = RSAKey(key=rsa_load(conf["signing_key_path"]), use="sig", alg="RS256")
47+
self.signing_key = RSAKey(key=rsa_load(conf["signing_key_path"]), use="sig", alg="RS256",
48+
kid=conf.get("signing_key_id", ""))
4849

4950
def _create_provider(self, endpoint_baseurl):
5051
response_types_supported = self.config["provider"].get("response_types_supported", ["id_token"])
@@ -240,6 +241,10 @@ def _validate_config(self, config):
240241
if k not in config:
241242
raise ValueError("Missing configuration parameter '{}' for OpenID Connect frontend.".format(k))
242243

244+
if "signing_key_id" in config and type(config["signing_key_id"]) is not str:
245+
raise ValueError(
246+
"The configuration parameter 'signing_key_id' is not defined as a string for OpenID Connect frontend.")
247+
243248
def _get_authn_request_from_state(self, state):
244249
"""
245250
Extract the clietns request stoed in the SATOSA state.

0 commit comments

Comments
 (0)