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

Commit 5916dd4

Browse files
authored
Merge branch 'develop' into session_params
2 parents 06228af + eba18ec commit 5916dd4

8 files changed

Lines changed: 25 additions & 59 deletions

File tree

doc/source/contents/conf.rst

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ issuer
88

99
The issuer ID of the OP, a unique value in URI format.
1010

11-
----
12-
seed
13-
----
14-
15-
Used in dynamic client registration endpoint when creating a new client_secret.
16-
If unset it will be random.
1711

1812
--------------
1913
session params
@@ -52,25 +46,6 @@ salt
5246

5347
Salt, value or filename, used in sub_funcs (pairwise, public) for creating the opaque hash of *sub* claim.
5448

55-
56-
sub_funcs
57-
#########
58-
59-
Functions involved in subject creation (jwt token sub claim).
60-
61-
62-
-----------
63-
session_key
64-
-----------
65-
66-
An example::
67-
68-
"session_key": {
69-
"filename": "private/session_jwk.json",
70-
"type": "OCT",
71-
"use": "sig"
72-
},
73-
7449
------
7550
add_on
7651
------
@@ -240,8 +215,14 @@ An example::
240215
"path": "registration",
241216
"class": "oidcop.oidc.registration.Registration",
242217
"kwargs": {
243-
"client_authn_method": null,
244-
"client_secret_expiration_time": 432000
218+
"client_authn_method": None,
219+
"client_secret_expiration_time": 432000,
220+
"client_id_generator": {
221+
"class": 'oidcop.oidc.registration.random_client_id',
222+
"kwargs": {
223+
"seed": "that-optional-random-value"
224+
}
225+
}
245226
}
246227
},
247228
"registration_api": {

example/flask_op/config.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,6 @@
293293
}
294294
}
295295
},
296-
"session_key": {
297-
"filename": "private/session_jwk.json",
298-
"type": "OCT",
299-
"use": "sig"
300-
},
301296
"template_dir": "templates",
302297
"token_handler_args": {
303298
"jwks_file": "private/token_jwks.json",

example/flask_op/config.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ op:
4343
issuer: *base_url
4444
httpc_params:
4545
verify: False
46-
session_key:
47-
filename: private/session_jwk.json
48-
type: OCT
49-
use: sig
5046
capabilities:
5147
subject_types_supported:
5248
- public

src/oidcop/configure.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
},
6868
"httpc_params": {"verify": False},
6969
"issuer": "https://{domain}:{port}",
70-
"session_key": {"filename": "private/session_jwk.json", "type": "OCT", "use": "sig", },
7170
"template_dir": "templates",
7271
"token_handler_args": {
7372
"jwks_file": "private/token_jwks.json",
@@ -216,7 +215,6 @@ def __init__(
216215
self.httpc_params = {}
217216
self.issuer = ""
218217
self.keys = None
219-
self.session_key = None
220218
self.template_dir = None
221219
self.token_handler_args = {}
222220
self.userinfo = None
@@ -516,7 +514,6 @@ def __init__(
516514
"scheme_map": {"email": ["urn:oasis:names:tc:SAML:2.0:ac:classes:InternetProtocolPassword"]}
517515
},
518516
},
519-
"session_key": {"filename": "private/session_jwk.json", "type": "OCT", "use": "sig", },
520517
"template_dir": "templates",
521518
"token_handler_args": {
522519
"jwks_def": {

src/oidcop/endpoint_context.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import requests
88
from cryptojwt import KeyJar
9-
from cryptojwt.utils import as_bytes
109
from jinja2 import Environment
1110
from jinja2 import FileSystemLoader
1211
from oidcmsg.context import OidcContext
@@ -111,7 +110,6 @@ class EndpointContext(OidcContext):
111110
"provider_info": {},
112111
"registration_access_token": {},
113112
"scope2claims": {},
114-
"seed": "",
115113
# "session_db": {},
116114
"session_manager": SessionManager,
117115
"sso_ttl": None,
@@ -139,12 +137,6 @@ def __init__(
139137

140138
self.cwd = cwd
141139

142-
# Those that use seed wants bytes but I can only store str.
143-
try:
144-
self.seed = as_bytes(conf["seed"])
145-
except KeyError:
146-
self.seed = as_bytes(rndstr(32))
147-
148140
# Default values, to be changed below depending on configuration
149141
# arguments for endpoints add-ons
150142
self.args = {}

src/oidcop/oidc/registration.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,14 @@ def comb_uri(args):
9999
val = []
100100
for base, query_dict in args[param]:
101101
if query_dict:
102-
query_string = urlencode([(key, v) for key in query_dict for v in query_dict[key]])
103-
val.append("%s?%s" % (base, query_string))
102+
query_string = urlencode(
103+
[
104+
(key, v)
105+
for key in query_dict
106+
for v in query_dict[key]
107+
]
108+
)
109+
val.append("{base}?{query_string}")
104110
else:
105111
val.append(base)
106112

@@ -139,6 +145,14 @@ class Registration(Endpoint):
139145
# default
140146
# response_placement = 'body'
141147

148+
def __init__(self, *args, **kwargs):
149+
super().__init__(*args, **kwargs)
150+
151+
# Those that use seed wants bytes but I can only store str.
152+
# seed
153+
_seed = kwargs.get("seed") or rndstr(32)
154+
self.seed = as_bytes(_seed)
155+
142156
def match_client_request(self, request):
143157
_context = self.server_get("endpoint_context")
144158
for _pref, _prov in PREFERENCE2PROVIDER.items():
@@ -358,7 +372,7 @@ def client_secret_expiration_time(self):
358372
return utc_time_sans_frac() + _expiration_time
359373

360374
def add_client_secret(self, cinfo, client_id, context):
361-
client_secret = secret(context.seed, client_id)
375+
client_secret = secret(self.seed, client_id)
362376
cinfo["client_secret"] = client_secret
363377
_eat = self.client_secret_expiration_time()
364378
if _eat:

tests/op_config.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,6 @@
268268
}
269269
}
270270
},
271-
"session_key": {
272-
"filename": "private/session_jwk.json",
273-
"type": "OCT",
274-
"use": "sig"
275-
},
276271
"session_params": {
277272
"password": "__password_used_to_encrypt_access_token_sid_value",
278273
"salt": "salt involved in session sub hash ",

tests/srv_config.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ op:
5151
issuer: *base_url
5252
httpc_params:
5353
verify: False
54-
session_key:
55-
filename: private/session_jwk.json
56-
type: OCT
57-
use: sig
5854
capabilities:
5955
subject_types_supported:
6056
- public

0 commit comments

Comments
 (0)