PHP code example of ganlvtech / php-simple-cas-proxy
1. Go to this page and download the library: Download ganlvtech/php-simple-cas-proxy library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ganlvtech / php-simple-cas-proxy example snippets
use PhpSimpleCas\PhpCasProxy;
me)
{
return 0 === strpos($service_name, 'http://cas_client.dev/');
}
$phpCasProxy = new PhpCasProxy('https://cas.dev/');
// $phpCasProxy = new PhpCasProxy('https://cas.dev/', 'service_filter');
// $phpCasProxy = new PhpCasProxy('https://cas.dev/', null, 'http://my_cas.dev/');
// $phpCasProxy = new PhpCasProxy('https://cas.dev/', 'service_filter', 'http://my_cas.dev/', '/cas');
$phpCasProxy->proxy();
// if runs to here, all CAS routes match failed.
S::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
phpCAS::setNoCasServerValidation();
if (isset($_REQUEST['logout'])) {
phpCAS::logout();
}
if (isset($_REQUEST['login'])) {
phpCAS::forceAuthentication();
}
$auth = phpCAS::checkAuthentication();
if ($auth) {
echo phpCAS::getUser();
} else {
echo 'Guest mode';
}
$phpCasProxy = new PhpCasProxy('https://cas.dev/', null, 'http://my_cas.dev/');
$phpCasProxy->proxy();
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.