Process the SAML Response sent by the IdP.
public processResponse ( string | null $requestId = null ) | ||
$requestId | string | null | The ID of the AuthNRequest sent by this SP to the IdP |
} else { if (isset($_GET['slo'])) { $returnTo = null; $paramters = array(); $nameId = null; $sessionIndex = null; if (isset($_SESSION['samlNameId'])) { $nameId = $_SESSION['samlNameId']; } if (isset($_SESSION['samlSessionIndex'])) { $sessionIndex = $_SESSION['samlSessionIndex']; } $auth->logout($returnTo, $paramters, $nameId, $sessionIndex); } else { if (isset($_GET['acs'])) { $auth->processResponse(); return; $errors = $auth->getErrors(); if (!empty($errors)) { print_r('<p>1' . implode(', ', $errors) . '</p>'); } if (!$auth->isAuthenticated()) { echo "<p>2 Not authenticated</p>"; exit; } $_SESSION['samlUserdata'] = $auth->getAttributes(); $_SESSION['samlNameId'] = $auth->getNameId(); $_SESSION['samlSessionIndex'] = $auth->getSessionIndex(); if (isset($_POST['RelayState']) && OneLogin_Saml2_Utils::getSelfURL() != $_POST['RelayState']) { $auth->redirectTo($_POST['RelayState']); }
$auth->logout($returnTo, $paramters, $nameId, $sessionIndex); # If LogoutRequest ID need to be saved in order to later validate it, do instead # $sloBuiltUrl = $auth->logout(null, $paramters, $nameId, $sessionIndex, true); # $_SESSION['LogoutRequestID'] = $auth->getLastRequestID(); # header('Pragma: no-cache'); # header('Cache-Control: no-cache, must-revalidate'); # header('Location: ' . $sloBuiltUrl); # exit(); } else { if (isset($_GET['acs'])) { if (isset($_SESSION) && isset($_SESSION['AuthNRequestID'])) { $requestID = $_SESSION['AuthNRequestID']; } else { $requestID = null; } $auth->processResponse($requestID); $errors = $auth->getErrors(); if (!empty($errors)) { print_r('<p>' . implode(', ', $errors) . '</p>'); } if (!$auth->isAuthenticated()) { echo "<p>Not authenticated</p>"; exit; } $_SESSION['samlUserdata'] = $auth->getAttributes(); $_SESSION['samlNameId'] = $auth->getNameId(); $_SESSION['samlSessionIndex'] = $auth->getSessionIndex(); unset($_SESSION['AuthNRequestID']); if (isset($_POST['RelayState']) && OneLogin_Saml2_Utils::getSelfURL() != $_POST['RelayState']) { $auth->redirectTo($_POST['RelayState']); }
/** * Call the processResponse method on OneLogin_Saml2_Auth. */ public function processResponse() { $this->instance->processResponse(); }