@@ -103,12 +103,13 @@ def repack_cert(cert):
103
103
104
104
105
105
class MetaData (object ):
106
- def __init__ (self , onts , attrc , metadata = "" ):
106
+ def __init__ (self , onts , attrc , metadata = "" , node_name = None , ** kwargs ):
107
107
self .onts = onts
108
108
self .attrc = attrc
109
109
self .entity = {}
110
110
self .metadata = metadata
111
111
self .security = None
112
+ self .node_name = node_name
112
113
113
114
def items (self ):
114
115
return self .entity .items ()
@@ -371,8 +372,8 @@ class MetaDataFile(MetaData):
371
372
Handles Metadata file on the same machine. The format of the file is
372
373
the SAML Metadata format.
373
374
"""
374
- def __init__ (self , onts , attrc , filename , cert = None ):
375
- MetaData .__init__ (self , onts , attrc )
375
+ def __init__ (self , onts , attrc , filename , cert = None , ** kwargs ):
376
+ MetaData .__init__ (self , onts , attrc , ** kwargs )
376
377
self .filename = filename
377
378
self .cert = cert
378
379
@@ -382,8 +383,9 @@ def get_metadata_content(self):
382
383
def load (self ):
383
384
_txt = self .get_metadata_content ()
384
385
if self .cert :
385
- node_name = "%s:%s" % (md .EntitiesDescriptor .c_namespace ,
386
- md .EntitiesDescriptor .c_tag )
386
+ node_name = self .node_name \
387
+ or "%s:%s" % (md .EntitiesDescriptor .c_namespace ,
388
+ md .EntitiesDescriptor .c_tag )
387
389
388
390
if self .security .verify_signature (_txt ,
389
391
node_name = node_name ,
@@ -400,8 +402,8 @@ class MetaDataLoader(MetaDataFile):
400
402
Handles Metadata file loaded by a passed in function.
401
403
The format of the file is the SAML Metadata format.
402
404
"""
403
- def __init__ (self , onts , attrc , loader_callable , cert = None ):
404
- MetaData .__init__ (self , onts , attrc )
405
+ def __init__ (self , onts , attrc , loader_callable , cert = None , ** kwargs ):
406
+ MetaData .__init__ (self , onts , attrc , ** kwargs )
405
407
self .metadata_provider_callable = self .get_metadata_loader (loader_callable )
406
408
self .cert = cert
407
409
@@ -444,7 +446,7 @@ class MetaDataExtern(MetaData):
444
446
Accessible but HTTP GET.
445
447
"""
446
448
447
- def __init__ (self , onts , attrc , url , security , cert , http ):
449
+ def __init__ (self , onts , attrc , url , security , cert , http , ** kwargs ):
448
450
"""
449
451
:params onts:
450
452
:params attrc:
@@ -453,7 +455,7 @@ def __init__(self, onts, attrc, url, security, cert, http):
453
455
:params cert:
454
456
:params http:
455
457
"""
456
- MetaData .__init__ (self , onts , attrc )
458
+ MetaData .__init__ (self , onts , attrc , ** kwargs )
457
459
self .url = url
458
460
self .security = security
459
461
self .cert = cert
@@ -466,8 +468,9 @@ def load(self):
466
468
"""
467
469
response = self .http .send (self .url )
468
470
if response .status_code == 200 :
469
- node_name = "%s:%s" % (md .EntitiesDescriptor .c_namespace ,
470
- md .EntitiesDescriptor .c_tag )
471
+ node_name = self .node_name \
472
+ or "%s:%s" % (md .EntitiesDescriptor .c_namespace ,
473
+ md .EntitiesDescriptor .c_tag )
471
474
472
475
_txt = response .text .encode ("utf-8" )
473
476
if self .cert :
@@ -489,8 +492,8 @@ class MetaDataMD(MetaData):
489
492
Handles locally stored metadata, the file format is the text representation
490
493
of the Python representation of the metadata.
491
494
"""
492
- def __init__ (self , onts , attrc , filename ):
493
- MetaData .__init__ (self , onts , attrc )
495
+ def __init__ (self , onts , attrc , filenamen , ** kwargs ):
496
+ MetaData .__init__ (self , onts , attrc , ** kwargs )
494
497
self .filename = filename
495
498
496
499
def load (self ):
@@ -523,12 +526,13 @@ def load(self, typ, *args, **kwargs):
523
526
elif typ == "inline" :
524
527
self .ii += 1
525
528
key = self .ii
526
- md = MetaData (self .onts , self .attrc , args [0 ])
529
+ md = MetaData (self .onts , self .attrc , args [0 ], ** kwargs )
527
530
elif typ == "remote" :
528
531
key = kwargs ["url" ]
529
532
md = MetaDataExtern (self .onts , self .attrc ,
530
533
kwargs ["url" ], self .security ,
531
- kwargs ["cert" ], self .http )
534
+ kwargs ["cert" ], self .http ,
535
+ node_name = kwargs .get ('node_name' ))
532
536
elif typ == "mdfile" :
533
537
key = args [0 ]
534
538
md = MetaDataMD (self .onts , self .attrc , args [0 ])
0 commit comments