本文整理汇总了PHP中SimpleSAML_Auth_Simple::logout方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleSAML_Auth_Simple::logout方法的具体用法?PHP SimpleSAML_Auth_Simple::logout怎么用?PHP SimpleSAML_Auth_Simple::logout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleSAML_Auth_Simple
的用法示例。
在下文中一共展示了SimpleSAML_Auth_Simple::logout方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: procesarFormulario
function procesarFormulario()
{
$saml_lib_path = '/var/simplesamlphp/lib/_autoload.php';
require_once $saml_lib_path;
// $aplication_base_url = 'http://10.20.0.38/splocal/';
$aplication_base_url = $this->host . $this->site . '/';
$source = 'SPcrono';
// Fuente de autenticación definida en el authsources del SP
$auth = new SimpleSAML_Auth_Simple($source);
// Se pasa como parametro la fuente de autenticación
$auth->logout($aplication_base_url . 'index.php');
return true;
}
示例2: logout
public function logout()
{
//check for application session and invalidate
if (Auth::check()) {
Auth::logout();
}
//check for sso session and invalidate
$as = new \SimpleSAML_Auth_Simple('default-sp');
if ($as->isAuthenticated()) {
$as->logout();
}
//redirect to home
return Redirect::Action('mainController@index');
}
示例3: forward
/**
* Hook on the forward function to make sure we can logout on SimpleSAML
*
* @param string $hook the name of the hook
* @param string $type the tpe of the hook
* @param bool $return_value the current url to forward to
* @param array $params supplied params
*
* @return void
*/
public static function forward($hook, $type, $return_value, $params)
{
global $SIMPLESAML_SOURCE;
if (elgg_is_logged_in() || empty($SIMPLESAML_SOURCE)) {
return;
}
// do we have a logout source
try {
$source = new \SimpleSAML_Auth_Simple($SIMPLESAML_SOURCE);
// logout of the external source
$source->logout(elgg_get_site_url());
} catch (Exception $e) {
// do nothing
}
}
示例4: handleLogoutRequest
/**
* Process a logout request.
*
* This function will never return.
*
* @param array &$state The logout request state.
* @param string|NULL $assocId The association we received the logout request from, or NULL if there was no association.
*/
public function handleLogoutRequest(array &$state, $assocId)
{
assert('isset($state["Responder"])');
assert('is_string($assocId) || is_null($assocId)');
$state['core:IdP'] = $this->id;
$state['core:TerminatedAssocId'] = $assocId;
if ($assocId !== NULL) {
$this->terminateAssociation($assocId);
}
/* Terminate the local session. */
$id = SimpleSAML_Auth_State::saveState($state, 'core:Logout:afterbridge');
$returnTo = SimpleSAML_Module::getModuleURL('core/idp/resumelogout.php', array('id' => $id));
$this->authSource->logout($returnTo);
$handler = $this->getLogoutHandler();
$handler->startLogout($state, $assocId);
assert('FALSE');
}
示例5: handleLogoutRequest
/**
* Process a logout request.
*
* This function will never return.
*
* @param array &$state The logout request state.
* @param string|null $assocId The association we received the logout request from, or null if there was no
* association.
*/
public function handleLogoutRequest(array &$state, $assocId)
{
assert('isset($state["Responder"])');
assert('is_string($assocId) || is_null($assocId)');
$state['core:IdP'] = $this->id;
$state['core:TerminatedAssocId'] = $assocId;
if ($assocId !== null) {
$this->terminateAssociation($assocId);
$session = SimpleSAML_Session::getSessionFromRequest();
$session->deleteData('core:idp-ssotime', $this->id . ':' . $state['saml:SPEntityId']);
}
// terminate the local session
$id = SimpleSAML_Auth_State::saveState($state, 'core:Logout:afterbridge');
$returnTo = SimpleSAML\Module::getModuleURL('core/idp/resumelogout.php', array('id' => $id));
$this->authSource->logout($returnTo);
$handler = $this->getLogoutHandler();
$handler->startLogout($state, $assocId);
assert('false');
}
示例6: assert
}
include_once $saml_param->samllib . '/_autoload.php';
$as = new SimpleSAML_Auth_Simple($saml_param->sp_source);
if (isset($_GET["logout"])) {
if (isset($_SERVER['SCRIPT_URI'])) {
$urltogo = $_SERVER['SCRIPT_URI'];
$urltogo = str_replace('auth/saml/index.php', '', $urltogo);
} else {
if (isset($_SERVER['HTTP_REFERER'])) {
$urltogo = $_SERVER['HTTP_REFERER'];
} else {
$urltogo = '/';
}
}
if ($saml_param->dosinglelogout) {
$as->logout($urltogo);
assert("FALSE");
// The previous line issues a redirect
} else {
header('Location: ' . $urltogo);
exit;
}
}
$as->requireAuth();
$valid_saml_session = $as->isAuthenticated();
$saml_attributes = $as->getAttributes();
} catch (Exception $e) {
session_write_close();
require_once '../../config.php';
require_once 'error.php';
global $CFG, $err, $PAGE, $OUTPUT;
示例7:
<?php
/**
* Endpoint for logging out in with an authentication source.
*
* @package simpleSAMLphp
* @version $Id$
*/
if (!isset($_REQUEST['ReturnTo']) || !is_string($_REQUEST['ReturnTo'])) {
throw new SimpleSAML_Error_BadRequest('Missing ReturnTo parameter.');
}
if (!isset($_REQUEST['AuthId']) || !is_string($_REQUEST['AuthId'])) {
throw new SimpleSAML_Error_BadRequest('Missing AuthId parameter.');
}
$as = new SimpleSAML_Auth_Simple($_REQUEST['AuthId']);
$as->logout(SimpleSAML_Utilities::checkURLAllowed($_REQUEST['ReturnTo']));
示例8: assert
<?php
$config = SimpleSAML_Configuration::getInstance();
if (!array_key_exists('as', $_REQUEST)) {
$t = new SimpleSAML_XHTML_Template($config, 'core:authsource_list.tpl.php');
$t->data['sources'] = SimpleSAML_Auth_Source::getSources();
$t->show();
exit;
}
$asId = (string) $_REQUEST['as'];
$as = new SimpleSAML_Auth_Simple($asId);
if (array_key_exists('logout', $_REQUEST)) {
$as->logout('/' . $config->getBaseURL() . 'logout.php');
}
if (array_key_exists(SimpleSAML_Auth_State::EXCEPTION_PARAM, $_REQUEST)) {
// This is just a simple example of an error
$state = SimpleSAML_Auth_State::loadExceptionState();
assert('array_key_exists(SimpleSAML_Auth_State::EXCEPTION_DATA, $state)');
$e = $state[SimpleSAML_Auth_State::EXCEPTION_DATA];
header('Content-Type: text/plain');
echo "Exception during login:\n";
foreach ($e->format() as $line) {
echo $line . "\n";
}
exit(0);
}
if (!$as->isAuthenticated()) {
$url = SimpleSAML_Module::getModuleURL('core/authenticate.php', array('as' => $asId));
$params = array('ErrorURL' => $url, 'ReturnTo' => $url);
$as->login($params);
}
示例9: simplesaml_forward_hook
/**
* Hook on the forward function to make sure we can logout on SimpleSAML
*
* @param string $hook 'forward'
* @param string $type 'system'
* @param bool $return_value the current url to forward to
* @param array $params supplied params
*
* @return void
*/
function simplesaml_forward_hook($hook, $type, $return_value, $params)
{
global $SIMPLESAML_SESSION_BACKUP;
global $SIMPLESAML_SOURCE;
if (!elgg_is_logged_in()) {
if (!empty($SIMPLESAML_SESSION_BACKUP) && !empty($SIMPLESAML_SOURCE)) {
$_SESSION["SimpleSAMLphp_SESSION"] = $SIMPLESAML_SESSION_BACKUP;
// do we have a logout source
try {
$source = new SimpleSAML_Auth_Simple($SIMPLESAML_SOURCE);
// logout of the external source
$source->logout(elgg_get_site_url());
} catch (Exception $e) {
// do nothing
}
}
}
}
示例10: assert
<?php
$config = SimpleSAML_Configuration::getInstance();
if (!array_key_exists('as', $_REQUEST)) {
$t = new SimpleSAML_XHTML_Template($config, 'core:authsource_list.tpl.php');
$t->data['sources'] = SimpleSAML_Auth_Source::getSources();
$t->show();
exit;
}
$asId = (string) $_REQUEST['as'];
$as = new SimpleSAML_Auth_Simple($asId);
if (array_key_exists('logout', $_REQUEST)) {
$as->logout($config->getBasePath() . 'logout.php');
}
if (array_key_exists(SimpleSAML_Auth_State::EXCEPTION_PARAM, $_REQUEST)) {
// This is just a simple example of an error
$state = SimpleSAML_Auth_State::loadExceptionState();
assert('array_key_exists(SimpleSAML_Auth_State::EXCEPTION_DATA, $state)');
$e = $state[SimpleSAML_Auth_State::EXCEPTION_DATA];
throw $e;
}
if (!$as->isAuthenticated()) {
$url = SimpleSAML\Module::getModuleURL('core/authenticate.php', array('as' => $asId));
$params = array('ErrorURL' => $url, 'ReturnTo' => $url);
$as->login($params);
}
$attributes = $as->getAttributes();
$t = new SimpleSAML_XHTML_Template($config, 'status.php', 'attributes');
$t->data['header'] = '{status:header_saml20_sp}';
$t->data['attributes'] = $attributes;
$t->data['nameid'] = !is_null($as->getAuthData('saml:sp:NameID')) ? $as->getAuthData('saml:sp:NameID') : false;
示例11: unset
* limitations under the License.
*/
require '../simplesamlphp/lib/_autoload.php';
session_start();
$bootstrap_cdn_css_url = '//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/css/bootstrap.min.css';
$bootstrap_cdn_js_url = '//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/js/bootstrap.min.js';
$jquery_cdn_url = '//cdnjs.cloudflare.com/ajax/libs/jquery/1.11.2/jquery.min.js';
$title = 'SimpleSAMLphp Example SAML SP';
$user_session_key = 'user_session';
$saml_sso = 'saml_sso';
// If the user is logged in and requesting a logout.
if (isset($_SESSION[$user_session_key]) && isset($_REQUEST['logout'])) {
$sp = $_SESSION[$user_session_key]['sp'];
unset($_SESSION[$user_session_key]);
$as = new SimpleSAML_Auth_Simple($sp);
$as->logout(["ReturnTo" => $_SERVER['PHP_SELF']]);
}
// If the user is logging in.
if (isset($_REQUEST[$saml_sso])) {
$sp = $_REQUEST[$saml_sso];
$as = new SimpleSAML_Auth_Simple($sp);
$as->requireAuth();
$user = array('sp' => $sp, 'authed' => $as->isAuthenticated(), 'idp' => $as->getAuthData('saml:sp:IdP'), 'nameId' => $as->getAuthData('saml:sp:NameID')['Value'], 'attributes' => $as->getAttributes());
$_SESSION[$user_session_key] = $user;
}
?>
<!DOCTYPE html>
<html>
<head>
<title><?php
示例12: Exception
}
$skipLogoutPage = $casconfig->getValue('skip_logout_page', false);
if ($skipLogoutPage && !array_key_exists('url', $_GET)) {
$message = 'Required URL query parameter [url] not provided. (CAS Server)';
SimpleSAML_Logger::debug('casserver:' . $message);
throw new Exception($message);
}
/* Load simpleSAMLphp metadata */
$as = new SimpleSAML_Auth_Simple($casconfig->getValue('authsource'));
$session = SimpleSAML_Session::getSession();
if (!is_null($session)) {
$ticketStoreConfig = $casconfig->getValue('ticketstore', array('class' => 'casserver:FileSystemTicketStore'));
$ticketStoreClass = SimpleSAML_Module::resolveClass($ticketStoreConfig['class'], 'Cas_Ticket');
$ticketStore = new $ticketStoreClass($casconfig);
$ticketStore->deleteTicket($session->getSessionId());
}
if ($as->isAuthenticated()) {
SimpleSAML_Logger::debug('casserver: performing a real logout');
if ($casconfig->getValue('skip_logout_page', false)) {
$as->logout($_GET['url']);
} else {
$as->logout(SimpleSAML\Utils\HTTP::addURLParameters(SimpleSAML_Module::getModuleURL('casserver/loggedOut.php'), array_key_exists('url', $_GET) ? array('url' => $_GET['url']) : array()));
}
} else {
SimpleSAML_Logger::debug('casserver: no session to log out of, performing redirect');
if ($casconfig->getValue('skip_logout_page', false)) {
SimpleSAML\Utils\HTTP::redirectTrustedURL(SimpleSAML\Utils\HTTP::addURLParameters($_GET['url'], array()));
} else {
SimpleSAML\Utils\HTTP::redirectTrustedURL(SimpleSAML\Utils\HTTP::addURLParameters(SimpleSAML_Module::getModuleURL('casserver/loggedOut.php'), array_key_exists('url', $_GET) ? array('url' => $_GET['url']) : array()));
}
}
示例13: array
$attribute_hash = sspmod_consent_Auth_Process_Consent::getAttributeHash($attributes, $hashAttributes);
SimpleSAML_Logger::info('consentAdmin: user: ' . $userid);
SimpleSAML_Logger::info('consentAdmin: target: ' . $targeted_id);
SimpleSAML_Logger::info('consentAdmin: attribute: ' . $attribute_hash);
/* Return values */
return array($targeted_id, $attribute_hash, $attributes);
}
// Get config object
$config = SimpleSAML_Configuration::getInstance();
$cA_config = SimpleSAML_Configuration::getConfig('module_consentAdmin.php');
$authority = $cA_config->getValue('authority');
$as = new SimpleSAML_Auth_Simple($authority);
// If request is a logout request
if (array_key_exists('logout', $_REQUEST)) {
$returnURL = $cA_config->getValue('returnURL');
$as->logout($returnURL);
}
$hashAttributes = $cA_config->getValue('attributes.hash');
/* Check if valid local session exists */
$as->requireAuth();
// Get released attributes
$attributes = $as->getAttributes();
// Get metadata storage handler
$metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
/*
* Get IdP id and metadata
*/
if ($as->getAuthData('saml:sp:IdP') !== NULL) {
/*
* From a remote idp (as bridge)
*/
示例14: ssoLogout
/**
* SSO logout and destruction of the SAML session
*/
public function ssoLogout()
{
if ($this->_sso_settings['saml_integration_type'] == self::SSO_TYPE_SAML && trim($this->_sso_settings['saml_sign_out']) == '') {
$session = \SimpleSAML_Session::getInstance();
$session->doLogout($this->_domain);
} elseif ($this->_sso_settings['saml_integration_type'] == self::SSO_TYPE_SAML || $this->_sso_settings['saml_integration_type'] == self::SSO_TYPE_LDAP) {
$as = new \SimpleSAML_Auth_Simple($this->_domain);
$as->logout('index.php');
}
return $this;
}
示例15: catch
$showFields[] = $name;
}
}
$readOnlyFields = $showFields;
$formGen = new sspmod_selfregister_XHTML_Form($formFields, 'delUser.php');
$formGen->fieldsToShow($showFields);
$formGen->setReadOnly($readOnlyFields);
$html = new SimpleSAML_XHTML_Template($config, 'selfregister:deluser.tpl.php', 'selfregister:selfregister');
if (array_key_exists('sender', $_POST)) {
try {
// Delete user object
$store->delUser($attributes[$store->userIdAttr][0]);
// Now when a User delete himself sucesfully, System log out him.
// In the future when admin delete a user a msg will be showed
// $html->data['userMessage'] = 'message_userdel';
$as->logout(SimpleSAML_Module::getModuleURL('selfregister/index.php?status=deleted'));
} catch (sspmod_selfregister_Error_UserException $e) {
// Some user error detected
$error = $html->t($e->getMesgId(), $e->getTrVars());
$html->data['error'] = htmlspecialchars($error);
}
} elseif (array_key_exists('logout', $_GET)) {
$as->logout(SimpleSAML_Module::getModuleURL('selfregister/index.php'));
} else {
// The GET access this endpoint
$values = sspmod_selfregister_Util::filterAsAttributes($attributes, $reviewAttr);
}
$formGen->setValues($values);
$formGen->setSubmitter('submit_delete');
$formHtml = $formGen->genFormHtml();
$html->data['formHtml'] = $formHtml;