summaryrefslogtreecommitdiff
path: root/src/saml2/ws/wsutil.py
blob: 3f93565b0342322baa93903028d33b1e7c8e673f (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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#!/usr/bin/env python

#
# Generated Sun Jun 14 12:18:10 2015 by parse_xsd.py version 0.5.
#

import saml2
from saml2 import SamlBase

NAMESPACE = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'

class TTimestampFault_(SamlBase):
    """The http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd:tTimestampFault element """

    c_tag = 'tTimestampFault'
    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()

def t_timestamp_fault__from_string(xml_string):
    return saml2.create_class_from_xml_string(TTimestampFault_, xml_string)

class AttributedDateTime_(SamlBase):
    """The http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd:AttributedDateTime element """

    c_tag = 'AttributedDateTime'
    c_namespace = NAMESPACE
    c_value_type = {'base': 'string'}
    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_attributes['Id'] = ('Id', 'anyURI', False)

    def __init__(self,
            Id=None,
            text=None,
            extension_elements=None,
            extension_attributes=None,
        ):
        SamlBase.__init__(self, 
                text=text,
                extension_elements=extension_elements,
                extension_attributes=extension_attributes,
                )
        self.Id=Id

def attributed_date_time__from_string(xml_string):
    return saml2.create_class_from_xml_string(AttributedDateTime_, xml_string)

class AttributedURI_(SamlBase):
    """The http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd:AttributedURI element """

    c_tag = 'AttributedURI'
    c_namespace = NAMESPACE
    c_value_type = {'base': 'anyURI'}
    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_attributes['Id'] = ('Id', 'anyURI', False)

    def __init__(self,
            Id=None,
            text=None,
            extension_elements=None,
            extension_attributes=None,
        ):
        SamlBase.__init__(self, 
                text=text,
                extension_elements=extension_elements,
                extension_attributes=extension_attributes,
                )
        self.Id=Id

def attributed_ur_i__from_string(xml_string):
    return saml2.create_class_from_xml_string(AttributedURI_, xml_string)

class Expires(AttributedDateTime_):
    """The http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd:Expires element """

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

def expires_from_string(xml_string):
    return saml2.create_class_from_xml_string(Expires, xml_string)

class Created(AttributedDateTime_):
    """The http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd:Created element """

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

def created_from_string(xml_string):
    return saml2.create_class_from_xml_string(Created, xml_string)

class TimestampType_(SamlBase):
    """The http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd:TimestampType element """

    c_tag = 'TimestampType'
    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://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Created'] = ('created', Created)
    c_cardinality['created'] = {"min":0, "max":1}
    c_children['{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Expires'] = ('expires', Expires)
    c_cardinality['expires'] = {"min":0, "max":1}
    c_attributes['Id'] = ('Id', 'anyURI', False)
    c_child_order.extend(['created', 'expires'])

    def __init__(self,
            created=None,
            expires=None,
            Id=None,
            text=None,
            extension_elements=None,
            extension_attributes=None,
        ):
        SamlBase.__init__(self, 
                text=text,
                extension_elements=extension_elements,
                extension_attributes=extension_attributes,
                )
        self.created=created
        self.expires=expires
        self.Id=Id

def timestamp_type__from_string(xml_string):
    return saml2.create_class_from_xml_string(TimestampType_, xml_string)

class Timestamp(TimestampType_):
    """The http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd:Timestamp element """

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

def timestamp_from_string(xml_string):
    return saml2.create_class_from_xml_string(Timestamp, xml_string)

#..................
AG_commonAtts = [
    ('Id', '', False),
]

ELEMENT_FROM_STRING = {
    TTimestampFault_.c_tag: t_timestamp_fault__from_string,
    AttributedDateTime_.c_tag: attributed_date_time__from_string,
    AttributedURI_.c_tag: attributed_ur_i__from_string,
    TimestampType_.c_tag: timestamp_type__from_string,
    Timestamp.c_tag: timestamp_from_string,
    Expires.c_tag: expires_from_string,
    Created.c_tag: created_from_string,
}

ELEMENT_BY_TAG = {
    'tTimestampFault': TTimestampFault_,
    'AttributedDateTime': AttributedDateTime_,
    'AttributedURI': AttributedURI_,
    'TimestampType': TimestampType_,
    'Timestamp': Timestamp,
    'Expires': Expires,
    'Created': Created,
}


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