本文整理汇总了PHP中phpCAS::logoutWithRedirectService方法的典型用法代码示例。如果您正苦于以下问题:PHP phpCAS::logoutWithRedirectService方法的具体用法?PHP phpCAS::logoutWithRedirectService怎么用?PHP phpCAS::logoutWithRedirectService使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpCAS
的用法示例。
在下文中一共展示了phpCAS::logoutWithRedirectService方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: logout
public static function logout($parameters)
{
if (phpCAS::isAuthenticated()) {
phpCAS::logoutWithRedirectService(OC::$server->getURLGenerator()->getAbsoluteURL(""));
}
return true;
}
示例2: checkAndSetUserSession
function checkAndSetUserSession()
{
// store session data
if (!isset($_SESSION['user'])) {
$_SESSION['user'] = null;
}
if (isset($_REQUEST['login']) or isset($_REQUEST['logout'])) {
// initialize phpCAS
phpCAS::client(CAS_VERSION_2_0, 'login.kth.se', 443, '');
//phpCAS::proxy(CAS_VERSION_2_0,'login.kth.se',443,'');
phpCAS::setNoCasServerValidation();
// If you want the redirect back from the login server to enter your application by some
// specfic URL rather than just back to the current request URI, call setFixedCallbackURL.
//phpCAS::setFixedCallbackURL('http://xml.csc.kth.se/~wiiala/DM2517/project/php/index.php');
// force CAS authentication
phpCAS::forceAuthentication();
// at this step, the user has been authenticated by the CAS server
// and the user's login name can be read with phpCAS::getUser().
$_SESSION['user'] = phpCAS::getUser();
//Logga ut och redirecta till vår standardsida
if (isset($_REQUEST['logout'])) {
unset($_SESSION['user']);
phpCAS::logoutWithRedirectService('http://kth.kribba.com/');
}
}
}
示例3: logout
/**
* Logout and redirect to the main site URL,
* or to the URL passed as argument.
*/
public function logout($url = '')
{
if (empty($url)) {
$this->CI->load->helper('url');
$url = base_url();
}
phpCAS::logoutWithRedirectService($url);
}
示例4: logout
/**
* Destroy the user session
*/
public function logout()
{
$errorReporting = ini_get('error_reporting');
error_reporting($errorReporting & ~E_STRICT & ~E_NOTICE);
$this->initCasClient();
phpCAS::logoutWithRedirectService('http://' . $_SERVER['HTTP_HOST'] . url_for('/'));
// FIXME remove plain "http"
error_reporting($errorReporting);
}
示例5: signOut
public static function signOut($config, $return_url = null)
{
self::buildClient($config->get('cas-hostname'), $config->get('cas-port'), $config->get('cas-context'));
unset($_SESSION[':cas']);
if ($config->get('cas-single-sign-off')) {
if (empty($return_url)) {
phpCAS::logout();
} else {
phpCAS::logoutWithRedirectService($return_url);
}
}
}
示例6: executeLogout
public function executeLogout(sfWebRequest $request)
{
$this->getContext()->getUser()->signOut();
error_reporting(ini_get('error_reporting') & ~E_STRICT & ~E_NOTICE);
if (sfConfig::get('app_cas_server_host')) {
// Le filtre uapvSecurityFilterCas n'ayant pas forcément été déclanché
// on force l'appel phpCas::client()
phpCAS::client(sfConfig::get('app_cas_server_version', CAS_VERSION_2_0), sfConfig::get('app_cas_server_host', 'localhost'), sfConfig::get('app_cas_server_port', 443), sfConfig::get('app_cas_server_path', ''), false);
// Don't call session_start again,
// symfony already did it
// Redirection vers le CAS
phpCAS::logoutWithRedirectService($request->getParameter('redirect', $this->getContext()->getController()->genUrl('@homepage', true)));
} else {
$this->redirect('@homepage', true);
}
}
示例7: logout
/**
* Log out the user from CAS, and redirect to given URL.
*
* Note that the PHP session for the current script will be completely cleared:
* any other sesison won't be available anymore.
*
* @param string|bool $redirect
* @throws \RuntimeException
*/
public function logout($redirect = false)
{
// Destroy current session
$_SESSION = array();
if (ini_get('session.use_cookies')) {
$params = session_get_cookie_params();
setcookie(session_name(), '', time() - 42000, $params['path'], $params['domain'], $params['secure'], $params['httponly']);
}
// Log out from CAS
if (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off') {
$method = 'http';
} else {
$method = 'https';
}
if (!$redirect) {
$redirect = $this->getDomainName();
if (!$redirect) {
throw new \RuntimeException('Redirection URL automatic detection failed. You have to provide the reciredtion URL in ' . __CLASS__ . '::' . __METHOD__);
}
}
return \phpCAS::logoutWithRedirectService($method . '://' . $redirect);
}
示例8: isset
if ($bPortal) {
$sUrl .= 'portal/';
} else {
$sUrl .= 'pages/UI.php';
}
if (isset($_SESSION['auth_user'])) {
$sAuthUser = $_SESSION['auth_user'];
UserRights::Login($sAuthUser);
// Set the user's language
}
$sLoginMode = isset($_SESSION['login_mode']) ? $_SESSION['login_mode'] : '';
LoginWebPage::ResetSession();
switch ($sLoginMode) {
case 'cas':
$sCASLogoutUrl = MetaModel::GetConfig()->Get('cas_logout_redirect_service');
if (empty($sCASLogoutUrl)) {
$sCASLogoutUrl = $sUrl;
}
utils::InitCASClient();
phpCAS::logoutWithRedirectService($sCASLogoutUrl);
// Redirects to the CAS logout page
break;
}
$oPage = LoginWebPage::NewLoginWebPage();
$oPage->no_cache();
$oPage->DisplayLoginHeader();
$oPage->add("<div id=\"login\">\n");
$oPage->add("<h1>" . Dict::S('UI:LogOff:ThankYou') . "</h1>\n");
$oPage->add("<p><a href=\"{$sUrl}\">" . Dict::S('UI:LogOff:ClickHereToLoginAgain') . "</a></p>");
$oPage->add("</div>\n");
$oPage->output();
示例9: user_logout
/**
* @param string $user : username
* @param bool $remote : logged out remotely (so do not redirect)
* @param string $redir : url to redirect to. Uses home page according to prefs if empty
* @return void : redirects to suitable homepage or redir param if not remote
*/
function user_logout($user, $remote = false, $redir = '')
{
global $prefs, $logslib, $lslib, $user_cookie_site;
$logslib->add_log('login', 'logged out');
$userInfo = $this->get_user_info($user);
$this->delete_user_cookie($userInfo['userId']);
if ($remote && $prefs['feature_intertiki'] == 'y' and $prefs['feature_intertiki_sharedcookie'] == 'y' and !empty($prefs['feature_intertiki_mymaster'])) {
include_once 'XML/RPC.php';
$remote = $prefs['interlist'][$prefs['feature_intertiki_mymaster']];
$remote['path'] = preg_replace('/^\\/?/', '/', $remote['path']);
$client = new XML_RPC_Client($remote['path'], $remote['host'], $remote['port']);
$client->setDebug(0);
$msg = new XML_RPC_Message('intertiki.logout', array(new XML_RPC_Value($prefs['tiki_key'], 'string'), new XML_RPC_Value($user, 'string')));
$client->send($msg);
return;
}
// more local cleanup originally from tiki-logout.php
// go offline in Live Support
if ($prefs['feature_live_support'] == 'y') {
global $access;
include_once 'lib/live_support/lslib.php';
if ($lslib->get_operator_status($user) != 'offline') {
$lslib->set_operator_status($user, 'offline');
}
}
setcookie($user_cookie_site, '', -3600, $prefs['cookie_path'], $prefs['cookie_domain']);
/* change group home page or deactivate if no page is set */
if (!empty($redir)) {
$url = $redir;
} else {
if (($groupHome = $this->get_group_home('Anonymous')) != '') {
$url = preg_match('/^(\\/|https?:)/', $groupHome) ? $groupHome : 'tiki-index.php?page=' . $groupHome;
} else {
$url = $prefs['site_tikiIndex'];
}
}
// RFC 2616 defines that the 'Location' HTTP headerconsists of an absolute URI
if (!preg_match('/^https?\\:/i', $url)) {
global $url_scheme, $url_host, $url_port, $base_url;
$url = (preg_match('#^/#', $url) ? $url_scheme . '://' . $url_host . ($url_port != '' ? ":{$url_port}" : '') : $base_url) . $url;
}
if (SID) {
$url .= '?' . SID;
}
if ($prefs['auth_method'] === 'cas' && $user !== 'admin' && $user !== '' && $prefs['cas_force_logout'] === 'y') {
phpCAS::logoutWithRedirectService($url);
}
unset($_SESSION['cas_validation_time']);
unset($_SESSION[$user_cookie_site]);
session_unset();
session_destroy();
if ($prefs['auth_method'] === 'ws') {
header('Location: ' . str_replace('//', '//admin:@', $url));
// simulate a fake login to logout the user
} else {
header('Location: ' . $url);
}
return;
}
示例10: session_name
}
$cas_url = $cas_url . $cas_context;
// Set the session-name to be unique to the current script so that the client script
// doesn't share its session with a proxied script.
// This is just useful when running the example code, but not normally.
session_name('LinkeoPersonnalisation');
// Load the CAS lib
include_once $phpcas_path . '/CAS.php';
// Uncomment to enable debugging
phpCAS::setDebug();
// Initialize phpCAS
phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
// For production use set the CA certificate that is the issuer of the cert
// on the CAS server and uncomment the line below
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
// For quick testing you can disable SSL validation of the CAS server.
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
phpCAS::setNoCasServerValidation();
// force CAS authentication
phpCAS::forceAuthentication();
// at this step, the user has been authenticated by the CAS server
// and the user's login name can be read with phpCAS::getUser().
header("Cache-Control: no-cache, must-revalidate");
// HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
// Date in the past
if (isset($_REQUEST['logout'])) {
//phpCAS::logout();
phpCAS::logoutWithRedirectService("http://linkapi.linkeo.com");
}
示例11: DoLogout
function DoLogout()
{
//setcookie("username", "");
//setcookie("validlogin", "false");
session_destroy();
setcookie('MOD_AUTH_CAS', '', time() - 1000, '/');
if ($GLOBALS['cfg']['enablecas']) {
//phpCAS::client(CAS_VERSION_2_0, $GLOBALS['cfg']['casserver'], intval($GLOBALS['cfg']['casport']), $GLOBALS['cfg']['cascontext']);
phpCAS::logoutWithRedirectService($GLOBALS['cfg']['siteurl']);
echo "You have been logged out of NiDB through CAS. <a href='login.php'>Login</a> again.";
} else {
DisplayLogin("You have been logged out");
}
}
示例12: ini_set
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
include_once '../casconnect.php';
include_once '../dbconnect.php';
include_once '../phpfunctions.php';
$onid = phpCAS::getUser();
$res = $mysqli->query("SELECT * FROM users WHERE onid = '{$onid}'");
$userrow = $res->fetch_array(MYSQLI_ASSOC);
//keep an array of elements in the user's table for easy access
if (isset($_REQUEST['logout'])) {
phpCAS::logoutWithRedirectService('http://eecs.oregonstate.edu/education/achievements');
}
echo '<!DOCTYPE html>
<html>
<head>
<title>Collaboratory Achievement Management</title>
</head>';
?>
<!-- Bootstrap -->
<link href="../css/bootstrap.min.css" rel="stylesheet">
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="../js/bootstrap.min.js"></script>
<script src="../js/sorttable.js"></script>
示例13: cas_logout
/**
* Logs out the user of the cas
* The user MUST be logged in with cas to use this function
**/
function cas_logout()
{
//phpCAS::logoutWithRedirectService("fmc.univ-paris5.fr");
phpCAS::logoutWithRedirectService(api_get_path(WEB_PATH));
}
示例14: prelogout_hook
/**
* Logout from the CAS
*
*/
function prelogout_hook()
{
global $CFG, $USER, $DB;
if (!empty($this->config->logoutcas) && $USER->auth == $this->authtype) {
$backurl = !empty($this->config->logout_return_url) ? $this->config->logout_return_url : $CFG->wwwroot;
$this->connectCAS();
// Note: Hack to stable versions to trigger the event before it redirect to CAS logout.
$sid = session_id();
$event = \core\event\user_loggedout::create(array('userid' => $USER->id, 'objectid' => $USER->id, 'other' => array('sessionid' => $sid)));
if ($session = $DB->get_record('sessions', array('sid' => $sid))) {
$event->add_record_snapshot('sessions', $session);
}
\core\session\manager::terminate_current();
$event->trigger();
phpCAS::logoutWithRedirectService($backurl);
}
}
示例15: custom_logout
/**
* Log out of the attached external service.
*
* @return void
*/
public function custom_logout()
{
// Grab plugin settings.
$auth_settings = $this->get_plugin_options('single admin', 'allow override');
// Reset option containing old error messages.
delete_option('auth_settings_advanced_login_error');
if (session_id() == '') {
session_start();
}
$current_user_authenticated_by = get_user_meta(get_current_user_id(), 'authenticated_by', true);
// If logged in to CAS, Log out of CAS.
if ($current_user_authenticated_by === 'cas' && $auth_settings['cas'] === '1') {
if (!array_key_exists('PHPCAS_CLIENT', $GLOBALS) || !array_key_exists('phpCAS', $_SESSION)) {
// Set the CAS client configuration if it hasn't been set already.
phpCAS::client(SAML_VERSION_1_1, $auth_settings['cas_host'], intval($auth_settings['cas_port']), $auth_settings['cas_path']);
// Restrict logout request origin to the CAS server only (prevent DDOS).
phpCAS::handleLogoutRequests(true, array($auth_settings['cas_host']));
}
if (phpCAS::isAuthenticated()) {
phpCAS::logoutWithRedirectService(get_option('siteurl'));
}
}
// If session token set, log out of Google.
if ($current_user_authenticated_by === 'google' && array_key_exists('token', $_SESSION)) {
$token = json_decode($_SESSION['token'])->access_token;
// Build the Google Client.
$client = new Google_Client();
$client->setApplicationName('WordPress');
$client->setClientId($auth_settings['google_clientid']);
$client->setClientSecret($auth_settings['google_clientsecret']);
$client->setRedirectUri('postmessage');
// Revoke the token
$client->revokeToken($token);
// Remove the credentials from the user's session.
$_SESSION['token'] = '';
}
}