本文整理汇总了PHP中phpCAS::setFixedServiceURL方法的典型用法代码示例。如果您正苦于以下问题:PHP phpCAS::setFixedServiceURL方法的具体用法?PHP phpCAS::setFixedServiceURL怎么用?PHP phpCAS::setFixedServiceURL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpCAS
的用法示例。
在下文中一共展示了phpCAS::setFixedServiceURL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toggle_auth_checked_in_redirect
function toggle_auth_checked_in_redirect()
{
$url = phpCAS::getServiceURL();
$without_auth_checked = removeParameterFromUrl('auth_checked', $url);
if ($url == $without_auth_checked) {
$url .= (strpos($url, '?') === false ? '?' : '&') . 'auth_checked=true';
} else {
$url = $without_auth_checked;
debug_msg("removing auth_checked from url to have a clean final url: {$url}");
}
phpCAS::setFixedServiceURL($url);
}
示例2: initializeCASClient
protected function initializeCASClient()
{
if (!phpCAS::isInitialized()) {
// Set debug mode
phpCAS::setDebug(false);
//Initialize phpCAS
phpCAS::client(CAS_VERSION_2_0, Configure::read('user_config.cas.hostname'), Configure::read('user_config.cas.port'), Configure::read('user_config.cas.uri'), true);
phpCAS::setFixedServiceURL($this->loginRedirectURL());
// No SSL validation for the CAS server
phpCAS::setNoCasServerValidation();
}
return true;
}
示例3: InitCAS
public static function InitCAS()
{
if (!self::$_InitCAS) {
$aliasName = OCP\Config::getAppValue('user_cas', 'cas_aliasName', '');
$casVersion = OCP\Config::getAppValue('user_cas', 'cas_server_version', '2.0');
$casHostname = OCP\Config::getAppValue('user_cas', 'cas_server_hostname', 'ident.domain.fr');
$casPort = OCP\Config::getAppValue('user_cas', 'cas_server_port', '443');
$casPath = OCP\Config::getAppValue('user_cas', 'cas_server_path', '/cas');
phpCAS::client($casVersion, $casHostname, (int) $casPort, $casPath, false);
if ($aliasName) {
phpCAS::setFixedServiceURL($aliasName);
}
phpCAS::setNoCasServerValidation();
self::$_InitCAS = true;
}
return self::$_InitCAS;
}
示例4: triggerAuth
public function triggerAuth($service_url = null)
{
self::buildClient($this->config->get('cas-hostname'), $this->config->get('cas-port'), $this->config->get('cas-context'));
// Force set the CAS service URL to the osTicket login page.
if ($service_url) {
phpCAS::setFixedServiceURL($service_url);
}
// Verify the CAS server's certificate, if configured.
if ($this->config->get('cas-ca-cert-path')) {
phpCAS::setCasServerCACert($this->config->get('cas-ca-cert-path'));
} else {
phpCAS::setNoCasServerValidation();
}
// Trigger authentication and set the user fields when validated.
if (!phpCAS::isAuthenticated()) {
phpCAS::forceAuthentication();
} else {
$this->setUser();
$this->setEmail();
$this->setName();
}
}
示例5: sprintf
<?php
include_once 'phpCAS/CAS.php';
phpCAS::setDebug("/tmp/cas.log");
phpCAS::client(CAS_VERSION_2_0, 'fed.princeton.edu', 443, 'cas');
// force CAS authentication
phpCAS::setNoCasServerValidation();
phpCAS::setFixedServiceURL(BASE_URL . "admin");
if (!phpCAS::checkAuthentication()) {
phpCAS::forceAuthentication();
}
if (isset($_REQUEST['logout'])) {
phpCAS::logout();
}
$loginUsername = phpCAS::getUser();
//$loginUsername = "abarrera";
#mysql_select_db($database_Locator, $Locator);
$LoginRS__query = sprintf("SELECT username_usr, level_usr FROM lctr_User_usr WHERE username_usr='%s'", get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername));
$LoginRS = $dbconnects["stage"]->query($LoginRS__query) or die(mysql_error());
$loginFoundUser = $LoginRS->num_rows;
if (!$loginFoundUser) {
header("Location: denied.php");
}
示例6: RWSPCReqs
//.........这里部分代码省略.........
list($r_v1, $r_v2, $r_v3) = explode(".", phpCAS::getVersion());
$r_csp->connectCAS();
if ($r_rwc == "1") {
if (isset($r_tkt)) {
RWSRHXml();
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
echo "<rwscas>\r\n";
echo "\t<st>";
echo utf8_encode(htmlspecialchars(trim($r_tkt)));
echo "\t</st>\r\n";
echo "</rwscas>\r\n";
exit;
} else {
if ($_SERVER['REQUEST_METHOD'] == "GET") {
$r_ok = phpCAS::checkAuthentication();
if (!isset($r_rwu)) {
$r_rwu = phpCAS::getUser();
}
if (!isset($r_rwp)) {
$r_rwp = "passwdCas";
}
RWSLIMUser($r_rwu, $r_rwp, $r_ok);
} else {
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$r_psd = urldecode(file_get_contents("php://input"));
if (stripos($r_psd, "<samlp:LogoutRequest ") !== false) {
RWSAOLog();
}
}
}
}
} else {
if ($r_rwc == "2") {
if (isset($r_pid) && isset($r_piou)) {
if ($r_csp->config->proxycas) {
phpCAS::checkAuthentication();
}
} else {
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$r_psd = urldecode(file_get_contents("php://input"));
if (stripos($r_psd, "<samlp:LogoutRequest ") !== false) {
RWSAOLog();
}
}
}
} else {
if ($r_rwc == "3") {
if (isset($r_tkt)) {
if (strlen($RWSCRURL) > 0) {
$r_svu = $RWSCRURL;
} else {
$r_svu = RWSGSUrl(false, false);
}
$r_svu .= "?rwscas=1";
if (isset($r_ver)) {
$r_svu .= "&version=";
$r_svu .= urlencode($r_ver);
}
if (isset($r_rwu)) {
$r_svu .= "&rwsuser=";
$r_svu .= urlencode($r_rwu);
}
if (isset($r_rwp)) {
$r_svu .= "&rwspass=";
$r_svu .= urlencode($r_rwp);
}
phpCAS::setFixedServiceURL($r_svu);
if ($r_csp->config->proxycas) {
if (strlen($RWSCRURL) > 0) {
$r_cbu = $RWSCRURL;
} else {
$r_cbu = RWSGSUrl(true, false);
}
$r_cbu .= "?rwscas=2";
if (isset($r_ver)) {
$r_cbu .= "&version=";
$r_cbu .= urlencode($r_ver);
}
if (isset($r_rwu)) {
$r_cbu .= "&rwsuser=";
$r_cbu .= urlencode($r_rwu);
}
if (isset($r_rwp)) {
$r_cbu .= "&rwspass=";
$r_cbu .= urlencode($r_rwp);
}
phpCAS::setFixedCallbackURL($r_cbu);
}
if (phpCAS::checkAuthentication()) {
exit;
}
if (isset($r_rwu) && isset($r_rwp)) {
RWSLIMUser($r_rwu, $r_rwp, true);
}
}
}
}
}
RWSSErr("2008");
}
示例7: initialized_php_cas
public static function initialized_php_cas()
{
if (!self::$_initialized_php_cas) {
$casVersion = OCP\Config::getAppValue('user_cas', 'cas_server_version', '2.0');
$casHostname = OCP\Config::getAppValue('user_cas', 'cas_server_hostname', $_SERVER['SERVER_NAME']);
$casPort = OCP\Config::getAppValue('user_cas', 'cas_server_port', 443);
$casPath = OCP\Config::getAppValue('user_cas', 'cas_server_path', '/cas');
$casDebugFile = OCP\Config::getAppValue('user_cas', 'cas_debug_file', '');
$casCertPath = OCP\Config::getAppValue('user_cas', 'cas_cert_path', '');
$php_cas_path = OCP\Config::getAppValue('user_cas', 'cas_php_cas_path', 'CAS.php');
$cas_service_url = OCP\Config::getAppValue('user_cas', 'cas_service_url', '');
if (!class_exists('phpCAS')) {
if (empty($php_cas_path)) {
$php_cas_path = 'CAS.php';
}
\OCP\Util::writeLog('cas', "Try to load phpCAS library ({$php_cas_path})", \OCP\Util::DEBUG);
include_once $php_cas_path;
if (!class_exists('phpCAS')) {
\OCP\Util::writeLog('cas', 'Fail to load phpCAS library !', \OCP\Util::ERROR);
return false;
}
}
if ($casDebugFile !== '') {
phpCAS::setDebug($casDebugFile);
}
phpCAS::client($casVersion, $casHostname, (int) $casPort, $casPath, false);
if (!empty($cas_service_url)) {
phpCAS::setFixedServiceURL($cas_service_url);
}
if (!empty($casCertPath)) {
phpCAS::setCasServerCACert($casCertPath);
} else {
phpCAS::setNoCasServerValidation();
}
self::$_initialized_php_cas = true;
}
return self::$_initialized_php_cas;
}
示例8: cas_init
/**
* Initialize CAS client
*
*/
private function cas_init() {
if (!$this->cas_inited) {
// retrieve configurations
$cfg = rcmail::get_instance()->config->all();
// include phpCAS
require_once('/usr/share/php/CAS/CAS.php');
phpCAS::setDebug('/var/log/lcs/casdebug.log');
// initialize CAS client
if ($cfg['cas_proxy']) {
phpCAS::proxy(CAS_VERSION_2_0, $cfg['cas_hostname'], $cfg['cas_port'], $cfg['cas_uri'], false);
// set URL for PGT callback
phpCAS::setFixedCallbackURL($this->generate_url(array('action' => 'pgtcallback')));
// set PGT storage
#phpCAS::setPGTStorageFile('xml', $cfg['cas_pgt_dir']);
phpCAS::setPGTStorageFile($cfg['cas_pgt_dir']);
}
else {
phpCAS::client(CAS_VERSION_2_0, $cfg['cas_hostname'], $cfg['cas_port'], $cfg['cas_uri'], false);
}
// set service URL for authorization with CAS server
phpCAS::setFixedServiceURL($this->generate_url(array('action' => 'login', 'task' => 'mail')));
// set SSL validation for the CAS server
if ($cfg['cas_validation'] == 'self') {
phpCAS::setCasServerCert($cfg['cas_cert']);
}
else if ($cfg['cas_validation'] == 'ca') {
phpCAS::setCasServerCACert($cfg['cas_cert']);
}
else {
phpCAS::setNoCasServerValidation();
}
// set login and logout URLs of the CAS server
phpCAS::setServerLoginURL($cfg['cas_login_url']);
phpCAS::setServerLogoutURL($cfg['cas_logout_url']);
$this->cas_inited = true;
}
}
示例9: __buildAuth
function __buildAuth()
{
if (!is_object($this->db)) {
require_once "./Services/Database/classes/class.ilDBWrapperFactory.php";
$ilDB = ilDBWrapperFactory::getWrapper();
$ilDB->initFromIniFile();
$ilDB->connect();
$this->db = $ilDB;
}
$GLOBALS["ilDB"] = $this->db;
$this->init->initSettings();
$this->init->buildHTTPPath();
include_once './Services/Administration/classes/class.ilSetting.php';
$set = new ilSetting();
/*$query = "SELECT * FROM sett ings WHERE ".
" keyword = ".$this->db->quote("cas_server")." OR ".
" keyword = ".$this->db->quote("cas_port")." OR ".
" keyword = ".$this->db->quote("cas_uri");
$res = $this->db->query($query);
$cas_set = array();
while ($rec = $res->fetchRow(DB_FETCHMODE_ASSOC))
{
$cas_set[$rec["keyword"]] = $rec["value"];
}*/
$cas_set["cas_server"] = $set->get("cas_server");
$cas_set["cas_port"] = $set->get("cas_port");
$cas_set["cas_uri"] = $set->get("cas_uri");
$auth_params = array("server_version" => CAS_VERSION_2_0, "server_hostname" => $cas_set["cas_server"], "server_port" => $cas_set["cas_port"], "server_uri" => $cas_set["cas_uri"]);
include_once "Services/CAS/classes/class.ilCASAuth.php";
$this->auth = new ilCASAuth($auth_params);
// HTTP path will return full path to server.php directory
phpCAS::setFixedServiceURL(ILIAS_HTTP_PATH . "/webservice/soap/server.php");
return true;
}
示例10: logIn
public function logIn()
{
global $QUERY;
$login_url = DOKU_URL . 'doku.php?id=' . $QUERY;
phpCAS::setFixedServiceURL($login_url);
phpCAS::forceAuthentication();
}
示例11: display
/**
* Method to setup Purdue CAS params and redirect to pucas auth URL
*
* @param object $view view object
* @param object $tpl template object
* @return void
*/
public function display($view, $tpl)
{
if (Config::get('debug')) {
$debug_location = $this->params->get('debug_location', '/var/log/apache2/php/phpCAS.log');
phpCAS::setDebug($debug_location);
}
$this->initialize();
$return = '';
if ($view->return) {
$return = '&return=' . $view->return;
}
if ($this->isBoilerkeyRequired()) {
$loginUrl = 'https://www.purdue.edu/apps/account/cas/login?boilerkeyRequired=true&service=';
$loginUrl .= urlencode(self::getRedirectUri('pucas') . $return);
phpCAS::setServerLoginURL($loginUrl);
} else {
phpCAS::setFixedServiceURL(self::getRedirectUri('pucas') . $return);
}
phpCAS::forceAuthentication();
App::redirect(self::getRedirectUri('pucas') . $return);
}
示例12: setFixedServiceURL
public function setFixedServiceURL($url)
{
\phpCAS::setFixedServiceURL($url);
}
示例13:
<body>
Authenticating with CAS, please wait...
</body>
<script>
//-------------------- PHPCAS SECTION ----------------------------
<?php
require_once '../resources/CASAuthentication/CAS.php';
//PHPCAS Library Import
phpCAS::client(CAS_VERSION_2_0, 'cas.byu.edu', 443, '/cas');
//Setup the phpCAS client
//------------------------------------------------------------
phpCAS::setNoCasServerValidation();
//Don't validate with SSL
$url = 'http://128.187.104.23:1337/demeter/CASLogic.php';
//Return url after validation
phpCAS::setFixedServiceURL($url);
//Set the return URL
if (isset($_REQUEST['logout'])) {
//If wanting to log out
echo "Logging Out.";
$_SESSION['AUTH'] = false;
//Make user unable to call backend functions
$_SESSION['AUTH_USER'] = '';
//Removed stored user
$url = "http://128.187.104.23:1337/demeter/index.html";
//url to return to after completion
phpCAS::logoutWithRedirectServiceAndUrl($url, '');
//set return url
} else {
$auth = phpCAS::checkAuthentication();
//Go to CAS and verify
示例14: iniciar_pedido_cas
protected function iniciar_pedido_cas()
{
$this->instanciar_cliente_cas();
phpCAS::setExtraCurlOption(CURLOPT_SSLVERSION, 3);
// Se genera la URL de servicio
$param = array();
if (isset($this->parametros_url) && is_array($this->parametros_url)) {
$param = $this->parametros_url;
}
$url = $this->generar_url($param);
phpCAS::setFixedServiceURL($url);
// Tipo de auth
if (toba::instalacion()->es_produccion()) {
phpCAS::setCasServerCACert($this->archivo_certificado, $this->validar_cn);
} else {
phpCAS::setNoCasServerValidation();
}
phpCAS::setServerLoginURL('');
/** Llamada principal al authentificación de CAS, si no estás
autenticado te redirecciona ahí adentro y no sigue ejecutando
Si pasa está función significa que estás autenticado **/
phpCAS::forceAuthentication();
}
示例15: dirname
// dans un répertoire correspondant a l'include_path du php.ini (exemple : /var/lib/php)
include_once dirname(__FILE__) . '/CAS/CAS.php';
// cas.sso est le fichier d'informations de connexions au serveur cas
// Le fichier cas.sso doit etre stocké dans un sous-répertoire « CAS »
// dans un répertoire correspondant a l'include_path du php.ini (exemple : /var/lib/php)
include dirname(__FILE__) . '/CAS/cas.sso';
/* declare le script comme un client CAS
Si le dernier argument est à true, cela donne la possibilité à phpCAS d'ouvrir une session php.
*/
phpCAS::client(CAS_VERSION_2_0, $serveurSSO, $serveurSSOPort, $serveurSSORacine, true);
phpCAS::setLang(PHPCAS_LANG_FRENCH);
// phpCAS::setCasServerCACert();
//Set the fixed URL that will be set as the CAS service parameter. When this method is not called, a phpCAS script uses its own URL.
//Le paramètre $Url_CAS_setFixedServiceURL est défini dans le fichier config.inc.php
if (isset($Url_CAS_setFixedServiceURL) && $Url_CAS_setFixedServiceURL != '') {
phpCAS::setFixedServiceURL($Url_CAS_setFixedServiceURL);
}
/*
Commentez la ligne suivante si vous avez une erreur du type
PHP Fatal error: Call to undefined method phpCAS::setnocasservervalidation() in /var/www/html/grr/include/cas.inc.php
Nécessite une version de phpCAS supérieure ou égale à 1.0.0.
*/
phpCAS::setNoCasServerValidation();
/*
Gestion du single sign-out (version 1.0.0 de phpcas)
Commentez la ligne suivante si vous avez une erreur du type
PHP Fatal error: Call to undefined method phpCAS::handlelogoutrequests() in /var/www/html/grr/include/cas.inc.php
*/
phpCAS::handleLogoutRequests(false);
if (phpCAS::checkAuthentication()) {
// L'utilisateur est déjà authentifié, on continue