35
35
from saml2 .time_util import valid
36
36
from saml2 .validate import NotValid
37
37
from saml2 .sigver import security_context
38
+ from saml2 .extension .mdattr import NAMESPACE as NS_MDATTR
39
+ from saml2 .extension .mdattr import EntityAttributes
38
40
39
- __author__ = 'rolandh'
40
41
41
42
logger = logging .getLogger (__name__ )
42
43
44
+ classnames = {
45
+ "mdattr_entityattributes" : "{ns}&{tag}" .format (
46
+ ns = NS_MDATTR , tag = EntityAttributes .c_tag
47
+ ),
48
+ }
43
49
44
- class ToOld (Exception ):
45
- pass
46
-
47
-
48
- class SourceNotFound (Exception ):
49
- pass
50
+ ENTITY_CATEGORY = "http://macedir.org/entity-category"
51
+ ENTITY_CATEGORY_SUPPORT = "http://macedir.org/entity-category-support"
50
52
51
53
REQ2SRV = {
52
54
# IDP
@@ -70,12 +72,14 @@ class SourceNotFound(Exception):
70
72
"discovery_service_request" : "discovery_response"
71
73
}
72
74
73
- ENTITYATTRIBUTES = "urn:oasis:names:tc:SAML:metadata:attribute&EntityAttributes"
74
- ENTITY_CATEGORY = "http://macedir.org/entity-category"
75
- ENTITY_CATEGORY_SUPPORT = "http://macedir.org/entity-category-support"
76
75
76
+ class ToOld (Exception ):
77
+ pass
78
+
79
+
80
+ class SourceNotFound (Exception ):
81
+ pass
77
82
78
- # ---------------------------------------------------
79
83
80
84
def load_extensions ():
81
85
from saml2 import extension
@@ -359,7 +363,7 @@ def entity_categories(self, entity_id):
359
363
res = []
360
364
if "extensions" in self [entity_id ]:
361
365
for elem in self [entity_id ]["extensions" ]["extension_elements" ]:
362
- if elem ["__class__" ] == ENTITYATTRIBUTES :
366
+ if elem ["__class__" ] == classnames [ "mdattr_entityattributes" ] :
363
367
for attr in elem ["attribute" ]:
364
368
res .append (attr ["text" ])
365
369
@@ -1243,7 +1247,7 @@ def entity_attributes(self, entity_id):
1243
1247
except KeyError :
1244
1248
return res
1245
1249
for elem in ext ["extension_elements" ]:
1246
- if elem ["__class__" ] == ENTITYATTRIBUTES :
1250
+ if elem ["__class__" ] == classnames [ "mdattr_entityattributes" ] :
1247
1251
for attr in elem ["attribute" ]:
1248
1252
if attr ["name" ] not in res :
1249
1253
res [attr ["name" ]] = []
0 commit comments