Пример #1
0
/**
* Logout function
*/
function logout_josso(&$user, &$new_session)
{
    if (isset($_SESSION["OPTIONAL_LOGIN_EXECUTED"])) {
        unset($_SESSION["OPTIONAL_LOGIN_EXECUTED"]);
    }
    if (isset($_SESSION["JOSSO_AUTOMATIC_LOGIN_EXECUTED"])) {
        unset($_SESSION["JOSSO_AUTOMATIC_LOGIN_EXECUTED"]);
    }
    if (isset($_SESSION["JOSSO_AUTOMATIC_LOGIN_REFERER"])) {
        unset($_SESSION["JOSSO_AUTOMATIC_LOGIN_REFERER"]);
    }
    forceRedirect(jossoCreateLogoutUrl(null));
}
Пример #2
0
    echo 'Username : '******'<br><br>';
    // Get a specific user property
    echo 'user.name=' . $user->getProperty('user.name') . '<br><br>';
    // Get all user properties
    $properties = $user->getProperties();
    if (is_array($properties)) {
        foreach ($properties as $property) {
            echo $property['!name'] . '=' . $property['!value'] . '<br>';
        }
    }
    // Get all user roles
    $roles = $josso_agent->findRolesBySSOSessionId($sessionId);
    echo '<h2>Roles</h2>';
    foreach ($roles as $role) {
        echo $role->getName() . '<br>';
    }
    // Check if user belongs to a specific role
    if ($josso_agent->isUserInRole('role1')) {
        echo '<h3>user is in role1</h3>';
    }
    echo 'Click <a href="' . jossoCreateLogoutUrl(null) . '">here</a> to logout ...<br>';
    echo '<p>SSO Session ID : ' . $sessionId . '</p>';
} else {
    // User is unknown..
    echo '<h2>you are an annonymous user ...</h2>';
    echo 'Click <a href="' . jossoCreateLoginUrl() . '">here</a> to login ...';
}
?>

</body>
</html>