summaryrefslogtreecommitdiff
path: root/tests/saml2_data.py
blob: f81f2ce5f3533252228c9b1539d137be1b447ee8 (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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
#!/usr/bin/env python
#

"""Test data for saml2"""

__author__ = 'tmatsuo@example.com (Takashi MATSUO)'

TEST_NAME_ID = """<?xml version="1.0" encoding="utf-8"?>
<NameID xmlns="urn:oasis:names:tc:SAML:2.0:assertion"
  Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
  SPProvidedID="sp provided id">
  tmatsuo@example.com
</NameID>
"""

TEST_ISSUER = """<?xml version="1.0" encoding="utf-8"?>
<Issuer xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
  http://www.example.com/test
</Issuer>
"""

TEST_SUBJECT_LOCALITY = """<?xml version="1.0" encoding="utf-8"?>
<SubjectLocality xmlns="urn:oasis:names:tc:SAML:2.0:assertion"
  Address="127.0.0.1" DNSName="localhost"/>
"""

TEST_AUTHN_CONTEXT_CLASS_REF = """<?xml version="1.0" encoding="utf-8"?>
<AuthnContextClassRef xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
  http://www.example.com/authnContextClassRef
</AuthnContextClassRef>
"""

TEST_AUTHN_CONTEXT_DECL_REF = """<?xml version="1.0" encoding="utf-8"?>
<AuthnContextDeclRef xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
  http://www.example.com/authnContextDeclRef
</AuthnContextDeclRef>
"""

TEST_AUTHN_CONTEXT_DECL = """<?xml version="1.0" encoding="utf-8"?>
<AuthnContextDecl xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
  http://www.example.com/authnContextDecl
</AuthnContextDecl>
"""

TEST_AUTHENTICATING_AUTHORITY = """<?xml version="1.0" encoding="utf-8"?>
<AuthenticatingAuthority xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
  http://www.example.com/authenticatingAuthority
</AuthenticatingAuthority>
"""

TEST_AUTHN_CONTEXT = """<?xml version="1.0" encoding="utf-8"?>
<AuthnContext xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
  <AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:Password</AuthnContextClassRef>
</AuthnContext>
"""

TEST_AUTHN_STATEMENT = """<?xml version="1.0" encoding="utf-8"?>
<AuthnStatement xmlns="urn:oasis:names:tc:SAML:2.0:assertion" AuthnInstant="2007-08-31T01:05:02Z" SessionNotOnOrAfter="2007-09-14T01:05:02Z">
  <AuthnContext>
    <AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:Password</AuthnContextClassRef>
  </AuthnContext>
</AuthnStatement>
"""

TEST_ATTRIBUTE_VALUE = """<?xml version="1.0" encoding="utf-8"?>
<AttributeValue xmlns="urn:oasis:names:tc:SAML:2.0:assertion">value for test attribute</AttributeValue>
"""

TEST_ATTRIBUTE = """<?xml version="1.0" encoding="utf-8"?>
<Attribute Name="testAttribute"
  NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"
  FriendlyName="test attribute"
  xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
  <AttributeValue >value1 of test attribute</AttributeValue>
  <AttributeValue >value2 of test attribute</AttributeValue>
</Attribute>
"""

TEST_ATTRIBUTE_STATEMENT = """<?xml version="1.0" encoding="utf-8"?>
<AttributeStatement xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
  <Attribute Name="testAttribute"
    NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"
    FriendlyName="test attribute">
    <AttributeValue >value1 of test attribute</AttributeValue>
    <AttributeValue >value2 of test attribute</AttributeValue>
  </Attribute>
  <Attribute Name="http://www.example.com/testAttribute2"
    NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
    FriendlyName="test attribute2">
    <AttributeValue >value1 of test attribute2</AttributeValue>
    <AttributeValue >value2 of test attribute2</AttributeValue>
  </Attribute>
</AttributeStatement>
"""

TEST_SUBJECT_CONFIRMATION_DATA = """<?xml version="1.0" encoding="utf-8"?>
<SubjectConfirmationData
  NotBefore="2007-08-31T01:05:02Z"
  NotOnOrAfter="2007-09-14T01:05:02Z"
  Recipient="recipient"
  InResponseTo="responseID"
  Address="127.0.0.1"
  xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
</SubjectConfirmationData>
"""

TEST_SUBJECT_CONFIRMATION = """<?xml version="1.0" encoding="utf-8"?>
<SubjectConfirmation
  Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"
  xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
  <NameID xmlns="urn:oasis:names:tc:SAML:2.0:assertion"
    Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
    SPProvidedID="sp provided id">
    tmatsuo@example.com
  </NameID>
  <SubjectConfirmationData
    NotBefore="2007-08-31T01:05:02Z"
    NotOnOrAfter="2007-09-14T01:05:02Z"
    Recipient="recipient"
    InResponseTo="responseID"
    Address="127.0.0.1">
  </SubjectConfirmationData>
</SubjectConfirmation>
"""

TEST_HOLDER_OF_KEY_SUBJECT_CONFIRMATION = """<?xml version="1.0" encoding="utf-8"?>
<SubjectConfirmation
  Method="urn:oasis:names:tc:SAML:2.0:cm:holder-of-key"
  xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
  <SubjectConfirmationData
    InResponseTo="responseID"
    NotOnOrAfter="2007-09-14T01:05:02Z"
    Recipient="recipient">
    <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
      <X509Data xmlns="http://www.w3.org/2000/09/xmldsig#">
        <X509Certificate xmlns="http://www.w3.org/2000/09/xmldsig#">
MIICITCCAYoCAQEwDQYJKoZIhvcNAQELBQAwWDELMAkGA1UEBhMCenoxCzAJBgNV
BAgMAnp6MQ0wCwYDVQQHDAR6enp6MQ4wDAYDVQQKDAVaenp6ejEOMAwGA1UECwwF
Wnp6enoxDTALBgNVBAMMBHRlc3QwIBcNMTkwNDEyMTk1MDM0WhgPMzAxODA4MTMx
OTUwMzRaMFgxCzAJBgNVBAYTAnp6MQswCQYDVQQIDAJ6ejENMAsGA1UEBwwEenp6
ejEOMAwGA1UECgwFWnp6enoxDjAMBgNVBAsMBVp6enp6MQ0wCwYDVQQDDAR0ZXN0
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDHcj80WU/XBsd9FlyQmfjPUdfm
edhCFDd6TEQmZNNqP/UG+VkGa+BXjRIHMfic/WxPTbGhCjv68ci0UDNomUXagFex
LGNpkwa7+CRVtoc/1xgq+ySE6M4nhcCutScoxNvWNn5eSQ66i3U0sTv91MgsXxqE
dTaiZg0BIufEc3dueQIDAQABMA0GCSqGSIb3DQEBCwUAA4GBAGUV5B+USHvaRa8k
gCNJSuNpo6ARlv0ekrk8bbdNRBiEUdCMyoGJFfuM9K0zybX6Vr25wai3nvaog294
Vx/jWjX2g5SDbjItH6VGy6C9GCGf1A07VxFRCfJn5tA9HuJjPKiE+g/BmrV5N4Ce
alzFxPHWYkNOzoRU8qI7OqUai1kL
        </X509Certificate>
      </X509Data>
    </KeyInfo>
  </SubjectConfirmationData>
</SubjectConfirmation>
"""

TEST_SUBJECT = """<?xml version="1.0" encoding="utf-8"?>
<Subject xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
  <NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
    SPProvidedID="sp provided id">
    tmatsuo@example.com
  </NameID>
  <SubjectConfirmation
    Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
    <NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
      SPProvidedID="sp provided id2">
      admin@example.com
    </NameID>
    <SubjectConfirmationData
      NotBefore="2007-08-31T01:05:02Z"
      NotOnOrAfter="2007-09-14T01:05:02Z"
      Recipient="recipient"
      InResponseTo="responseID"
      Address="127.0.0.1">
    </SubjectConfirmationData>
  </SubjectConfirmation>
</Subject>
"""

TEST_CONDITION = """<?xml version="1.0" encoding="utf-8"?>
<Condition xmlns="urn:oasis:names:tc:SAML:2.0:assertion" xsi:type="test" ExtendedAttribute="value" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
"""

TEST_AUDIENCE = """<?xml version="1.0" encoding="utf-8"?>
<Audience xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
  http://www.example.com/Audience
</Audience>
"""

TEST_AUDIENCE_RESTRICTION = """<?xml version="1.0" encoding="utf-8"?>
<AudienceRestriction xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
  <Audience>
    http://www.example.com/Audience
  </Audience>
</AudienceRestriction>
"""

TEST_ONE_TIME_USE = """<?xml version="1.0" encoding="utf-8"?>
<OneTimeUse xmlns="urn:oasis:names:tc:SAML:2.0:assertion"/>
"""

TEST_PROXY_RESTRICTION = """<?xml version="1.0" encoding="utf-8"?>
<ProxyRestriction xmlns="urn:oasis:names:tc:SAML:2.0:assertion" Count="2">
  <Audience>http://www.example.com/Audience</Audience>
</ProxyRestriction>
"""

TEST_CONDITIONS = """<?xml version="1.0" encoding="utf-8"?>
<Conditions
  xmlns="urn:oasis:names:tc:SAML:2.0:assertion"
  NotBefore="2007-08-31T01:05:02Z"
  NotOnOrAfter="2007-09-14T01:05:02Z">
  <Condition
    xsi:type="test"
    ExtendedAttribute="value"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
  <AudienceRestriction>
    <Audience>
      http://www.example.com/Audience
    </Audience>
  </AudienceRestriction>
  <OneTimeUse />
  <ProxyRestriction  Count="2">
    <Audience>http://www.example.com/Audience</Audience>
  </ProxyRestriction>
</Conditions>
"""

TEST_ASSERTION_ID_REF = """<?xml version="1.0" encoding="utf-8"?>
<AssertionIDRef xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
  zzlieajngjbkjggjldmgindkckkolcblndbghlhm
</AssertionIDRef>
"""

TEST_ASSERTION_URI_REF = """<?xml version="1.0" encoding="utf-8"?>
<AssertionURIRef xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
  http://www.example.com/AssertionURIRef
</AssertionURIRef>
"""

TEST_ACTION = """<?xml version="1.0" encoding="utf-8"?>
<Action xmlns="urn:oasis:names:tc:SAML:2.0:assertion"
  Namespace="http://www.example.com/Namespace"/>
"""