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
|
#!/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_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"/>
"""
|