summaryrefslogtreecommitdiff
path: root/src/saml2/extension/requested_attributes.py
blob: 3d574f15a5bfc40c150533c16c3e23d1949538f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/usr/bin/env python

#
# Generated Tue Jul 18 14:58:29 2017 by parse_xsd.py version 0.5.
#

import saml2
from saml2 import SamlBase

from saml2 import saml


NAMESPACE = 'http://eidas.europa.eu/saml-extensions'

class RequestedAttributeType_(SamlBase):
    """The http://eidas.europa.eu/saml-extensions:RequestedAttributeType element """

    c_tag = 'RequestedAttributeType'
    c_namespace = NAMESPACE
    c_children = SamlBase.c_children.copy()
    c_attributes = SamlBase.c_attributes.copy()
    c_child_order = SamlBase.c_child_order[:]
    c_cardinality = SamlBase.c_cardinality.copy()
    c_children['{urn:oasis:names:tc:SAML:2.0:assertion}AttributeValue'] = ('attribute_value', [saml.AttributeValue])
    c_cardinality['attribute_value'] = {"min":0}
    c_attributes['Name'] = ('name', 'None', True)
    c_attributes['NameFormat'] = ('name_format', 'None', True)
    c_attributes['FriendlyName'] = ('friendly_name', 'None', False)
    c_attributes['isRequired'] = ('is_required', 'None', False)
    c_child_order.extend(['attribute_value'])

    def __init__(self,
            attribute_value=None,
            name=None,
            name_format=None,
            friendly_name=None,
            is_required=None,
            text=None,
            extension_elements=None,
            extension_attributes=None,
        ):
        SamlBase.__init__(self,
                text=text,
                extension_elements=extension_elements,
                extension_attributes=extension_attributes,
                )
        self.attribute_value=attribute_value or []
        self.name=name
        self.name_format=name_format
        self.friendly_name=friendly_name
        self.is_required=is_required

def requested_attribute_type__from_string(xml_string):
    return saml2.create_class_from_xml_string(RequestedAttributeType_, xml_string)


class RequestedAttribute(RequestedAttributeType_):
    """The http://eidas.europa.eu/saml-extensions:RequestedAttribute element """

    c_tag = 'RequestedAttribute'
    c_namespace = NAMESPACE
    c_children = RequestedAttributeType_.c_children.copy()
    c_attributes = RequestedAttributeType_.c_attributes.copy()
    c_child_order = RequestedAttributeType_.c_child_order[:]
    c_cardinality = RequestedAttributeType_.c_cardinality.copy()

def requested_attribute_from_string(xml_string):
    return saml2.create_class_from_xml_string(RequestedAttribute, xml_string)


class RequestedAttributesType_(SamlBase):
    """The http://eidas.europa.eu/saml-extensions:RequestedAttributesType element """

    c_tag = 'RequestedAttributesType'
    c_namespace = NAMESPACE
    c_children = SamlBase.c_children.copy()
    c_attributes = SamlBase.c_attributes.copy()
    c_child_order = SamlBase.c_child_order[:]
    c_cardinality = SamlBase.c_cardinality.copy()
    c_children['{http://eidas.europa.eu/saml-extensions}RequestedAttribute'] = ('requested_attribute', [RequestedAttribute])
    c_cardinality['requested_attribute'] = {"min":0}
    c_child_order.extend(['requested_attribute'])

    def __init__(self,
            requested_attribute=None,
            text=None,
            extension_elements=None,
            extension_attributes=None,
        ):
        SamlBase.__init__(self,
                text=text,
                extension_elements=extension_elements,
                extension_attributes=extension_attributes,
                )
        self.requested_attribute=requested_attribute or []

def requested_attributes_type__from_string(xml_string):
    return saml2.create_class_from_xml_string(RequestedAttributesType_, xml_string)


class RequestedAttributes(RequestedAttributesType_):
    """The http://eidas.europa.eu/saml-extensions:RequestedAttributes element """

    c_tag = 'RequestedAttributes'
    c_namespace = NAMESPACE
    c_children = RequestedAttributesType_.c_children.copy()
    c_attributes = RequestedAttributesType_.c_attributes.copy()
    c_child_order = RequestedAttributesType_.c_child_order[:]
    c_cardinality = RequestedAttributesType_.c_cardinality.copy()

def requested_attributes_from_string(xml_string):
    return saml2.create_class_from_xml_string(RequestedAttributes, xml_string)


ELEMENT_FROM_STRING = {
    RequestedAttributes.c_tag: requested_attributes_from_string,
    RequestedAttributesType_.c_tag: requested_attributes_type__from_string,
    RequestedAttribute.c_tag: requested_attribute_from_string,
    RequestedAttributeType_.c_tag: requested_attribute_type__from_string,
}

ELEMENT_BY_TAG = {
    'RequestedAttributes': RequestedAttributes,
    'RequestedAttributesType': RequestedAttributesType_,
    'RequestedAttribute': RequestedAttribute,
    'RequestedAttributeType': RequestedAttributeType_,
}


def factory(tag, **kwargs):
    return ELEMENT_BY_TAG[tag](**kwargs)