@@ -28,6 +28,13 @@ class OneLogin_Saml2_Auth
2828 */
2929 private $ _nameid ;
3030
31+ /**
32+ * NameID Format
33+ *
34+ * @var string
35+ */
36+ private $ _nameidFormat ;
37+
3138 /**
3239 * If user is authenticated.
3340 *
@@ -126,6 +133,7 @@ public function processResponse($requestId = null)
126133 if ($ response ->isValid ($ requestId )) {
127134 $ this ->_attributes = $ response ->getAttributes ();
128135 $ this ->_nameid = $ response ->getNameId ();
136+ $ this ->_nameidFormat = $ response ->getNameIdFormat ();
129137 $ this ->_authenticated = true ;
130138 $ this ->_sessionIndex = $ response ->getSessionIndex ();
131139 $ this ->_sessionExpiration = $ response ->getSessionNotOnOrAfter ();
@@ -265,6 +273,16 @@ public function getNameId()
265273 return $ this ->_nameid ;
266274 }
267275
276+ /**
277+ * Returns the nameID Format
278+ *
279+ * @return string The nameID Format of the assertion
280+ */
281+ public function getNameIdFormat ()
282+ {
283+ return $ this ->_nameidFormat ;
284+ }
285+
268286 /**
269287 * Returns the SessionIndex
270288 *
@@ -369,12 +387,13 @@ public function login($returnTo = null, $parameters = array(), $forceAuthn = fal
369387 * @param string|null $nameId The NameID that will be set in the LogoutRequest.
370388 * @param string|null $sessionIndex The SessionIndex (taken from the SAML Response in the SSO process).
371389 * @param bool $stay True if we want to stay (returns the url string) False to redirect
390+ * @param string|null $nameIdFormat The NameID Format will be set in the LogoutRequest.
372391 *
373392 * @return If $stay is True, it return a string with the SLO URL + LogoutRequest + parameters
374393 *
375394 * @throws OneLogin_Saml2_Error
376395 */
377- public function logout ($ returnTo = null , $ parameters = array (), $ nameId = null , $ sessionIndex = null , $ stay =false )
396+ public function logout ($ returnTo = null , $ parameters = array (), $ nameId = null , $ sessionIndex = null , $ stay =false , $ nameIdFormat = null )
378397 {
379398 assert ('is_array($parameters) ' );
380399
@@ -390,7 +409,7 @@ public function logout($returnTo = null, $parameters = array(), $nameId = null,
390409 $ nameId = $ this ->_nameid ;
391410 }
392411
393- $ logoutRequest = new OneLogin_Saml2_LogoutRequest ($ this ->_settings , null , $ nameId , $ sessionIndex );
412+ $ logoutRequest = new OneLogin_Saml2_LogoutRequest ($ this ->_settings , null , $ nameId , $ sessionIndex, $ nameIdFormat );
394413
395414 $ this ->_lastRequestID = $ logoutRequest ->id ;
396415
0 commit comments