本文整理汇总了PHP中phpCAS::setCacheTimesForAuthRecheck方法的典型用法代码示例。如果您正苦于以下问题:PHP phpCAS::setCacheTimesForAuthRecheck方法的具体用法?PHP phpCAS::setCacheTimesForAuthRecheck怎么用?PHP phpCAS::setCacheTimesForAuthRecheck使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpCAS
的用法示例。
在下文中一共展示了phpCAS::setCacheTimesForAuthRecheck方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* Carry out sanity checks to ensure the object is
* able to operate. Set capabilities.
*
* @author Fabian Bircher <fabian@esn.org>
*/
public function __construct()
{
parent::__construct();
global $config_cascade;
global $conf;
// allow the preloading to configure other user files
if (isset($config_cascade['plaincasauth.users']) && isset($config_cascade['plaincasauth.users']['default'])) {
$this->casuserfile = $config_cascade['plaincasauth.users']['default'];
} else {
$this->casuserfile = DOKU_CONF . 'users.auth.plaincas.php';
}
$this->localuserfile = $config_cascade['plainauth.users']['default'];
// check the state of the file with the users and attempt to create it.
if (!@is_readable($this->casuserfile)) {
if (!fopen($this->casuserfile, 'w')) {
msg("plainCAS: The CAS users file could not be opened.", -1);
$this->success = false;
} elseif (!@is_readable($this->casuserfile)) {
$this->success = false;
} else {
$this->success = true;
}
// die( "bitch!" );
}
if ($this->success) {
// the users are not managable through the wiki
$this->cando['addUser'] = false;
$this->cando['delUser'] = true;
$this->cando['modLogin'] = false;
//keep this false as CAS name is constant
$this->cando['modPass'] = false;
$this->cando['modName'] = false;
$this->cando['modMail'] = false;
$this->cando['modGroups'] = false;
$this->cando['getUsers'] = true;
$this->cando['getUserCount'] = true;
$this->cando['external'] = preg_match("#(bot)|(slurp)|(netvibes)#i", $_SERVER['HTTP_USER_AGENT']) ? false : true;
//Disable CAS redirection for bots/crawlers/readers
$this->cando['login'] = true;
$this->cando['logout'] = true;
$this->cando['logoff'] = true;
// The default options which need to be set in the settins file.
$defaults = array('logFile' => NULL, 'cert' => NULL, 'cacert' => NULL, 'debug' => false, 'settings_file' => DOKU_CONF . 'plaincas.settings.php', 'defaultgroup' => $conf['defaultgroup'], 'superuser' => $conf['superuser']);
$this->_options = (array) $conf['plugin']['authplaincas'] + $defaults;
// Options are set in the configuration and have a proper default value there.
$this->_options['server'] = $this->getConf('server');
$this->_options['rootcas'] = $this->getConf('rootcas');
$this->_options['port'] = $this->getConf('port');
$this->_options['samlValidate'] = $this->getConf('samlValidate');
$this->_options['autologin'] = $this->getConf('autologinout');
// $this->getConf('autologin');
$this->_options['caslogout'] = $this->getConf('autologinout');
// $this->getConf('caslogout');
$this->_options['handlelogoutrequest'] = $this->getConf('handlelogoutrequest');
$this->_options['handlelogoutrequestTrustedHosts'] = $this->getConf('handlelogoutrequestTrustedHosts');
$this->_options['minimalgroups'] = $this->getConf('minimalgroups');
$this->_options['localusers'] = $this->getConf('localusers');
// $this->_options['defaultgroup'] = $this->getConf('defaultgroup');
// $this->_options['superuser'] = $this->getConf('superuser');
// no local users at the moment
$this->_options['localusers'] = false;
if ($this->_options['localusers'] && !@is_readable($this->localuserfile)) {
msg("plainCAS: The local users file is not readable.", -1);
$this->success = false;
}
if ($this->_getOption("logFile")) {
phpCAS::setDebug($this->_getOption("logFile"));
}
//If $conf['auth']['cas']['logFile'] exist we start phpCAS in debug mode
$server_version = CAS_VERSION_2_0;
if ($this->_getOption("samlValidate")) {
$server_version = SAML_VERSION_1_1;
}
phpCAS::client($server_version, $this->_getOption('server'), (int) $this->_getOption('port'), $this->_getOption('rootcas'), true);
//Note the last argument true, to allow phpCAS to change the session_id so he will be able to destroy the session after a CAS logout request - Enable Single Sign Out
// curl extension is needed
if (!function_exists('curl_init')) {
if ($this->_getOption('debug')) {
msg("CAS err: CURL extension not found.", -1, __LINE__, __FILE__);
}
$this->success = false;
return;
}
// automatically log the user when there is a cas session opened
if ($this->_getOption('autologin')) {
phpCAS::setCacheTimesForAuthRecheck(1);
} else {
phpCAS::setCacheTimesForAuthRecheck(-1);
}
if ($this->_getOption('cert')) {
phpCAS::setCasServerCert($this->_getOption('cert'));
} elseif ($this->_getOption('cacert')) {
//.........这里部分代码省略.........