コード例 #1
0
<?php

/**
 * @author Shoaib Ali, Catalyst IT
 * @package simpleSAMLphp
 * @version $Id$
 */
$as = SimpleSAML_Configuration::getConfig('authsources.php')->getValue('auth2factor');
// Get session object
$session = \SimpleSAML_Session::getSessionFromRequest();
// Get the auth source so we can retrieve the URL we are ment to redirect to
$qaLogin = SimpleSAML_Auth_Source::getById('auth2factor');
// Trigger logout for the main auth source
if ($session->isValid($as['mainAuthSource'])) {
    SimpleSAML_Auth_Default::initLogout($qaLogin->getLogoutURL(), $as['mainAuthSource']);
}
コード例 #2
0
ファイル: Simple.php プロジェクト: hukumonline/yii
 /**
  * Log the user out.
  *
  * This function logs the user out. It will never return. By default,
  * it will cause a redirect to the current page after logging the user
  * out, but a different URL can be given with the $url parameter.
  *
  * @param string|NULL $url  The url the user should be redirected to after logging out.
  *                          Defaults to the current page.
  */
 public function logout($url = NULL)
 {
     assert('is_string($url) || is_null($url)');
     if ($url === NULL) {
         $url = SimpleSAML_Utilities::selfURL();
     }
     $session = SimpleSAML_Session::getInstance();
     if (!$session->isValid($this->authSource)) {
         /* Not authenticated to this authentication source. */
         SimpleSAML_Utilities::redirect($url);
         assert('FALSE');
     }
     SimpleSAML_Auth_Default::initLogout($url);
 }
コード例 #3
0
ファイル: authenticate.php プロジェクト: hukumonline/yii
<?php

$config = SimpleSAML_Configuration::getInstance();
$session = SimpleSAML_Session::getInstance();
if (array_key_exists('logout', $_REQUEST)) {
    SimpleSAML_Auth_Default::initLogout('/' . $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 (!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;
}
$as = $_REQUEST['as'];
if (!$session->isValid($as)) {
    $url = SimpleSAML_Utilities::selfURL();
    $hints = array(SimpleSAML_Auth_State::RESTART => $url);
    SimpleSAML_Auth_Default::initLogin($as, $url, $url, $hints);
}