@@ -705,6 +705,8 @@ if (!$auth->isAuthenticated()) {
705705$_SESSION['samlUserdata'] = $auth->getAttributes();
706706$_SESSION['samlNameId'] = $auth->getNameId();
707707$_SESSION['samlNameIdFormat'] = $auth->getNameIdFormat();
708+ $_SESSION['samlNameidNameQualifier' = $auth->getNameIdNameQualifier();
709+ $_SESSION['samlNameidSPNameQualifier' = $auth->getNameIdSPNameQualifier();
708710$_SESSION['samlSessionIndex'] = $auth->getSessionIndex();
709711
710712if (isset($_POST['RelayState']) && OneLogin\Saml2\Utils::getSelfURL() != $_POST['RelayState']) {
@@ -932,14 +934,16 @@ $auth = new OneLogin\Saml2\Auth();
932934$auth->logout(); // Method that sent the Logout Request.
933935```
934936
935- Also there are six optional parameters that can be set:
937+ Also there are eight optional parameters that can be set:
936938* ` $returnTo ` - The target URL the user should be returned to after logout.
937939* ` $parameters ` - Extra parameters to be added to the GET.
938940* ` $name_id ` - That will be used to build the LogoutRequest. If ` name_id ` parameter is not set and the auth object processed a
939941SAML Response with a ` NameId ` , then this ` NameId ` will be used.
940942* ` $session_index ` - SessionIndex that identifies the session of the user.
941943* ` $stay ` - True if we want to stay (returns the url string) False to redirect.
942944* ` $nameIdFormat ` - The NameID Format will be set in the LogoutRequest.
945+ * ` $nameIdNameQualifier ` - The NameID NameQualifier will be set in the LogoutRequest.
946+ * ` $nameIdSPNameQualifier ` - The NameID SP NameQualifier will be set in the LogoutRequest.
943947
944948The Logout Request will be sent signed or unsigned based on the security
945949info of the ` advanced_settings.php ` (` 'logoutRequestSigned' ` ).
@@ -966,6 +970,9 @@ $paramters = array();
966970$nameId = null;
967971$sessionIndex = null;
968972$nameIdFormat = null;
973+ $nameIdNameQualifier = null;
974+ $nameIdSPNameQualifier = null;
975+
969976if (isset($_SESSION['samlNameId'])) {
970977 $nameId = $_SESSION['samlNameId'];
971978}
@@ -975,7 +982,13 @@ if (isset($_SESSION['samlSessionIndex'])) {
975982if (isset($_SESSION['samlNameIdFormat'])) {
976983 $nameIdFormat = $_SESSION['samlNameIdFormat'];
977984}
978- $auth->logout($returnTo, $paramters, $nameId, $sessionIndex, false, $nameIdFormat);
985+ if (isset($_SESSION['samlNameIdNameQualifier'])) {
986+ $nameIdNameQualifier = $_SESSION['samlNameIdNameQualifier'];
987+ }
988+ if (isset($_SESSION['samlNameIdSPNameQualifier'])) {
989+ $nameIdSPNameQualifier = $_SESSION['samlNameIdSPNameQualifier'];
990+ }
991+ $auth->logout($returnTo, $paramters, $nameId, $sessionIndex, false, $nameIdFormat, $nameIdNameQualifier, $nameIdSPNameQualifier);
979992```
980993
981994If 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.
@@ -1152,6 +1165,9 @@ Main class of OneLogin PHP Toolkit
11521165 * ` getAttributes ` - Returns the set of SAML attributes.
11531166 * ` getAttribute ` - Returns the requested SAML attribute
11541167 * ` getNameId ` - Returns the nameID
1168+ * ` getNameIdFormat ` - Gets the NameID Format provided by the SAML response from the IdP.
1169+ * ` getNameIdNameQualifier ` - Gets the NameID NameQualifier provided from the SAML Response String.
1170+ * ` getNameIdNameSPQualifier ` - Gets the NameID SP NameQualifier provided from the SAML Response String.
11551171 * ` getSessionIndex ` - Gets the SessionIndex from the AuthnStatement.
11561172 * ` getErrors ` - Returns if there were any error
11571173 * ` getSSOurl ` - Gets the SSO url.
@@ -1188,6 +1204,8 @@ SAML 2 Authentication Response class
11881204 IdP.
11891205 * ` getNameId ` - Gets the NameID provided by the SAML response from the IdP.
11901206 * ` getNameIdFormat ` - Gets the NameID Format provided by the SAML response from the IdP.
1207+ * ` getNameIdNameQualifier ` - Gets the NameID NameQualifier provided from the SAML Response String.
1208+ * ` getNameIdNameSPQualifier ` - Gets the NameID SP NameQualifier provided from the SAML Response String.
11911209 * ` getSessionNotOnOrAfter ` - Gets the SessionNotOnOrAfter from the
11921210 AuthnStatement
11931211 * ` getSessionIndex ` - Gets the SessionIndex from the AuthnStatement.
0 commit comments