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

Commit a197211

Browse files
authored
Merge pull request #18 from IdentityPython/develop
Develop
2 parents f4b9bc1 + 4bf31fa commit a197211

4 files changed

Lines changed: 36 additions & 7 deletions

File tree

flask_op/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353

5454
def main(config_file, args):
5555
logging.basicConfig(level=logging.DEBUG)
56-
config = Configuration.create_from_config_file(config_file)
56+
config = Configuration.create_from_config_file(config_file, base_path=dir_path)
5757
app = oidc_provider_init_app(config, 'oidc_op')
5858

5959
web_conf = config.webserver

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def run_tests(self):
6262
"Topic :: Software Development :: Libraries :: Python Modules"],
6363
install_requires=[
6464
"pyyaml",
65-
'oidcendpoint>=1.0.0'
65+
'oidcendpoint>=1.1.0'
6666
],
6767
zip_safe=False,
6868
cmdclass={'test': PyTest},

src/oidcop/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.6.0'
1+
__version__ = '0.6.2'

src/oidcop/configure.py

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
import os
44
from typing import Dict
5+
from typing import Optional
56

67
from cryptojwt.key_bundle import init_key
8+
from oidcmsg import add_base_path
79

810
from oidcop.logging import configure_logging
911
from oidcop.utils import load_yaml_config
@@ -13,13 +15,39 @@
1315
except ImportError:
1416
from oidcendpoint import rndstr as rnd_token
1517

18+
DEFAULT_ITEM_PATHS = {
19+
"webserver": ['server_key', 'server_cert'],
20+
"op": {
21+
"server_info": {
22+
"session_key": ["filename"],
23+
"template_dir": None,
24+
"token_handler_args": {
25+
"jwks_def": ["private_path", "public_path"]
26+
},
27+
"keys": ["private_path", "public_path"],
28+
"cookie_dealer": {
29+
"kwargs": {
30+
"sign_jwk": ["private_path", "public_path"],
31+
"enc_jwk": ["private_path", "public_path"]
32+
}
33+
}
34+
}
35+
}
36+
}
37+
1638

1739
class Configuration:
1840
"""OP Configuration"""
1941

20-
def __init__(self, conf: Dict) -> None:
42+
def __init__(self, conf: Dict, base_path: str = '', item_paths: Optional[dict] = None) -> None:
2143
self.logger = configure_logging(config=conf.get('logging')).getChild(__name__)
22-
self.op = None
44+
self.op = {}
45+
if item_paths is None:
46+
item_paths = DEFAULT_ITEM_PATHS
47+
48+
if base_path and item_paths:
49+
# this adds a base path to all paths in the configuration
50+
add_base_path(conf, item_paths, base_path)
2351

2452
# OIDC provider configuration
2553
for section in ['op', 'webserver', 'httpc_params', 'jinja_env']:
@@ -47,6 +75,7 @@ def __init__(self, conf: Dict) -> None:
4775
setattr(self, param, _pre)
4876

4977
@classmethod
50-
def create_from_config_file(cls, filename: str):
78+
def create_from_config_file(cls, filename: str, base_path: str = '',
79+
item_paths: Optional[dict] = None):
5180
"""Load configuration as YAML"""
52-
return cls(load_yaml_config(filename))
81+
return cls(load_yaml_config(filename), base_path, item_paths)

0 commit comments

Comments
 (0)