@@ -131,6 +131,65 @@ def test_verify_w_authn(self):
131131 session_info = self .ar .session_info ()
132132 assert session_info ["authn_info" ] == authn_info
133133
134+ def test_unpack_nested_eptid (self ):
135+ authn_response_xml = """<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
136+ xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
137+ ID="CORTO54673f841c5297dd3614527d38e217332f9e3000"
138+ Version="2.0"
139+ IssueInstant="2016-09-23T14:00:45Z"
140+ Destination="https://sp.example.com/acs/post"
141+ InResponseTo="id-Wnv7CMQO1pFJoRWgi"
142+ >
143+ <saml:Issuer>https://idp.example.com</saml:Issuer>
144+ <samlp:Status>
145+ <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success" />
146+ </samlp:Status>
147+ <saml:Assertion xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
148+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
149+ ID="CORTOadad7cb5e1237cf30fa7ab49544c15eec582854e"
150+ Version="2.0"
151+ IssueInstant="2016-09-23T14:00:45Z"
152+ >
153+ <saml:Issuer>https://idp.example.com</saml:Issuer>
154+ <saml:Subject>
155+ <saml:NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent">b8e734571d9adb0e6444a5b49a22f4206df24d88</saml:NameID>
156+ <saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
157+ <saml:SubjectConfirmationData Recipient="https://sp.example.com/acs/post"
158+ InResponseTo="id-Wnv7CMQO1pFJoRWgi"
159+ />
160+ </saml:SubjectConfirmation>
161+ </saml:Subject>
162+ <saml:Conditions NotBefore="2016-09-23T14:00:44Z">
163+ <saml:AudienceRestriction>
164+ <saml:Audience>https://sp.example.com</saml:Audience>
165+ </saml:AudienceRestriction>
166+ </saml:Conditions>
167+ <saml:AuthnStatement AuthnInstant="2016-09-23T13:55:40Z"
168+ SessionIndex="_9f1148918f12525c6cad9aea29bc557afab2cb8c33"
169+ >
170+ <saml:AuthnContext>
171+ <saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:Password</saml:AuthnContextClassRef>
172+ <saml:AuthenticatingAuthority>https://idp.example.com</saml:AuthenticatingAuthority>
173+ </saml:AuthnContext>
174+ </saml:AuthnStatement>
175+ <saml:AttributeStatement>
176+ <saml:Attribute Name="urn:oid:1.3.6.1.4.1.5923.1.1.1.10"
177+ NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
178+ >
179+ <saml:AttributeValue>
180+ <saml:NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent">b8e734571d9adb0e6444a5b49a22f4206df24d88</saml:NameID>
181+ </saml:AttributeValue>
182+ </saml:Attribute>
183+ </saml:AttributeStatement>
184+ </saml:Assertion>
185+ </samlp:Response>"""
186+
187+ resp = authn_response (self .conf , "https://sp.example.com/acs/post" , asynchop = False , allow_unsolicited = True )
188+ resp .loads (authn_response_xml , False )
189+ resp .parse_assertion ()
190+ ava = resp .get_identity ()
191+ assert ava ["eduPersonTargetedID" ] == ["b8e734571d9adb0e6444a5b49a22f4206df24d88" ]
192+
134193if __name__ == "__main__" :
135194 t = TestAuthnResponse ()
136195 t .setup_class ()
0 commit comments