File tree Expand file tree Collapse file tree 1 file changed +25
-9
lines changed
Expand file tree Collapse file tree 1 file changed +25
-9
lines changed Original file line number Diff line number Diff line change @@ -563,14 +563,30 @@ def __init__(self):
563563 Config .__init__ (self )
564564
565565
566- def config_factory (typ , filename ):
567- if typ == "sp" :
568- conf = SPConfig ().load_file (filename )
569- conf .context = typ
570- elif typ in ["aa" , "idp" , "pdp" , "aq" ]:
571- conf = IdPConfig ().load_file (filename )
572- conf .context = typ
566+ def config_factory (_type , config ):
567+ """
568+
569+ :type _type: str
570+ :param _type:
571+
572+ :type config: str or dict
573+ :param config: Name of file with pysaml2 config or CONFIG dict
574+
575+ :return:
576+ """
577+ if _type == "sp" :
578+ conf = SPConfig ()
579+ elif _type in ["aa" , "idp" , "pdp" , "aq" ]:
580+ conf = IdPConfig ()
573581 else :
574- conf = Config ().load_file (filename )
575- conf .context = typ
582+ conf = Config ()
583+
584+ if isinstance (config , dict ):
585+ conf .load (copy .deepcopy (config ))
586+ elif isinstance (config , str ):
587+ conf .load_file (config )
588+ else :
589+ raise ValueError ('Unknown type of config' )
590+
591+ conf .context = _type
576592 return conf
You can’t perform that action at this time.
0 commit comments