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

Commit d562641

Browse files
committed
Added missing file
1 parent bf72984 commit d562641

File tree

2 files changed

+155
-3
lines changed

2 files changed

+155
-3
lines changed

src/oidcrp/configure.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Configuration management for RP"""
2-
import os
2+
import logging
33
from typing import Dict
44
from typing import Optional
55

@@ -17,7 +17,6 @@
1717
except ImportError:
1818
from oidcendpoint import rndstr as rnd_token
1919

20-
2120
DEFAULT_ITEM_PATHS = {
2221
"webserver": ['server_key', 'server_cert'],
2322
"rp_keys": ["public_path", "private_path"],
@@ -47,7 +46,11 @@ def __init__(self, conf: Dict, base_path: str = '', item_paths: Optional[dict] =
4746
# this adds a base path to all paths in the configuration
4847
add_base_path(conf, item_paths, base_path)
4948

50-
self.logger = configure_logging(config=conf.get('logging')).getChild(__name__)
49+
log_conf = conf.get('logging')
50+
if log_conf:
51+
self.logger = configure_logging(config=log_conf).getChild(__name__)
52+
else:
53+
self.logger = logging.getLogger('oidcrp')
5154

5255
# server info
5356
self.domain = lower_or_upper(conf, "domain")

tests/conf.yaml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
logging:
2+
version: 1
3+
disable_existing_loggers: False
4+
root:
5+
handlers:
6+
- console
7+
- file
8+
level: DEBUG
9+
loggers:
10+
idp:
11+
level: DEBUG
12+
handlers:
13+
console:
14+
class: logging.StreamHandler
15+
stream: 'ext://sys.stdout'
16+
formatter: default
17+
file:
18+
class: logging.FileHandler
19+
filename: 'debug.log'
20+
formatter: default
21+
formatters:
22+
default:
23+
format: '%(asctime)s %(name)s %(levelname)s %(message)s'
24+
25+
port: &port 8090
26+
domain: &domain 127.0.0.1
27+
base_url: "https://{domain}:{port}"
28+
29+
httpc_params:
30+
# This is just for testing a local usage. In all other cases it MUST be True
31+
verify: false
32+
# Client side
33+
#client_cert: "certs/client.crt"
34+
#client_key: "certs/client.key"
35+
36+
keydefs: &keydef
37+
- "type": "RSA"
38+
"key": ''
39+
"use": ["sig"]
40+
- "type": "EC"
41+
"crv": "P-256"
42+
"use": ["sig"]
43+
44+
rp_keys:
45+
'private_path': 'private/jwks.json'
46+
'key_defs': *keydef
47+
'public_path': 'static/jwks.json'
48+
# this will create the jwks files if they are absent
49+
'read_only': False
50+
51+
client_preferences: &id001
52+
application_name: rphandler
53+
application_type: web
54+
contacts:
55+
56+
response_types:
57+
- code
58+
scope:
59+
- openid
60+
- profile
61+
- email
62+
- address
63+
- phone
64+
token_endpoint_auth_method:
65+
- client_secret_basic
66+
- client_secret_post
67+
68+
services: &id002
69+
discovery: &disc
70+
class: oidcservice.oidc.provider_info_discovery.ProviderInfoDiscovery
71+
kwargs: {}
72+
registration: &regist
73+
class: oidcservice.oidc.registration.Registration
74+
kwargs: {}
75+
authorization: &authz
76+
class: oidcservice.oidc.authorization.Authorization
77+
kwargs: {}
78+
accesstoken: &acctok
79+
class: oidcservice.oidc.access_token.AccessToken
80+
kwargs: {}
81+
userinfo: &userinfo
82+
class: oidcservice.oidc.userinfo.UserInfo
83+
kwargs: {}
84+
end_session: &sess
85+
class: oidcservice.oidc.end_session.EndSession
86+
kwargs: {}
87+
88+
clients:
89+
"":
90+
client_preferences: *id001
91+
redirect_uris: None
92+
services: *id002
93+
flop:
94+
client_preferences: *id001
95+
issuer: https://127.0.0.1:5000/
96+
redirect_uris:
97+
- 'https://{domain}:{port}/authz_cb/flop'
98+
post_logout_redirect_uris:
99+
- "https://{domain}:{port}/session_logout/flop"
100+
frontchannel_logout_uri: "https://{domain}:{port}/fc_logout/flop"
101+
frontchannel_logout_session_required: True
102+
backchannel_logout_uri: "https://{domain}:{port}/bc_logout/flop"
103+
backchannel_logout_session_required: True
104+
services:
105+
discovery: *disc
106+
registration: *regist
107+
authorization: *authz
108+
accesstoken: *acctok
109+
userinfo: *userinfo
110+
end_session: *sess
111+
add_ons:
112+
pkce:
113+
function: oidcservice.oidc.add_on.pkce.add_pkce_support
114+
kwargs:
115+
code_challenge_length: 64
116+
code_challenge_method: S256
117+
# status_check:
118+
# function: oidcservice.oidc.add_on.status_check.add_status_check_support
119+
# kwargs:
120+
# rp_iframe_path: "templates/rp_iframe.html"
121+
bobcat:
122+
client_id: client3
123+
client_secret: 'abcdefghijklmnop'
124+
client_preferences: *id001
125+
issuer: http://127.0.0.1:8080/
126+
jwks_uri: 'static/jwks.json'
127+
redirect_uris: ['https://{domain}:{port}/authz_cb/bobcat']
128+
post_logout_redirect_uris:
129+
- "https://{domain}:{port}/session_logout/bobcat"
130+
services: *id002
131+
request_args:
132+
claims:
133+
id_token:
134+
acr:
135+
essential:
136+
true
137+
138+
139+
webserver:
140+
port: *port
141+
domain: *domain
142+
# If BASE is https these has to be specified
143+
server_cert: "certs/cert.pem"
144+
server_key: "certs/key.pem"
145+
# If you want the clients cert to be verified
146+
# verify_user: optional
147+
# The you also need
148+
# ca_bundle: ''
149+
debug: true

0 commit comments

Comments
 (0)