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

Commit 0d72bdc

Browse files
authored
Merge pull request #18 from peppelinux/master
regexp instead of if/else
2 parents c783506 + c5078ef commit 0d72bdc

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

flask_rp/application.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import re
23

34
from cryptojwt import KeyJar
45
from cryptojwt.key_jar import init_key_jar
@@ -23,16 +24,15 @@ def init_oidc_rp_handler(app):
2324
if rp_keys_conf:
2425
_kj = init_key_jar(**rp_keys_conf)
2526
_path = rp_keys_conf['public_path']
26-
if _path.startswith('./'):
27-
_path = _path[2:]
28-
elif _path.startswith('/'):
29-
_path = _path[1:]
27+
# replaces ./ and / from the begin of the string
28+
_path = re.sub('^(.)/', '', _path)
3029
else:
3130
_kj = KeyJar()
3231
_path = ''
3332
_kj.verify_ssl = verify_ssl
3433

35-
rph = RPHandler(base_url=app.config.get('BASEURL'), hash_seed=hash_seed,
34+
rph = RPHandler(base_url=app.config.get('BASEURL'),
35+
hash_seed=hash_seed,
3636
keyjar=_kj, jwks_path=_path,
3737
client_configs=app.config.get('CLIENTS'),
3838
services=app.config.get('SERVICES'),

flask_rp/views.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ def get_rp(op_hash):
9090

9191
def finalize(op_hash, request_args):
9292
rp = get_rp(op_hash)
93-
9493
try:
9594
session['client_id'] = rp.service_context.registration_response['client_id']
9695
except KeyError:

0 commit comments

Comments
 (0)