getSessionIndex() публичный метод

Returns the SessionIndex
public getSessionIndex ( ) : string | null
Результат string | null The SessionIndex of the assertion
Пример #1
0
         $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']);
     }
 } else {
     if (isset($_GET['sls'])) {
         if (isset($_SESSION) && isset($_SESSION['LogoutRequestID'])) {
             $requestID = $_SESSION['LogoutRequestID'];
         } else {
             $requestID = null;
         }
         $auth->processSLO(false, $requestID);
         $errors = $auth->getErrors();
         if (empty($errors)) {
             print_r('<p>Sucessfully logged out</p>');
Пример #2
0
 */
session_start();
require_once dirname(dirname(__FILE__)) . '/_toolkit_loader.php';
$auth = new OneLogin_Saml2_Auth();
$auth->processResponse();
$errors = $auth->getErrors();
if (!empty($errors)) {
    print_r('<p>' . implode(', ', $errors) . '</p>');
    exit;
}
if (!$auth->isAuthenticated()) {
    echo "<p>Not authenticated</p>";
    exit;
}
$_SESSION['samlUserdata'] = $auth->getAttributes();
$_SESSION['IdPSessionIndex'] = $auth->getSessionIndex();
if (isset($_POST['RelayState']) && OneLogin_Saml2_Utils::getSelfURL() != $_POST['RelayState']) {
    $auth->redirectTo($_POST['RelayState']);
}
$attributes = $_SESSION['samlUserdata'];
if (!empty($attributes)) {
    echo '<h1>' . _('User attributes:') . '</h1>';
    echo '<table><thead><th>' . _('Name') . '</th><th>' . _('Values') . '</th></thead><tbody>';
    foreach ($attributes as $attributeName => $attributeValues) {
        echo '<tr><td>' . htmlentities($attributeName) . '</td><td><ul>';
        foreach ($attributeValues as $attributeValue) {
            echo '<li>' . htmlentities($attributeValue) . '</li>';
        }
        echo '</ul></td></tr>';
    }
    echo '</tbody></table>';