Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 9e87438

Browse files
committed
Rename OIDC_KEYS to RP_KEYS. Somewhat clearer what they are.
Allow hash_seed to be set in configuration file.
1 parent 6a86832 commit 9e87438

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

flask_rp/application.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,18 @@
1111

1212

1313
def init_oidc_rp_handler(app):
14-
oidc_keys_conf = app.config.get('OIDC_KEYS')
14+
rp_keys_conf = app.config.get('RP_KEYS')
15+
if rp_keys_conf is None:
16+
rp_keys_conf = app.config.get('OIDC_KEYS')
17+
1518
verify_ssl = app.config.get('VERIFY_SSL')
19+
hash_seed = app.config.get('HASH_SEED')
20+
if not hash_seed:
21+
hash_seed = "BabyHoldOn"
1622

17-
if oidc_keys_conf:
18-
_kj = init_key_jar(**oidc_keys_conf)
19-
_path = oidc_keys_conf['public_path']
23+
if rp_keys_conf:
24+
_kj = init_key_jar(**rp_keys_conf)
25+
_path = rp_keys_conf['public_path']
2026
if _path.startswith('./'):
2127
_path = _path[2:]
2228
elif _path.startswith('/'):
@@ -26,7 +32,7 @@ def init_oidc_rp_handler(app):
2632
_path = ''
2733
_kj.verify_ssl = verify_ssl
2834

29-
rph = RPHandler(base_url=app.config.get('BASEURL'), hash_seed="BabyHoldOn",
35+
rph = RPHandler(base_url=app.config.get('BASEURL'), hash_seed=hash_seed,
3036
keyjar=_kj, jwks_path=_path,
3137
client_configs=app.config.get('CLIENTS'),
3238
services=app.config.get('SERVICES'),

flask_rp/conf.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,13 @@ SECRET_KEY: 'secret_key'
2424
SESSION_COOKIE_NAME: 'rp_session'
2525
PREFERRED_URL_SCHEME: 'https'
2626

27-
OIDC_KEYS:
27+
RP_KEYS:
2828
'private_path': './private/jwks.json'
2929
'key_defs': *keydef
3030
'public_path': './static/jwks.json'
31-
# this will create the jwks files if they absent
31+
# this will create the jwks files if they are absent
3232
'read_only': False
3333

34-
# PUBLIC_JWKS_PATH: 'https://127.0.0.1:8090/static/jwks.json'
35-
# PRIVATE_JWKS_PATH: './private/jwks.json'
36-
3734
client_preferences: &id001
3835
application_name: rphandler
3936
application_type: web

flask_rp/example_conf.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@ KEYDEFS: &keydef
1919
"crv": "P-256"
2020
"use": ["sig"]
2121

22-
PRIVATE_JWKS_PATH: "jwks_dir/jwks.json"
23-
PUBLIC_JWKS_PATH: 'static/jwks.json'
22+
RP_KEYS:
23+
'private_path': 'jwks_dir/jwks.json'
24+
'key_defs': *keydef
25+
'public_path': 'static/jwks.json'
26+
# this will create the jwks files if they absent
27+
'read_only': False
28+
2429
# information used when registering the client, this may be the same for all OPs
2530

2631
services: &services

0 commit comments

Comments
 (0)