Skip to content

Commit 4348bd7

Browse files
committed
Adjusted acs endpoint to extract NameQualifier and SPNameQualifier from SAMLResponse. Adjusted single logout service to provide NameQualifier and SPNameQualifier to logout method. Add getNameIdNameQualifier to Auth and SamlResponse. Extend logout method from Auth and LogoutRequest constructor to support SPNameQualifier parameter. Align LogoutRequest constructor with SAML specs
1 parent f34e85f commit 4348bd7

File tree

8 files changed

+193
-14
lines changed

8 files changed

+193
-14
lines changed

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,8 @@ if (!$auth->isAuthenticated()) {
753753
$_SESSION['samlUserdata'] = $auth->getAttributes();
754754
$_SESSION['samlNameId'] = $auth->getNameId();
755755
$_SESSION['samlNameIdFormat'] = $auth->getNameIdFormat();
756+
$_SESSION['samlNameidNameQualifier' = $auth->getNameIdNameQualifier();
757+
$_SESSION['samlNameidSPNameQualifier' = $auth->getNameIdSPNameQualifier();
756758
$_SESSION['samlSessionIndex'] = $auth->getSessionIndex();
757759

758760
if (isset($_POST['RelayState']) && OneLogin_Saml2_Utils::getSelfURL() != $_POST['RelayState']) {
@@ -980,14 +982,16 @@ $auth = new OneLogin_Saml2_Auth();
980982
$auth->logout(); // Method that sent the Logout Request.
981983
```
982984

983-
Also there are six optional parameters that can be set:
985+
Also there are eight optional parameters that can be set:
984986
* `$returnTo` - The target URL the user should be returned to after logout.
985987
* `$parameters` - Extra parameters to be added to the GET.
986988
* `$name_id` - That will be used to build the LogoutRequest. If `name_id` parameter is not set and the auth object processed a
987989
SAML Response with a `NameId`, then this `NameId` will be used.
988990
* `$session_index` - SessionIndex that identifies the session of the user.
989991
* `$stay` - True if we want to stay (returns the url string) False to redirect.
990992
* `$nameIdFormat` - The NameID Format will be set in the LogoutRequest.
993+
* `$nameIdNameQualifier` - The NameID NameQualifier will be set in the LogoutRequest.
994+
* `$nameIdSPNameQualifier` - The NameID SP NameQualifier will be set in the LogoutRequest.
991995

992996
The Logout Request will be sent signed or unsigned based on the security
993997
info of the `advanced_settings.php` (`'logoutRequestSigned'`).
@@ -1014,6 +1018,9 @@ $paramters = array();
10141018
$nameId = null;
10151019
$sessionIndex = null;
10161020
$nameIdFormat = null;
1021+
$nameIdNameQualifier = null;
1022+
$nameIdSPNameQualifier = null;
1023+
10171024
if (isset($_SESSION['samlNameId'])) {
10181025
$nameId = $_SESSION['samlNameId'];
10191026
}
@@ -1023,7 +1030,13 @@ if (isset($_SESSION['samlSessionIndex'])) {
10231030
if (isset($_SESSION['samlNameIdFormat'])) {
10241031
$nameIdFormat = $_SESSION['samlNameIdFormat'];
10251032
}
1026-
$auth->logout($returnTo, $paramters, $nameId, $sessionIndex, false, $nameIdFormat);
1033+
if (isset($_SESSION['samlNameIdNameQualifier'])) {
1034+
$nameIdNameQualifier = $_SESSION['samlNameIdNameQualifier'];
1035+
}
1036+
if (isset($_SESSION['samlNameIdSPNameQualifier'])) {
1037+
$nameIdSPNameQualifier = $_SESSION['samlNameIdSPNameQualifier'];
1038+
}
1039+
$auth->logout($returnTo, $paramters, $nameId, $sessionIndex, false, $nameIdFormat, $nameIdNameQualifier, $nameIdSPNameQualifier);
10271040
```
10281041

10291042
If a match on the future LogoutResponse ID and the LogoutRequest ID to be sent is required, that LogoutRequest ID must to be extracted and stored.
@@ -1282,6 +1295,9 @@ Main class of OneLogin PHP Toolkit
12821295
* `getAttributes` - Returns the set of SAML attributes.
12831296
* `getAttribute` - Returns the requested SAML attribute
12841297
* `getNameId` - Returns the nameID
1298+
* `getNameIdFormat` - Gets the NameID Format provided by the SAML response from the IdP.
1299+
* `getNameIdNameQualifier` - Gets the NameID NameQualifier provided from the SAML Response String.
1300+
* `getNameIdNameSPQualifier` - Gets the NameID SP NameQualifier provided from the SAML Response String.
12851301
* `getSessionIndex` - Gets the SessionIndex from the AuthnStatement.
12861302
* `getErrors` - Returns if there were any error
12871303
* `getSSOurl` - Gets the SSO url.
@@ -1318,6 +1334,8 @@ SAML 2 Authentication Response class
13181334
IdP.
13191335
* `getNameId` - Gets the NameID provided by the SAML response from the IdP.
13201336
* `getNameIdFormat` - Gets the NameID Format provided by the SAML response from the IdP.
1337+
* `getNameIdNameQualifier` - Gets the NameID NameQualifier provided from the SAML Response String.
1338+
* `getNameIdNameSPQualifier` - Gets the NameID SP NameQualifier provided from the SAML Response String.
13211339
* `getSessionNotOnOrAfter` - Gets the SessionNotOnOrAfter from the
13221340
AuthnStatement
13231341
* `getSessionIndex` - Gets the SessionIndex from the AuthnStatement.

demo1/index.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,20 @@
3535
if (isset($_SESSION['samlNameId'])) {
3636
$nameId = $_SESSION['samlNameId'];
3737
}
38-
if (isset($_SESSION['samlSessionIndex'])) {
39-
$sessionIndex = $_SESSION['samlSessionIndex'];
40-
}
4138
if (isset($_SESSION['samlNameIdFormat'])) {
4239
$nameIdFormat = $_SESSION['samlNameIdFormat'];
4340
}
41+
if (isset($_SESSION['samlNameIdNameQualifier'])) {
42+
$nameIdNameQualifier = $_SESSION['samlNameIdNameQualifier'];
43+
}
44+
if (isset($_SESSION['samlNameIdSPNameQualifier'])) {
45+
$nameIdSPNameQualifier = $_SESSION['samlNameIdSPNameQualifier'];
46+
}
47+
if (isset($_SESSION['samlSessionIndex'])) {
48+
$sessionIndex = $_SESSION['samlSessionIndex'];
49+
}
4450

45-
$auth->logout($returnTo, $parameters, $nameId, $sessionIndex, false, $nameIdFormat);
51+
$auth->logout($returnTo, $parameters, $nameId, $sessionIndex, false, $nameIdFormat, $nameIdNameQualifier, $nameIdSPNameQualifier);
4652

4753
# If LogoutRequest ID need to be saved in order to later validate it, do instead
4854
# $sloBuiltUrl = $auth->logout(null, $paramters, $nameId, $sessionIndex, true);
@@ -75,6 +81,8 @@
7581
$_SESSION['samlUserdata'] = $auth->getAttributes();
7682
$_SESSION['samlNameId'] = $auth->getNameId();
7783
$_SESSION['samlNameIdFormat'] = $auth->getNameIdFormat();
84+
$_SESSION['samlNameIdNameQualifier'] = $auth->getNameIdNameQualifier();
85+
$_SESSION['samlNameIdSPNameQualifier'] = $auth->getNameIdSPNameQualifier();
7886
$_SESSION['samlSessionIndex'] = $auth->getSessionIndex();
7987
unset($_SESSION['AuthNRequestID']);
8088
if (isset($_POST['RelayState']) && OneLogin_Saml2_Utils::getSelfURL() != $_POST['RelayState']) {

lib/Saml2/Auth.php

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ class OneLogin_Saml2_Auth
4949
*/
5050
private $_nameidNameQualifier;
5151

52+
/**
53+
* NameID SP NameQualifier
54+
*
55+
* @var string
56+
*/
57+
private $_nameidSPNameQualifier;
58+
5259
/**
5360
* If user is authenticated.
5461
*
@@ -197,6 +204,7 @@ public function processResponse($requestId = null)
197204
$this->_nameid = $response->getNameId();
198205
$this->_nameidFormat = $response->getNameIdFormat();
199206
$this->_nameidNameQualifier = $response->getNameIdNameQualifier();
207+
$this->_nameidSPNameQualifier = $response->getNameIdSPNameQualifier();
200208
$this->_authenticated = true;
201209
$this->_sessionIndex = $response->getSessionIndex();
202210
$this->_sessionExpiration = $response->getSessionNotOnOrAfter();
@@ -380,6 +388,16 @@ public function getNameIdNameQualifier()
380388
return $this->_nameidNameQualifier;
381389
}
382390

391+
/**
392+
* Returns the nameID SP NameQualifier
393+
*
394+
* @return string The nameID SP NameQualifier of the assertion
395+
*/
396+
public function getNameIdSPNameQualifier()
397+
{
398+
return $this->_nameidSPNameQualifier;
399+
}
400+
383401
/**
384402
* Returns the SessionIndex
385403
*
@@ -513,7 +531,7 @@ public function login($returnTo = null, $parameters = array(), $forceAuthn = fal
513531
*
514532
* @throws OneLogin_Saml2_Error
515533
*/
516-
public function logout($returnTo = null, $parameters = array(), $nameId = null, $sessionIndex = null, $stay = false, $nameIdFormat = null, $nameIdNameQualifier = null)
534+
public function logout($returnTo = null, $parameters = array(), $nameId = null, $sessionIndex = null, $stay = false, $nameIdFormat = null, $nameIdNameQualifier = null, $nameIdSPNameQualifier = null)
517535
{
518536
assert('is_array($parameters)');
519537

@@ -532,7 +550,7 @@ public function logout($returnTo = null, $parameters = array(), $nameId = null,
532550
$nameIdFormat = $this->_nameidFormat;
533551
}
534552

535-
$logoutRequest = new OneLogin_Saml2_LogoutRequest($this->_settings, null, $nameId, $sessionIndex, $nameIdFormat, $nameIdNameQualifier);
553+
$logoutRequest = new OneLogin_Saml2_LogoutRequest($this->_settings, null, $nameId, $sessionIndex, $nameIdFormat, $nameIdNameQualifier, $nameIdSPNameQualifier);
536554

537555
$this->_lastRequest = $logoutRequest->getXML();
538556
$this->_lastRequestID = $logoutRequest->id;
@@ -650,7 +668,7 @@ public function buildResponseSignature($samlResponse, $relayState, $signAlgorith
650668
*
651669
* @throws OneLogin_Saml2_Error
652670
*/
653-
private function buildMessageSignature($samlMessage, $relayState, $signAlgorithm = XMLSecurityKey::RSA_SHA256, $type="SAMLRequest")
671+
private function buildMessageSignature($samlMessage, $relayState, $signAlgorithm = XMLSecurityKey::RSA_SHA256, $type = "SAMLRequest")
654672
{
655673
$key = $this->_settings->getSPkey();
656674
if (empty($key)) {

lib/Saml2/LogoutRequest.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@ class OneLogin_Saml2_LogoutRequest
3939
* @param string|null $sessionIndex The SessionIndex (taken from the SAML Response in the SSO process).
4040
* @param string|null $nameIdFormat The NameID Format will be set in the LogoutRequest.
4141
* @param string|null $nameIdNameQualifier The NameID NameQualifier will be set in the LogoutRequest.
42+
* @param string|null $nameIdSPNameQualifier The NameID SP NameQualifier will be set in the LogoutRequest.
4243
*
4344
* @throws OneLogin_Saml2_Error
4445
*/
45-
public function __construct(OneLogin_Saml2_Settings $settings, $request = null, $nameId = null, $sessionIndex = null, $nameIdFormat = null, $nameIdNameQualifier = null)
46+
public function __construct(OneLogin_Saml2_Settings $settings, $request = null, $nameId = null, $sessionIndex = null, $nameIdFormat = null, $nameIdNameQualifier = null, $nameIdSPNameQualifier = null)
4647
{
4748
$this->_settings = $settings;
4849

@@ -59,7 +60,6 @@ public function __construct(OneLogin_Saml2_Settings $settings, $request = null,
5960
$id = OneLogin_Saml2_Utils::generateUniqueID();
6061
$this->id = $id;
6162

62-
$nameIdValue = OneLogin_Saml2_Utils::generateUniqueID();
6363
$issueInstant = OneLogin_Saml2_Utils::parseTime2SAML(time());
6464

6565
$cert = null;
@@ -78,16 +78,26 @@ public function __construct(OneLogin_Saml2_Settings $settings, $request = null,
7878
$spData['NameIDFormat'] != OneLogin_Saml2_Constants::NAMEID_UNSPECIFIED) {
7979
$nameIdFormat = $spData['NameIDFormat'];
8080
}
81-
$spNameQualifier = null;
8281
} else {
8382
$nameId = $idpData['entityId'];
8483
$nameIdFormat = OneLogin_Saml2_Constants::NAMEID_ENTITY;
85-
$spNameQualifier = $spData['entityId'];
84+
}
85+
86+
/* From saml-core-2.0-os 8.3.6, when the entity Format is used:
87+
"The NameQualifier, SPNameQualifier, and SPProvidedID attributes MUST be omitted.
88+
*/
89+
if (!empty($nameIdFormat) && $nameIdFormat == OneLogin_Saml2_Constants::NAMEID_ENTITY) {
90+
$nameIdNameQualifier = null;
91+
$nameIdSPNameQualifier = null;
92+
}
93+
// NameID Format UNSPECIFIED omitted
94+
if (!empty($nameIdFormat) && $nameIdFormat == OneLogin_Saml2_Constants::NAMEID_UNSPECIFIED) {
95+
$nameIdFormat = null;
8696
}
8797

8898
$nameIdObj = OneLogin_Saml2_Utils::generateNameId(
8999
$nameId,
90-
$spNameQualifier,
100+
$nameIdSPNameQualifier,
91101
$nameIdFormat,
92102
$cert,
93103
$nameIdNameQualifier

lib/Saml2/Response.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,23 @@ public function getNameIdNameQualifier()
671671
return $nameIdNameQualifier;
672672
}
673673

674+
/**
675+
* Gets the NameID SP NameQualifier provided by the SAML response from the IdP.
676+
*
677+
* @return string|null NameID SP NameQualifier
678+
*
679+
* @throws ValidationError
680+
*/
681+
public function getNameIdSPNameQualifier()
682+
{
683+
$nameIdSPNameQualifier = null;
684+
$nameIdData = $this->getNameIdData();
685+
if (!empty($nameIdData) && isset($nameIdData['SPNameQualifier'])) {
686+
$nameIdSPNameQualifier = $nameIdData['SPNameQualifier'];
687+
}
688+
return $nameIdSPNameQualifier;
689+
}
690+
674691
/**
675692
* Gets the SessionNotOnOrAfter from the AuthnStatement.
676693
* Could be used to set the local session expiration

tests/src/OneLogin/Saml2/AuthTest.php

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ public function testProcessNoResponse()
120120
* @covers OneLogin_Saml2_Auth::getAttribute
121121
* @covers OneLogin_Saml2_Auth::getNameId
122122
* @covers OneLogin_Saml2_Auth::getNameIdFormat
123+
* @covers OneLogin_Saml2_Auth::getNameIdNameQualifier
124+
* @covers OneLogin_Saml2_Auth::getNameIdSPNameQualifier
123125
* @covers OneLogin_Saml2_Auth::getErrors
124126
* @covers OneLogin_Saml2_Auth::getSessionIndex
125127
* @covers OneLogin_Saml2_Auth::getSessionExpiration
@@ -136,6 +138,8 @@ public function testProcessResponseInvalid()
136138
$this->assertEmpty($this->_auth->getAttributes());
137139
$this->assertNull($this->_auth->getNameId());
138140
$this->assertNull($this->_auth->getNameIdFormat());
141+
$this->assertNull($this->_auth->getNameIdNameQualifier());
142+
$this->assertNull($this->_auth->getNameIdSPNameQualifier());
139143
$this->assertNull($this->_auth->getSessionIndex());
140144
$this->assertNull($this->_auth->getSessionExpiration());
141145
$this->assertNull($this->_auth->getAttribute('uid'));
@@ -209,6 +213,63 @@ public function testProcessResponseValid()
209213
$this->assertEquals('2655106621', $sessionExpiration);
210214
}
211215

216+
/**
217+
* Tests the getNameIdNameQualifier method of the Auth class
218+
* Case found
219+
* @covers OneLogin_Saml2_Auth::getNameIdNameQualifier
220+
*/
221+
public function testGetNameIdNameQualifier()
222+
{
223+
$message = file_get_contents(TEST_ROOT . '/data/responses/valid_response_with_namequalifier.xml.base64');
224+
$_POST['SAMLResponse'] = $message;
225+
$this->assertNull($this->_auth->getNameIdNameQualifier());
226+
$this->_auth->processResponse();
227+
$this->assertTrue($this->_auth->isAuthenticated());
228+
$this->assertEquals('https://test.example.com/saml/metadata', $this->_auth->getNameIdNameQualifier());
229+
}
230+
/**
231+
* Tests the getNameIdNameQualifier method of the Auth class
232+
* Case Null
233+
* @covers OneLogin_Saml2_Auth::getNameIdNameQualifier
234+
*/
235+
public function testGetNameIdNameQualifier2()
236+
{
237+
$message = file_get_contents(TEST_ROOT . '/data/responses/valid_response.xml.base64');
238+
$_POST['SAMLResponse'] = $message;
239+
$this->assertNull($this->_auth->getNameIdNameQualifier());
240+
$this->_auth->processResponse();
241+
$this->assertTrue($this->_auth->isAuthenticated());
242+
$this->assertNull($this->_auth->getNameIdNameQualifier());
243+
}
244+
/**
245+
* Tests the getNameIdSPNameQualifier method of the Auth class
246+
* Case Found
247+
* @covers OneLogin_Saml2_Auth::getNameIdSPNameQualifier
248+
*/
249+
public function testGetNameIdSPNameQualifier()
250+
{
251+
$message = file_get_contents(TEST_ROOT . '/data/responses/valid_response_with_namequalifier.xml.base64');
252+
$_POST['SAMLResponse'] = $message;
253+
$this->assertNull($this->_auth->getNameIdSPNameQualifier());
254+
$this->_auth->processResponse();
255+
$this->assertTrue($this->_auth->isAuthenticated());
256+
$this->assertNull($this->_auth->getNameIdSPNameQualifier());
257+
}
258+
/**
259+
* Tests the getNameIdSPNameQualifier method of the Auth class
260+
* Case Null
261+
* @covers OneLogin_Saml2_Auth::getNameIdSPNameQualifier
262+
*/
263+
public function testGetNameIdSPNameQualifier2()
264+
{
265+
$message = file_get_contents(TEST_ROOT . '/data/responses/valid_response.xml.base64');
266+
$_POST['SAMLResponse'] = $message;
267+
$this->assertNull($this->_auth->getNameIdSPNameQualifier());
268+
$this->_auth->processResponse();
269+
$this->assertTrue($this->_auth->isAuthenticated());
270+
$this->assertEquals('http://stuff.com/endpoints/metadata.php', $this->_auth->getNameIdSPNameQualifier());
271+
}
272+
212273
/**
213274
* Tests the getAttributes and getAttributesWithFriendlyName methods
214275
* @covers OneLogin_Saml2_Auth::getAttributes

tests/src/OneLogin/Saml2/LogoutRequestTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,24 @@ public function testGetNameIdData()
374374
$this->assertContains('NameID not found in the Logout Request', $e->getMessage());
375375
}
376376

377+
$logoutRequest = new OneLogin_Saml2_LogoutRequest($this->_settings, null, "ONELOGIN_1e442c129e1f822c8096086a1103c5ee2c7cae1c", null, OneLogin_Saml2_Constants::NAMEID_PERSISTENT, $this->_settings->getIdPData()['entityId'], $this->_settings->getSPData()['entityId']);
378+
$logoutRequestStr = $logoutRequest->getXML();
379+
$this->assertContains('ONELOGIN_1e442c129e1f822c8096086a1103c5ee2c7cae1c', $logoutRequestStr);
380+
$this->assertContains('Format="'.OneLogin_Saml2_Constants::NAMEID_PERSISTENT, $logoutRequestStr);
381+
$this->assertContains('NameQualifier="'.$this->_settings->getIdPData()['entityId'], $logoutRequestStr);
382+
$this->assertContains('SPNameQualifier="'.$this->_settings->getSPData()['entityId'], $logoutRequestStr);
383+
$logoutRequest2 = new OneLogin_Saml2_LogoutRequest($this->_settings, null, "ONELOGIN_1e442c129e1f822c8096086a1103c5ee2c7cae1c", null, OneLogin_Saml2_Constants::NAMEID_ENTITY, $this->_settings->getIdPData()['entityId'], $this->_settings->getSPData()['entityId']);
384+
$logoutRequestStr2 = $logoutRequest2->getXML();
385+
$this->assertContains('ONELOGIN_1e442c129e1f822c8096086a1103c5ee2c7cae1c', $logoutRequestStr2);
386+
$this->assertContains('Format="'.OneLogin_Saml2_Constants::NAMEID_ENTITY, $logoutRequestStr2);
387+
$this->assertNotContains('NameQualifier', $logoutRequestStr2);
388+
$this->assertNotContains('SPNameQualifier', $logoutRequestStr2);
389+
$logoutRequest3 = new OneLogin_Saml2_LogoutRequest($this->_settings, null, "ONELOGIN_1e442c129e1f822c8096086a1103c5ee2c7cae1c", null, OneLogin_Saml2_Constants::NAMEID_UNSPECIFIED);
390+
$logoutRequestStr3 = $logoutRequest3->getXML();
391+
$this->assertContains('ONELOGIN_1e442c129e1f822c8096086a1103c5ee2c7cae1c', $logoutRequestStr3);
392+
$this->assertNotContains('Format', $logoutRequestStr3);
393+
$this->assertNotContains('NameQualifier', $logoutRequestStr3);
394+
$this->assertNotContains('SPNameQualifier', $logoutRequestStr3);
377395
}
378396

379397
/**

tests/src/OneLogin/Saml2/ResponseTest.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,35 @@ public function testGetNameIdNameQualifier()
258258
}
259259
}
260260

261+
/**
262+
* Tests the getNameIdSPNameQualifier method of the Response
263+
*
264+
* @covers OneLogin_Saml2_Response::getNameIdSPNameQualifier
265+
*/
266+
public function testGetNameIdSPNameQualifier()
267+
{
268+
$xml = file_get_contents(TEST_ROOT . '/data/responses/response1.xml.base64');
269+
$response = new OneLogin_Saml2_Response($this->_settings, $xml);
270+
$this->assertNull($response->getNameIdSPNameQualifier());
271+
$xml2 = file_get_contents(TEST_ROOT . '/data/responses/response_encrypted_nameid.xml.base64');
272+
$response2 = new OneLogin_Saml2_Response($this->_settings, $xml2);
273+
$this->assertEquals('http://stuff.com/endpoints/metadata.php', $response2->getNameIdSPNameQualifier());
274+
$xml3 = file_get_contents(TEST_ROOT . '/data/responses/valid_encrypted_assertion.xml.base64');
275+
$response3 = new OneLogin_Saml2_Response($this->_settings, $xml3);
276+
$this->assertEquals('http://stuff.com/endpoints/metadata.php', $response3->getNameIdSPNameQualifier());
277+
$xml4 = file_get_contents(TEST_ROOT . '/data/responses/valid_response.xml.base64');
278+
$response4 = new OneLogin_Saml2_Response($this->_settings, $xml4);
279+
$this->assertEquals('http://stuff.com/endpoints/metadata.php', $response4->getNameIdSPNameQualifier());
280+
$xml5 = file_get_contents(TEST_ROOT . '/data/responses/invalids/no_nameid.xml.base64');
281+
$response5 = new OneLogin_Saml2_Response($this->_settings, $xml5);
282+
try {
283+
$nameId5 = $response5->getNameIdSPNameQualifier();
284+
$this->fail('ValidationError was not raised');
285+
} catch (OneLogin_Saml2_ValidationError $e) {
286+
$this->assertContains('NameID not found in the assertion of the Response', $e->getMessage());
287+
}
288+
}
289+
261290
/**
262291
* Tests the getNameIdData method of the OneLogin_Saml2_Response
263292
*

0 commit comments

Comments
 (0)