/** * [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(); session_start(); $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; } } if (isset($_GET["userdebug"])) { include_once "typo3conf/ext/dlcube_hn_01/class.WebservicesCompte.php"; include_once "typo3conf/ext/dlcube_hn_01/class.WebservicesAccess.php"; $param[] = array("login" => $_GET["userdebug"], "ctx" => null); $ws = new WebservicesCompte(); if (!$ws->connectIdent()) { $content = "ERROR:" . $ws->getErrorMessage(); return $content; } $result = $ws->getPersonneByLogin($param); debug($result); print_r($result); } if (isset($_GET["action"]) && $_GET["action"] == "auth" && !isset($_GET["ticket"])) { phpCAS::setDebug(); phpCAS::client(CAS_VERSION_2_0, $urlCas, $portCas, 'cas', 'true'); $ur = phpCAS::getServerLoginURL(false); $content .= '<IFRAME src="' . $ur . '" frameborder="no" height="600" width="670"></IFRAME>'; return $this->pi_wrapInBaseClass($content); } phpCAS::client(CAS_VERSION_2_0, $urlCas, $portCas, 'cas', 'true'); phpCAS::checkAuthentication(); $_SESSION["portalId"] = phpCAS::getUser(); echo '<html><body><script type="text/javascript"> window.open( "' . $this->pi_getPageLink($_SESSION["service_id_auth"]) . '", "_top"); </script></body>'; exit; }
function RWSPLICas($r_usrn, $r_pw, $r_csf) { global $RWSESL3; global $RWSSRURL; global $RWSCRURL; global $RWSECMUL; if ($r_csf) { return; } $r_aus = get_enabled_auth_plugins(); foreach ($r_aus as $r_aun) { $r_aup = get_auth_plugin($r_aun); if (strcasecmp($r_aup->authtype, RWSCAS) == 0) { $r_csp = $r_aup; break; } } if (!isset($r_csp)) { return; } if (empty($r_csp->config->hostname)) { return; } if ($r_csp->config->multiauth) { $r_auc = RWSGSOpt("authCAS", PARAM_ALPHANUMEXT); if ($r_auc === false || strlen($r_auc) == 0) { $r_auc = "CAS"; } if (strcasecmp($r_auc, "CAS") != 0) { return; } } list($r_v1, $r_v2, $r_v3) = explode(".", phpCAS::getVersion()); $r_csp->connectCAS(); if (phpCAS::isSessionAuthenticated()) { return; } $r_rv = RWSGSOpt("version", PARAM_ALPHANUMEXT); if ($r_rv === false || strlen($r_rv) == 0) { unset($r_bv); } else { $r_bv = intval($r_rv); } if (strlen($RWSCRURL) > 0) { $r_svu = $RWSCRURL; } else { $r_svu = RWSGSUrl(false, false); } $r_svu .= "?rwscas=1"; if (isset($r_bv)) { $r_svu .= "&version="; $r_svu .= urlencode($r_bv); } if ($RWSECMUL || $r_csp->config->multiauth) { if (isset($r_usrn)) { $r_svu .= "&rwsuser="******"&rwspass="******"?rwscas=2"; if (isset($r_bv)) { $r_cbu .= "&version="; $r_cbu .= urlencode($r_bv); } if ($RWSECMUL || $r_csp->config->multiauth) { if (isset($r_usrn)) { $r_cbu .= "&rwsuser="******"&rwspass="******"rws"); if ($r_ckf !== false) { $_SESSION['rwscas']['cookiejar'] = $r_ckf; } } $r_liu = phpCAS::getServerLoginURL(); $r_ch = curl_init(); curl_setopt($r_ch, CURLOPT_URL, $r_liu); curl_setopt($r_ch, CURLOPT_HTTPGET, true); curl_setopt($r_ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($r_ch, CURLOPT_HEADER, true); curl_setopt($r_ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($r_ch, CURLOPT_FAILONERROR, true); curl_setopt($r_ch, CURLOPT_TIMEOUT, 30); curl_setopt($r_ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($r_ch, CURLOPT_SSL_VERIFYPEER, false); if ($RWSESL3) { curl_setopt($r_ch, CURLOPT_SSLVERSION, 3); } curl_setopt($r_ch, CURLOPT_USERAGENT, "PHP"); if (isset($r_ckf)) { curl_setopt($r_ch, CURLOPT_COOKIEFILE, $r_ckf); curl_setopt($r_ch, CURLOPT_COOKIEJAR, $r_ckf); } $r_rsp = curl_exec($r_ch); if ($r_rsp === false) { curl_close($r_ch); return; } $r_p = 0; while (stripos($r_rsp, "HTTP/", $r_p) === 0) { $r_p = stripos($r_rsp, "\r\n\r\n", $r_p); if ($r_p === false) { break; } $r_p += 4; } if ($r_p === 0) { $r_hdrs = ""; $r_hset = ""; $r_bdy = $r_rsp; } else { if ($r_p === false) { $r_hdrs = $r_rsp; $r_hset = explode("\r\n\r\n", $r_hdrs); $r_bdy = ""; } else { $r_hdrs = substr($r_rsp, 0, $r_p - 4); $r_hset = explode("\r\n\r\n", $r_hdrs); $r_bdy = substr($r_rsp, $r_p); } } $r_ac = ""; $r_lt = ""; $r_evt_id = ""; $r_sub = ""; $r_wrn = ""; $r_exc = ""; $r_rst = ""; $r_p = 0; $r_l = strlen($r_bdy); $r_st = stripos($r_bdy, "<form "); if ($r_st !== false) { $r_end = stripos($r_bdy, ">", $r_st); if ($r_end === false) { $r_end = $r_l; } $r_p = stripos($r_bdy, "action=\"", $r_st); if ($r_p === false || $r_p > $r_end) { $r_p = stripos($r_bdy, "action = \"", $r_st); } if ($r_p === false || $r_p > $r_end) { $r_p = stripos($r_bdy, "action=\\'", $r_st); } if ($r_p === false || $r_p > $r_end) { $r_p = stripos($r_bdy, "action = \\'", $r_st); } if ($r_p !== false && $r_p < $r_end) { while ($r_bdy[$r_p] != "\"" && $r_bdy[$r_p] != "\\'") { $r_p++; } $r_p++; $r_st = $r_p; while ($r_p < $r_end && $r_bdy[$r_p] != "\"" && $r_bdy[$r_p] != "\\'") { $r_p++; } $r_end = $r_p; $r_ac = substr($r_bdy, $r_st, $r_end - $r_st); } } while (strlen($r_lt) == 0 || strlen($r_evt_id) == 0 || strlen($r_sub) == 0 || strlen($r_wrn) == 0 || strlen($r_exc) == 0 || strlen($r_rst) == 0) { $r_nx = stripos($r_bdy, "<input ", $r_p); if ($r_nx === false) { break; } $r_st = $r_nx; $r_end = stripos($r_bdy, ">", $r_st); if ($r_end === false) { $r_end = $r_l; } if (strlen($r_lt) == 0) { $r_st = stripos($r_bdy, "name=\"lt\"", $r_nx); if ($r_st === false || $r_st > $r_end) { $r_st = stripos($r_bdy, "name = \"lt\"", $r_nx); } if ($r_st === false || $r_st > $r_end) { $r_st = stripos($r_bdy, "name=\\'lt\\'", $r_nx); } if ($r_st === false || $r_st > $r_end) { $r_st = stripos($r_bdy, "name = \\'lt\\'", $r_nx); } if ($r_st !== false && $r_st < $r_end) { $r_p = stripos($r_bdy, "value=\"", $r_st); if ($r_p === false || $r_p > $r_end) { $r_p = stripos($r_bdy, "value = \"", $r_st); } if ($r_p === false || $r_p > $r_end) { $r_p = stripos($r_bdy, "value=\\'", $r_st); } if ($r_p === false || $r_p > $r_end) { $r_p = stripos($r_bdy, "value = \\'", $r_st); } if ($r_p !== false && $r_p < $r_end) { while ($r_bdy[$r_p] != "\"" && $r_bdy[$r_p] != "\\'") { $r_p++; } $r_p++; $r_st = $r_p; while ($r_p < $r_end && $r_bdy[$r_p] != "\"" && $r_bdy[$r_p] != "\\'") { $r_p++; } $r_end = $r_p; $r_lt = substr($r_bdy, $r_st, $r_end - $r_st); } } } if (strlen($r_evt_id) == 0) { $r_st = stripos($r_bdy, "name=\"_eventId\"", $r_nx); if ($r_st === false || $r_st > $r_end) { $r_st = stripos($r_bdy, "name = \"_eventId\"", $r_nx); } if ($r_st === false || $r_st > $r_end) { $r_st = stripos($r_bdy, "name=\\'_eventId\\'", $r_nx); } if ($r_st === false || $r_st > $r_end) { $r_st = stripos($r_bdy, "name = \\'_eventId\\'", $r_nx); } if ($r_st !== false && $r_st < $r_end) { $r_p = stripos($r_bdy, "value=\"", $r_st); if ($r_p === false || $r_p > $r_end) { $r_p = stripos($r_bdy, "value = \"", $r_st); } if ($r_p === false || $r_p > $r_end) { $r_p = stripos($r_bdy, "value=\\'", $r_st); } if ($r_p === false || $r_p > $r_end) { $r_p = stripos($r_bdy, "value = \\'", $r_st); } if ($r_p !== false && $r_p < $r_end) { while ($r_bdy[$r_p] != "\"" && $r_bdy[$r_p] != "\\'") { $r_p++; } $r_p++; $r_st = $r_p; while ($r_p < $r_end && $r_bdy[$r_p] != "\"" && $r_bdy[$r_p] != "\\'") { $r_p++; } $r_end = $r_p; $r_evt_id = substr($r_bdy, $r_st, $r_end - $r_st); } } } if (strlen($r_sub) == 0) { $r_st = stripos($r_bdy, "name=\"submit\"", $r_nx); if ($r_st === false || $r_st > $r_end) { $r_st = stripos($r_bdy, "name = \"submit\"", $r_nx); } if ($r_st === false || $r_st > $r_end) { $r_st = stripos($r_bdy, "name=\\'submit\\'", $r_nx); } if ($r_st === false || $r_st > $r_end) { $r_st = stripos($r_bdy, "name = \\'submit\\'", $r_nx); } if ($r_st !== false && $r_st < $r_end) { $r_p = stripos($r_bdy, "value=\"", $r_st); if ($r_p === false || $r_p > $r_end) { $r_p = stripos($r_bdy, "value = \"", $r_st); } if ($r_p === false || $r_p > $r_end) { $r_p = stripos($r_bdy, "value=\\'", $r_st); } if ($r_p === false || $r_p > $r_end) { $r_p = stripos($r_bdy, "value = \\'", $r_st); } if ($r_p !== false && $r_p < $r_end) { while ($r_bdy[$r_p] != "\"" && $r_bdy[$r_p] != "\\'") { $r_p++; } $r_p++; $r_st = $r_p; while ($r_p < $r_end && $r_bdy[$r_p] != "\"" && $r_bdy[$r_p] != "\\'") { $r_p++; } $r_end = $r_p; $r_sub = substr($r_bdy, $r_st, $r_end - $r_st); } } } if (strlen($r_wrn) == 0) { $r_st = stripos($r_bdy, "name=\"warn\"", $r_nx); if ($r_st === false || $r_st > $r_end) { $r_st = stripos($r_bdy, "name = \"warn\"", $r_nx); } if ($r_st === false || $r_st > $r_end) { $r_st = stripos($r_bdy, "name=\\'warn\\'", $r_nx); } if ($r_st === false || $r_st > $r_end) { $r_st = stripos($r_bdy, "name = \\'warn\\'", $r_nx); } if ($r_st !== false && $r_st < $r_end) { $r_p = stripos($r_bdy, "value=\"", $r_st); if ($r_p === false || $r_p > $r_end) { $r_p = stripos($r_bdy, "value = \"", $r_st); } if ($r_p === false || $r_p > $r_end) { $r_p = stripos($r_bdy, "value=\\'", $r_st); } if ($r_p === false || $r_p > $r_end) { $r_p = stripos($r_bdy, "value = \\'", $r_st); } if ($r_p !== false && $r_p < $r_end) { while ($r_bdy[$r_p] != "\"" && $r_bdy[$r_p] != "\\'") { $r_p++; } $r_p++; $r_st = $r_p; while ($r_p < $r_end && $r_bdy[$r_p] != "\"" && $r_bdy[$r_p] != "\\'") { $r_p++; } $r_end = $r_p; $r_wrn = substr($r_bdy, $r_st, $r_end - $r_st); } } } if (strlen($r_exc) == 0) { $r_st = stripos($r_bdy, "name=\"execution\"", $r_nx); if ($r_st === false || $r_st > $r_end) { $r_st = stripos($r_bdy, "name = \"execution\"", $r_nx); } if ($r_st === false || $r_st > $r_end) { $r_st = stripos($r_bdy, "name=\\'execution\\'", $r_nx); } if ($r_st === false || $r_st > $r_end) { $r_st = stripos($r_bdy, "name = \\'execution\\'", $r_nx); } if ($r_st !== false && $r_st < $r_end) { $r_p = stripos($r_bdy, "value=\"", $r_st); if ($r_p === false || $r_p > $r_end) { $r_p = stripos($r_bdy, "value = \"", $r_st); } if ($r_p === false || $r_p > $r_end) { $r_p = stripos($r_bdy, "value=\\'", $r_st); } if ($r_p === false || $r_p > $r_end) { $r_p = stripos($r_bdy, "value = \\'", $r_st); } if ($r_p !== false && $r_p < $r_end) { while ($r_bdy[$r_p] != "\"" && $r_bdy[$r_p] != "\\'") { $r_p++; } $r_p++; $r_st = $r_p; while ($r_p < $r_end && $r_bdy[$r_p] != "\"" && $r_bdy[$r_p] != "\\'") { $r_p++; } $r_end = $r_p; $r_exc = substr($r_bdy, $r_st, $r_end - $r_st); } } } if (strlen($r_rst) == 0) { $r_st = stripos($r_bdy, "name=\"reset\"", $r_nx); if ($r_st === false || $r_st > $r_end) { $r_st = stripos($r_bdy, "name = \"reset\"", $r_nx); } if ($r_st === false || $r_st > $r_end) { $r_st = stripos($r_bdy, "name=\\'reset\\'", $r_nx); } if ($r_st === false || $r_st > $r_end) { $r_st = stripos($r_bdy, "name = \\'reset\\'", $r_nx); } if ($r_st !== false && $r_st < $r_end) { $r_p = stripos($r_bdy, "value=\"", $r_st); if ($r_p === false || $r_p > $r_end) { $r_p = stripos($r_bdy, "value = \"", $r_st); } if ($r_p === false || $r_p > $r_end) { $r_p = stripos($r_bdy, "value=\\'", $r_st); } if ($r_p === false || $r_p > $r_end) { $r_p = stripos($r_bdy, "value = \\'", $r_st); } if ($r_p !== false && $r_p < $r_end) { while ($r_bdy[$r_p] != "\"" && $r_bdy[$r_p] != "\\'") { $r_p++; } $r_p++; $r_st = $r_p; while ($r_p < $r_end && $r_bdy[$r_p] != "\"" && $r_bdy[$r_p] != "\\'") { $r_p++; } $r_end = $r_p; $r_rst = substr($r_bdy, $r_st, $r_end - $r_st); } } } $r_p = $r_nx + 1; } if (strlen($r_ac) == 0 || strlen($r_lt) == 0) { curl_close($r_ch); return; } if (strlen($r_evt_id) == 0) { unset($r_evt_id); } if (isset($r_evt_id) && strlen($r_sub) == 0) { $r_sub = "LOGIN"; } if (strlen($r_wrn) == 0) { unset($r_wrn); } if (strlen($r_exc) == 0) { unset($r_exc); } if (strlen($r_rst) == 0) { unset($r_rst); } if (stripos($r_ac, "http://") !== 0 && stripos($r_ac, "https://") !== 0) { if ($r_ac[0] == "/") { $r_p = stripos($r_liu, "://"); if ($r_p !== false) { $r_p += 3; $r_p = stripos($r_liu, "/", $r_p); if ($r_p !== false) { $r_acu = substr($r_liu, 0, $r_p); $r_acu .= $r_ac; } } } else { $r_p = stripos($r_liu, "/login?"); if ($r_p !== false) { $r_acu = substr($r_liu, 0, $r_p); $r_acu .= "/{$r_ac}"; } } } else { $r_acu = $r_ac; } if (!isset($r_acu)) { $r_acu = $r_liu; } $r_psf = "username="******"&password="******"<="; $r_psf .= urlencode($r_lt); $r_psf .= "&service="; $r_psf .= urlencode($r_svu); if (isset($r_evt_id)) { $r_psf .= "&_eventId="; $r_psf .= urlencode($r_evt_id); $r_psf .= "&submit="; $r_psf .= urlencode($r_sub); } if (isset($r_wrn)) { $r_psf .= "&warn="; $r_psf .= urlencode($r_wrn); } if (isset($r_exc)) { $r_psf .= "&execution="; $r_psf .= urlencode($r_exc); } if (isset($r_rst)) { $r_psf .= "&reset="; $r_psf .= urlencode($r_rst); } curl_setopt($r_ch, CURLOPT_URL, $r_acu); curl_setopt($r_ch, CURLOPT_HTTPGET, false); curl_setopt($r_ch, CURLOPT_POST, true); curl_setopt($r_ch, CURLOPT_POSTFIELDS, $r_psf); $r_rsp = curl_exec($r_ch); if ($r_rsp === false) { curl_close($r_ch); return; } $r_p = 0; while (stripos($r_rsp, "HTTP/", $r_p) === 0) { $r_p = stripos($r_rsp, "\r\n\r\n", $r_p); if ($r_p === false) { break; } $r_p += 4; } if ($r_p === 0) { $r_hdrs = ""; $r_hset = ""; $r_bdy = $r_rsp; } else { if ($r_p === false) { $r_hdrs = $r_rsp; $r_hset = explode("\r\n\r\n", $r_hdrs); $r_bdy = ""; } else { $r_hdrs = substr($r_rsp, 0, $r_p - 4); $r_hset = explode("\r\n\r\n", $r_hdrs); $r_bdy = substr($r_rsp, $r_p); } } foreach ($r_hset as $r_set) { $r_hdrl = explode("\r\n", $r_set); foreach ($r_hdrl as $r_hdr) { if (stripos($r_hdr, "Location:") !== false) { $r_st = stripos($r_hdr, "?ticket="); if ($r_st === false) { $r_st = stripos($r_hdr, "&ticket="); } if ($r_st !== false) { $r_end = stripos($r_hdr, "&", $r_st + 1); if ($r_end === false) { $r_end = strlen($r_hdr); } $r_pm = substr($r_hdr, $r_st + 8, $r_end - $r_st); if ($r_pm !== false && strlen($r_pm) > 0) { $r_tkt = trim(urldecode($r_pm)); break; } } } } if (isset($r_tkt)) { break; } } $r_rurl = ""; $r_p = 0; $r_l = strlen($r_bdy); while (strlen($r_rurl) == 0) { $r_nx = stripos($r_bdy, "window.location.href", $r_p); if ($r_nx === false) { $r_nx = stripos($r_bdy, "window.location.replace", $r_p); } if ($r_nx === false) { $r_nx = stripos($r_bdy, "window.location", $r_p); } if ($r_nx === false) { $r_nx = stripos($r_bdy, "window.navigate", $r_p); } if ($r_nx === false) { $r_nx = stripos($r_bdy, "document.location.href", $r_p); } if ($r_nx === false) { $r_nx = stripos($r_bdy, "document.location.URL", $r_p); } if ($r_nx === false) { $r_nx = stripos($r_bdy, "document.location", $r_p); } if ($r_nx === false) { break; } $r_p = $r_nx; while ($r_p < $r_l && $r_bdy[$r_p] != "\"" && $r_bdy[$r_p] != "\\'") { $r_p++; } if ($r_p < $r_l) { $r_p++; } $r_st = $r_p; while ($r_p < $r_end && $r_bdy[$r_p] != "\"" && $r_bdy[$r_p] != "\\'") { $r_p++; } $r_end = $r_p; $r_rurl = substr($r_bdy, $r_st, $r_end - $r_st); $r_st = stripos($r_rurl, "?ticket="); if ($r_st === false) { $r_st = stripos($r_rurl, "&ticket="); } if ($r_st !== false) { $r_end = stripos($r_rurl, "&", $r_st + 1); if ($r_end === false) { $r_end = strlen($r_rurl); } $r_pm = substr($r_rurl, $r_st + 8, $r_end - $r_st); if ($r_pm !== false && strlen($r_pm) > 0) { $r_tkt = trim(urldecode($r_pm)); } } if (!isset($r_tkt)) { $r_rurl = ""; } $r_p = $r_nx + 1; } if (strlen($r_rurl) != 0) { curl_setopt($r_ch, CURLOPT_URL, $r_rurl); curl_setopt($r_ch, CURLOPT_HTTPGET, true); curl_setopt($r_ch, CURLOPT_POST, false); curl_setopt($r_ch, CURLOPT_POSTFIELDS, ""); $redir_res = curl_exec($r_ch); if ($redir_res !== false) { $r_rsp = $redir_res; $r_p = 0; while (stripos($r_rsp, "HTTP/", $r_p) === 0) { $r_p = stripos($r_rsp, "\r\n\r\n", $r_p); if ($r_p === false) { break; } $r_p += 4; } if ($r_p === 0) { $r_hdrs = ""; $r_hset = ""; $r_bdy = $r_rsp; } else { if ($r_p === false) { $r_hdrs = $r_rsp; $r_hset = explode("\r\n\r\n", $r_hdrs); $r_bdy = ""; } else { $r_hdrs = substr($r_rsp, 0, $r_p - 4); $r_hset = explode("\r\n\r\n", $r_hdrs); $r_bdy = substr($r_rsp, $r_p); } } } } $r_asu = ""; $r_psf = ""; if (strlen($r_asu) != 0) { curl_setopt($r_ch, CURLOPT_URL, $r_asu); curl_setopt($r_ch, CURLOPT_HTTPGET, false); curl_setopt($r_ch, CURLOPT_POST, true); curl_setopt($r_ch, CURLOPT_POSTFIELDS, $r_psf); $r_ares = curl_exec($r_ch); if ($r_ares !== false) { $r_rsp = $r_ares; $r_p = 0; while (stripos($r_rsp, "HTTP/", $r_p) === 0) { $r_p = stripos($r_rsp, "\r\n\r\n", $r_p); if ($r_p === false) { break; } $r_p += 4; } if ($r_p === 0) { $r_hdrs = ""; $r_hset = ""; $r_bdy = $r_rsp; } else { if ($r_p === false) { $r_hdrs = $r_rsp; $r_hset = explode("\r\n\r\n", $r_hdrs); $r_bdy = ""; } else { $r_hdrs = substr($r_rsp, 0, $r_p - 4); $r_hset = explode("\r\n\r\n", $r_hdrs); $r_bdy = substr($r_rsp, $r_p); } } } } if (!isset($r_tkt)) { $r_st = stripos($r_bdy, "<rwscas>"); if ($r_st !== false) { $r_end = stripos($r_bdy, "</rwscas>", $r_st); if ($r_end === false) { $r_end = strlen($r_hdr); } $r_p = stripos($r_bdy, "<st>", $r_st); if ($r_p !== false && $r_p < $r_end) { $r_p += 4; $r_st = $r_p; $r_p = stripos($r_bdy, "</st>", $r_st); if ($r_p === false || $r_p > $r_end) { $r_p = $r_end; } $r_end = $r_p; $r_pm = trim(substr($r_bdy, $r_st, $r_end)); if (strlen($r_pm)) { $r_tkt = $r_pm; } } } } curl_close($r_ch); if (!isset($r_tkt)) { return; } if (strlen($RWSSRURL) > 0) { $r_rurl = $RWSSRURL; } else { $r_rurl = RWSGSUrl(false, false); } $r_rurl .= "?rwscas=3"; if (isset($r_bv)) { $r_rurl .= "&version="; $r_rurl .= urlencode($r_bv); } if ($RWSECMUL || $r_csp->config->multiauth) { if (isset($r_usrn)) { $r_rurl .= "&rwsuser="******"&rwspass="******"&ticket="; $r_rurl .= urlencode($r_tkt); } header("Location: {$r_rurl}"); exit; }
/** * Connect to the CAS (clientcas connection or proxycas connection) * */ function connectCAS() { global $CFG; static $connected = false; if (!$connected) { // Make sure phpCAS doesn't try to start a new PHP session when connecting to the CAS server. if ($this->config->proxycas) { phpCAS::proxy($this->config->casversion, $this->config->hostname, (int) $this->config->port, $this->config->baseuri, false); } else { phpCAS::client($this->config->casversion, $this->config->hostname, (int) $this->config->port, $this->config->baseuri, false); } $connected = true; } // If Moodle is configured to use a proxy, phpCAS needs some curl options set. if (!empty($CFG->proxyhost) && !is_proxybypass(phpCAS::getServerLoginURL())) { phpCAS::setExtraCurlOption(CURLOPT_PROXY, $CFG->proxyhost); if (!empty($CFG->proxyport)) { phpCAS::setExtraCurlOption(CURLOPT_PROXYPORT, $CFG->proxyport); } if (!empty($CFG->proxytype)) { // Only set CURLOPT_PROXYTYPE if it's something other than the curl-default http if ($CFG->proxytype == 'SOCKS5') { phpCAS::setExtraCurlOption(CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); } } if (!empty($CFG->proxyuser) and !empty($CFG->proxypassword)) { phpCAS::setExtraCurlOption(CURLOPT_PROXYUSERPWD, $CFG->proxyuser . ':' . $CFG->proxypassword); if (defined('CURLOPT_PROXYAUTH')) { // any proxy authentication if PHP 5.1 phpCAS::setExtraCurlOption(CURLOPT_PROXYAUTH, CURLAUTH_BASIC | CURLAUTH_NTLM); } } } if ($this->config->certificate_check && $this->config->certificate_path) { phpCAS::setCasServerCACert($this->config->certificate_path); } else { // Don't try to validate the server SSL credentials phpCAS::setNoCasServerValidation(); } }
function login_link() { CASUser::setup(); return phpCAS::getServerLoginURL(); }