本文整理汇总了PHP中phpCAS类的典型用法代码示例。如果您正苦于以下问题:PHP phpCAS类的具体用法?PHP phpCAS怎么用?PHP phpCAS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了phpCAS类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* This method is used to print the HTML output when the user was not authenticated.
*
* @param $client phpcas client
* @param $failure the failure that occured
* @param $cas_url the URL the CAS server was asked for
* @param $no_response the response from the CAS server (other
* parameters are ignored if TRUE)
* @param $bad_response bad response from the CAS server ($err_code
* and $err_msg ignored if TRUE)
* @param $cas_response the response of the CAS server
* @param $err_code the error code given by the CAS server
* @param $err_msg the error message given by the CAS server
*/
public function __construct($client, $failure, $cas_url, $no_response, $bad_response = '', $cas_response = '', $err_code = '', $err_msg = '')
{
phpCAS::traceBegin();
$client->printHTMLHeader($client->getString(CAS_STR_AUTHENTICATION_FAILED));
printf($client->getString(CAS_STR_YOU_WERE_NOT_AUTHENTICATED), htmlentities($client->getURL()), $_SERVER['SERVER_ADMIN']);
phpCAS::trace('CAS URL: ' . $cas_url);
phpCAS::trace('Authentication failure: ' . $failure);
if ($no_response) {
phpCAS::trace('Reason: no response from the CAS server');
} else {
if ($bad_response) {
phpCAS::trace('Reason: bad response from the CAS server');
} else {
switch ($client->getServerVersion()) {
case CAS_VERSION_1_0:
phpCAS::trace('Reason: CAS error');
break;
case CAS_VERSION_2_0:
if (empty($err_code)) {
phpCAS::trace('Reason: no CAS error');
} else {
phpCAS::trace('Reason: [' . $err_code . '] CAS error: ' . $err_msg);
}
break;
}
}
phpCAS::trace('CAS response: ' . $cas_response);
}
$client->printHTMLFooter();
phpCAS::traceExit();
}
开发者ID:adamfranco,项目名称:phpcas-old-svn-tracking,代码行数:45,代码来源:AuthenticationException.php
示例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/');
}
}
}
开发者ID:guuurris,项目名称:skolprojektOchLabbar,代码行数:26,代码来源:index.php
示例3: forceAuth
function forceAuth()
{
if (!phpCAS::isAuthenticated()) {
// If they're not currently logged in, take them to the RPI CAS page
phpCAS::forceAuthentication();
}
}
开发者ID:justetz,项目名称:SlateCrate,代码行数:7,代码来源:functions.php
示例4: main
/**
* [Put your description here]
*/
function main($content, $conf)
{
$this->conf = $conf;
$this->pi_setPiVarDefaults();
$this->pi_USER_INT_obj = 1;
// Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it's a USER_INT object!
$this->pi_loadLL();
$this->typeExecution = "prod";
$urlCas = "none";
$portCas = "none";
if ($this->typeExecution == "dev") {
$urlCas = "xinf-devlinux.intranet.haras-nationaux.fr";
$portCas = 7777;
} else {
if ($this->typeExecution == "prod") {
$urlCas = "cerbere.haras-nationaux.fr";
$portCas = 443;
}
}
session_start();
if (isset($_GET["action"]) && $_GET["action"] == "disconnect") {
phpCAS::setDebug();
phpCAS::client(CAS_VERSION_2_0, $urlCas, $portCas, 'cas', 'true');
$ur = phpCAS::getServerLogoutURL();
phpCAS::killSession();
//Suppression de la sesssion de harasire
setcookie("netid", "", time() - 3600, "/", ".haras-nationaux.fr");
//$urCid = "http://www4.haras-nationaux.fr/cid-internet-web/InvalidateSessionServlet?service=".$ur;
$content .= '<IFRAME src="' . $ur . '" frameborder="no" height="600" width="670"></IFRAME>';
return $this->pi_wrapInBaseClass($content);
}
}
开发者ID:BackupTheBerlios,项目名称:stypo3dext,代码行数:35,代码来源:class.tx_dlcube04CAS_pi7.php
示例5: getAttributes
function getAttributes()
{
if (phpCAS::isAuthenticated()) {
return phpCAS::getAttributes();
}
return null;
}
开发者ID:hharchani,项目名称:felicity16-website,代码行数:7,代码来源:cas_lib.php
示例6: execute
public function execute($filterChain)
{
$user = $this->getContext()->getUser();
// We put an LDAP object in the context in order to reuse it later
$this->getContext()->set('ldap', new uapvLdap());
// Filters can be called several times (because of internal forwards)
// Authentication is only done the first time
if ($this->isFirstCall() && (sfConfig::get('app_cas_server_force_authentication', false) || !$user->isAuthenticated())) {
// phpCAS is not php5-compliant, we remove php warnings and strict errors
$errorReporting = ini_get('error_reporting');
error_reporting($errorReporting & ~E_STRICT & ~E_NOTICE);
if (sfConfig::get('app_cas_server_debug', false)) {
phpCAS::setDebug();
}
// see /tmp/phpCAS.log
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
//phpCAS::handleLogoutRequests ();
phpCAS::setNoCasServerValidation();
phpCAS::forceAuthentication();
// if necessary the user will be
// redirected to the cas server
// At this point the user is authenticated, we log him in
$user->signIn(phpCAS::getUser());
// Previous settings can now be restored
error_reporting($errorReporting);
}
// "credential" verification
parent::execute($filterChain);
}
开发者ID:ArnaudD,项目名称:RdvZ,代码行数:31,代码来源:uapvSecurityFilterCas.class.php
示例7: __construct
public function __construct()
{
$this->attr = phpCAS::getAttributes();
$this->attr['username'] = phpCAS::getUser();
$this->id = $this->attr['user_id'];
unset($this->attr['sequence_token']);
}
开发者ID:nitroxy,项目名称:nxauth,代码行数:7,代码来源:NXUser.php
示例8: force_login
function force_login()
{
if (!isset($GLOBALS['PHPCAS_CLIENT'])) {
check_auth();
}
phpCAS::forceAuthentication();
}
开发者ID:niclush2009,项目名称:DBLS,代码行数:7,代码来源:core_functions.php
示例9: get_login
public function get_login()
{
Logger::debug('main', 'AuthMethod_CAS::get_login()');
if (!isset($_SESSION['backup_sso']) || !is_array($_SESSION['backup_sso'])) {
$_SESSION['backup_sso'] = array();
}
foreach ($_REQUEST as $k => $v) {
$_SESSION['backup_sso'][$k] = $v;
}
$buf = $this->prefs->get('AuthMethod', 'CAS');
$CAS_server_url = $buf['user_authenticate_cas_server_url'];
if (!isset($CAS_server_url) || $CAS_server_url == '') {
Logger::error('main', 'AuthMethod_CAS::get_login() - Unable to find CAS server url in Preferences');
return NULL;
}
phpCAS::client(CAS_VERSION_2_0, parse_url($CAS_server_url, PHP_URL_HOST), parse_url($CAS_server_url, PHP_URL_PORT), parse_url($CAS_server_url, PHP_URL_PATH));
Logger::debug('main', 'AuthMethod_CAS::get_login() - Parsing URL - Host:"' . parse_url($CAS_server_url, PHP_URL_HOST) . '" Port:"' . parse_url($CAS_server_url, PHP_URL_PORT) . '" Path:"' . parse_url($CAS_server_url, PHP_URL_PATH) . '"');
phpCAS::setNoCasServerValidation();
if (!phpCAS::forceAuthentication()) {
Logger::error('main', 'AuthMethod_CAS::get_login() - phpCAS::forceAuthentication failed');
return NULL;
}
if (!phpCAS::isAuthenticated()) {
Logger::error('main', 'AuthMethod_CAS::get_login() - phpCAS::isAuthenticated failed');
return NULL;
}
$this->login = phpCAS::getUser();
foreach ($_SESSION['backup_sso'] as $k => $v) {
if (isset($_REQUEST[$k])) {
continue;
}
$_REQUEST[$k] = $v;
}
return $this->login;
}
开发者ID:skdong,项目名称:nfs-ovd,代码行数:35,代码来源:CAS.php
示例10: metodillo
function metodillo()
{
$sSQL = "SELECT * FROM PM_PARAMETERS WHERE PRM_ID = 'CAS_URL' ";
$aResSQL = executeQuery($sSQL);
if (count($aResSQL)) {
$sURL = $aResSQL[1]['PRM_VALUE'];
$sURI = $aResSQL[1]['PRM_VALUE_2'];
$res = false;
$RBAC = RBAC::getSingleton();
$RBAC->initRBAC();
require_once 'CAS-1.2.2/CAS.php';
phpCAS::client(CAS_VERSION_2_0, $sURL, 443, $sURI, false);
phpCAS::setNoCasServerValidation();
phpCAS::forceAuthentication();
if (phpCAS::isAuthenticated() == true) {
$sCasUser = phpCAS::getUser();
$sSQL = "SELECT USR_UID FROM USERS WHERE USR_USERNAME = '{$sCasUser}' ";
$aResSQL = executeQuery($sSQL);
if (count($aResSQL)) {
$nUserId = $aResSQL[1]['USR_UID'];
$RBAC->singleSignOn = true;
$RBAC->userObj->fields['USR_UID'] = $nUserId;
$RBAC->userObj->fields['USR_USERNAME'] = $sCasUser;
$res = true;
} else {
$res = false;
}
} else {
$res = false;
}
} else {
$res = false;
}
return $res;
}
开发者ID:juantroche,项目名称:pmos-cas,代码行数:35,代码来源:class.cas2.php
示例11: logout
public static function logout($parameters)
{
if (phpCAS::isAuthenticated()) {
phpCAS::logoutWithRedirectService(OC::$server->getURLGenerator()->getAbsoluteURL(""));
}
return true;
}
开发者ID:Karamaz0V1,项目名称:user_minimalcas,代码行数:7,代码来源:hooks.php
示例12: index
/**
* Attempts to authenticate users via CAS
*/
public function index()
{
// If they don't have CAS configured, send them onto the application's
// internal authentication system
if (!defined('CAS')) {
header('Location: ' . BASE_URL . '/login/login?return_url=' . $this->return_url);
exit;
}
require_once CAS . '/CAS.php';
\phpCAS::client(CAS_VERSION_2_0, CAS_SERVER, 443, CAS_URI, false);
\phpCAS::setNoCasServerValidation();
\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().
// They may be authenticated according to CAS,
// but that doesn't mean they have person record
// and even if they have a person record, they may not
// have a user account for that person record.
try {
$_SESSION['USER'] = new Person(\phpCAS::getUser());
header("Location: {$this->return_url}");
exit;
} catch (\Exception $e) {
$_SESSION['errorMessages'][] = $e;
}
$this->template->blocks[] = new Block('loginForm.inc', array('return_url' => $this->return_url));
}
开发者ID:CodeForEindhoven,项目名称:uReport,代码行数:30,代码来源:LoginController.php
示例13: collect
/**
* Collect any tokens that the user may have supplied. Reply NULL if none
* are found.
*
* @return mixed
* @access public
* @since 3/16/05
*/
function collect()
{
if (phpCAS::isAuthenticated()) {
return phpCAS::getUser();
} else {
return null;
}
}
开发者ID:adamfranco,项目名称:harmoni,代码行数:16,代码来源:CasTokenCollector.class.php
示例14: setName
private function setName()
{
if ($this->config->get('cas-name-attribute-key') !== null && phpCAS::hasAttribute($this->config->get('cas-name-attribute-key'))) {
$_SESSION[':cas']['name'] = phpCAS::getAttribute($this->config->get('cas-name-attribute-key'));
} else {
$_SESSION[':cas']['name'] = $this->getUser();
}
}
开发者ID:bpalme,项目名称:osTicket-auth-cas,代码行数:8,代码来源:cas.php
示例15: loginCallback
public function loginCallback()
{
$attributes = phpCAS::getAttributes();
$this->updateLocalUserFromBackend($attributes);
$usr_id = User::getUserIDByEmail($attributes['mail'], true);
$user = User::getDetails($usr_id);
Auth::createLoginCookie(APP_COOKIE, $user['usr_email'], true);
}
开发者ID:korusdipl,项目名称:eventum,代码行数:8,代码来源:class.cas_auth_backend.php
示例16: checkPassword
public function checkPassword($uid, $password)
{
if (!phpCAS::isAuthenticated()) {
return false;
}
$uid = phpCAS::getUser();
return $uid;
}
开发者ID:anolisti,项目名称:apps,代码行数:8,代码来源:user_cas.php
示例17: logout
public function logout()
{
$curruser = $this->session->userdata("curruser");
if ($curruser) {
$this->session->sess_destroy();
}
phpCAS::logout();
}
开发者ID:sdgdsffdsfff,项目名称:stplatform,代码行数:8,代码来源:MY_Controller.php
示例18: __construct
public function __construct()
{
\phpCAS::setDebug();
\phpCAS::client(CAS_VERSION_2_0, "itebeta.baidu.com", 443, "");
\phpCAS::setNoCasServerValidation();
\phpCAS::forceAuthentication();
$this->username = \phpCAS::getUser();
}
开发者ID:sayi21cn,项目名称:Atomu,代码行数:8,代码来源:Uuap.class.php
示例19: modelAttributes
public static function modelAttributes()
{
$userInfo = array_combine(array('username', 'email', 'user_id'), explode('|', \phpCAS::getUser()));
$casInfo = array_change_key_case(array_map('urldecode', \phpCAS::getAttributes()), CASE_LOWER);
$casInfo['realname'] = $casInfo['username'];
unset($casInfo['useraccountcontrol'], $casInfo['usernum'], $casInfo['useremail']);
$return = array_merge($casInfo, $userInfo);
return $return;
}
开发者ID:oyoy8629,项目名称:yii-core,代码行数:9,代码来源:phpCas.php
示例20: index
/**
* Logs the user out / destroys the CAS session
*/
public function index()
{
if (\phpCAS::checkAuthentication()) {
\phpCAS::logout();
}
session_destroy();
header("Location: /landing");
return;
}
开发者ID:byu-oit-ssengineering,项目名称:team-managment-tool,代码行数:12,代码来源:logout.php
注:本文中的phpCAS类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论