@@ -185,9 +185,7 @@ def items(self):
185185 yield key , getattr (self , key )
186186
187187
188- class OPConfiguration (Base ):
189- "Provider configuration"
190-
188+ class EntityConfiguration (Base ):
191189 def __init__ (
192190 self ,
193191 conf : Dict ,
@@ -210,13 +208,9 @@ def __init__(
210208 self .cookie_handler = None
211209 self .endpoint = {}
212210 self .httpc_params = {}
213- self .id_token = None
214211 self .issuer = ""
215212 self .keys = None
216- self .login_hint2acrs = {}
217- self .login_hint_lookup = None
218213 self .session_key = None
219- self .sub_func = {}
220214 self .template_dir = None
221215 self .token_handler_args = {}
222216 self .userinfo = None
@@ -251,13 +245,8 @@ def __init__(
251245 set_domain_and_port (conf , URIS , domain = domain , port = port )
252246
253247
254- AS_DEFAULT_CONFIG = copy .deepcopy (OP_DEFAULT_CONFIG )
255- AS_DEFAULT_CONFIG ["claims_interface" ] = {
256- "class" : "oidcop.session.claims.OAuth2ClaimsInterface" , "kwargs" : {}}
257-
258-
259- class ASConfiguration (Base ):
260- "Authorization server configuration"
248+ class OPConfiguration (EntityConfiguration ):
249+ "Provider configuration"
261250
262251 def __init__ (
263252 self ,
@@ -268,52 +257,41 @@ def __init__(
268257 port : Optional [int ] = 0 ,
269258 file_attributes : Optional [List [str ]] = None ,
270259 ):
260+ # OP special
261+ self .default_config = OP_DEFAULT_CONFIG
271262
272- conf = copy .deepcopy (conf )
273- Base .__init__ (self , conf , base_path , file_attributes )
263+ self .id_token = None
264+ self .login_hint2acrs = {}
265+ self .login_hint_lookup = None
266+ self .sub_func = {}
274267
275- self .add_on = None
276- self .authz = None
277- self .authentication = None
278- self .base_url = ""
279- self .capabilities = None
280- self .claims_interface = None
281- self .cookie_handler = None
282- self .endpoint = {}
283- self .httpc_params = {}
284- self .issuer = ""
285- self .keys = None
286- self .session_key = None
287- self .template_dir = None
288- self .token_handler_args = {}
289- self .userinfo = None
268+ EntityConfiguration .__init__ (self , conf = conf , base_path = base_path ,
269+ entity_conf = entity_conf , domain = domain , port = port ,
270+ file_attributes = file_attributes )
290271
291- if file_attributes is None :
292- file_attributes = DEFAULT_FILE_ATTRIBUTE_NAMES
293272
294- for key in self .__dict__ .keys ():
295- _val = conf .get (key )
296- if not _val :
297- if key in AS_DEFAULT_CONFIG :
298- _dc = copy .deepcopy (AS_DEFAULT_CONFIG [key ])
299- add_base_path (_dc , base_path , file_attributes )
300- _val = _dc
301- else :
302- continue
303- setattr (self , key , _val )
273+ AS_DEFAULT_CONFIG = copy .deepcopy (OP_DEFAULT_CONFIG )
274+ AS_DEFAULT_CONFIG ["claims_interface" ] = {
275+ "class" : "oidcop.session.claims.OAuth2ClaimsInterface" , "kwargs" : {}}
304276
305- if self .template_dir is None :
306- self .template_dir = os .path .abspath ("templates" )
307- else :
308- self .template_dir = os .path .abspath (self .template_dir )
309277
310- if not domain :
311- domain = conf . get ( "domain" , "127.0.0.1" )
278+ class ASConfiguration ( EntityConfiguration ) :
279+ "Authorization server configuration"
312280
313- if not port :
314- port = conf .get ("port" , 80 )
281+ def __init__ (
282+ self ,
283+ conf : Dict ,
284+ base_path : Optional [str ] = "" ,
285+ entity_conf : Optional [List [dict ]] = None ,
286+ domain : Optional [str ] = "" ,
287+ port : Optional [int ] = 0 ,
288+ file_attributes : Optional [List [str ]] = None ,
289+ ):
290+ self .default_config = AS_DEFAULT_CONFIG
315291
316- set_domain_and_port (conf , URIS , domain = domain , port = port )
292+ EntityConfiguration .__init__ (self , conf = conf , base_path = base_path ,
293+ entity_conf = entity_conf , domain = domain , port = port ,
294+ file_attributes = file_attributes )
317295
318296
319297class Configuration (Base ):
0 commit comments