@@ -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
758760if (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
987989SAML 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
992996The Logout Request will be sent signed or unsigned based on the security
993997info 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+
10171024if (isset($_SESSION['samlNameId'])) {
10181025 $nameId = $_SESSION['samlNameId'];
10191026}
@@ -1023,7 +1030,13 @@ if (isset($_SESSION['samlSessionIndex'])) {
10231030if (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
10291042If 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.
0 commit comments