diff --git a/src/Xavrsl/Cas/Sso.php.orig b/src/Xavrsl/Cas/Sso.php.orig deleted file mode 100644 index 43eb9f8..0000000 --- a/src/Xavrsl/Cas/Sso.php.orig +++ /dev/null @@ -1,243 +0,0 @@ -config = $config; - $this->initializeCas(); - } - - /** - * Make PHPCAS Initialization - * - * Initialize phpCAS before authentication - * - * @return none - */ - private function initializeCas() - { - $this->configureDebug(); - // initialize CAS client - $this->configureCasClient(); - - $this->configureSslValidation(); - phpCAS::handleLogoutRequests(); - - $this->configureProxyChain(); - } - - /** - * Configure CAS debug - */ - private function configureDebug() - { - if($debug = $this->config['cas_debug']) - { - $path = (gettype($debug) == 'string') ? $debug : ''; - phpCAS::setDebug($path); - } - } - - /** - * Configure CAS Client - * - */ - private function configureCasClient() - { - $method = !$this->config['cas_proxy'] ? 'client' : 'proxy'; - // Last argument of method (proxy or client) is $changeSessionID. It is true by default. It means it will - // override the framework's session_id. This allows for Single Sign Out. And it means that there is no point - // in using the framework's session and authentication objects. If CAS destroys the session, it will destroy it - // for everyone and you only need to deal with one session. - phpCAS::$method( - !$this->config['cas_saml'] ? CAS_VERSION_2_0 : SAML_VERSION_1_1, - $this->config['cas_hostname'], - $this->config['cas_port'], - $this->config['cas_uri'] - ); - } - - /** - * Configure SSL Validation - * - * Having some kind of server cert validation in production - * is highly recommended. - */ - private function configureSslValidation() - { - // set SSL validation for the CAS server - if ($this->config['cas_validation'] == 'self') - { - phpCAS::setCasServerCert($this->config['cas_cert']); - } - else if ($this->config['cas_validation'] == 'ca') - { - phpCAS::setCasServerCACert($this->config['cas_cert']); - } - else - { - phpCAS::setNoCasServerValidation(); - } - } - - /** - * Configure Cas Proxy Chain - * - * Cas can proxy services. Here you can specify which ones are allowed. - */ - private function configureProxyChain() - { - if (is_array($this->config['cas_proxied_services']) - && !empty($this->config['cas_proxied_services'])) - { - phpCAS::allowProxyChain(new \CAS_ProxyChain($this->config['cas_proxied_services'])); - } - } - - /** - * isPretending - * - * When on dev environment, you can sometimes be on a private network that can't access to the CAS - * server. Sometimes, you may also want to check the application as if you where one user or - * another. This is why you may specify a CAS_PRETEND_USER config variable. - */ - private function isPretending() - { - if (isset($this->config['cas_pretend_user']) - && !empty($this->config['cas_pretend_user'])) - { - return true; - } - return false; - } - - /** - * Authenticates the user based on the current request. - * - * If authentication fails, an exception must be thrown. - * - * @throws CasAuthenticationException - */ - public function authenticate() - { - if($this->isPretending()) return true; - - try - { -<<<<<<< HEAD - $this->configureCasProxy(); -======= - phpCAS::forceAuthentication(); ->>>>>>> develop - } - catch(\Exception $e) - { -<<<<<<< HEAD - $this->configureCasClient(); - } - - $this->configureSslValidation(); - - //set the postAuthenticateCallback function if it exists - if(isset($this->config['cas_post_authenticate_callback']) - && $this->config['cas_post_authenticate_callback']) - { - phpCAS::setPostAuthenticateCallback($this->config['cas_post_authenticate_callback']); - } - - if(!$this->config['cas_proxy']) { - $this->detect_authentication(); -======= - throw new CasAuthenticationException; ->>>>>>> develop - } - } - - /** - * Checks to see is user is authenticated - * - * @return bool - */ - public function isAuthenticated() - { - if($this->isPretending()) return true; - - return phpCAS::isAuthenticated(); - } - - - /** - * Returns information about the currently logged in user. - * - * If nobody is currently logged in, this method should return null. - * - * @return array|null - */ - public function getCurrentUser() - { - if($this->isPretending()) return $this->config['cas_pretend_user']; - - return phpCAS::getUser(); - } - - /** - * getCurrentUser Alias - * - * @return array|null - */ - public function user() - { - if($this->isPretending()) return $this->config['cas_pretend_user']; - - return phpCAS::getUser(); - } - - /** - * getAttributes' simple wrapper - * - * @return array|null - */ - public function getAttributes() - { - return phpCAS::getAttributes(); - } - - /** - * This method is used to logout from CAS - * - * @param array ['url' => 'http://...'] || ['service' => ...] - * - * @return none - */ - public function logout($params = array()) - { - if($this->isPretending()) return true; - - if(!phpCAS::isAuthenticated()) - { - $this->initializeCas(); - } - phpCAS::logout($params); - exit; - } - -} diff --git a/src/config/config_BACKUP_3928.php b/src/config/config_BACKUP_3928.php deleted file mode 100644 index 4706d60..0000000 --- a/src/config/config_BACKUP_3928.php +++ /dev/null @@ -1,116 +0,0 @@ - array( - - /* - |-------------------------------------------------------------------------- - | PHPCas Hostname - |-------------------------------------------------------------------------- - | - | Exemple: 'cas.myuniv.edu'. - | - */ - - 'cas_hostname' => 'cas.domain.fr', - - /* - |-------------------------------------------------------------------------- - | Use as Cas proxy ? - |-------------------------------------------------------------------------- - */ - - 'cas_proxy' => false, - - /* - |-------------------------------------------------------------------------- - | Enable service to be proxied - |-------------------------------------------------------------------------- - | - | Example: - | phpCAS::allowProxyChain(new CAS_ProxyChain(array( - | '/^https:\/\/app[0-9]\.example\.com\/rest\//', - | 'http://client.example.com/' - | ))); - | For the exemple above: - | 'cas_service' => array('/^https:\/\/app[0-9]\.example\.com\/rest\//','http://client.example.com/'), - */ - - 'cas_service' => array(), - - /* - |-------------------------------------------------------------------------- - | Cas Port - |-------------------------------------------------------------------------- - | - | Usually 443 is default - | - */ - - 'cas_port' => 443, - - /* - |-------------------------------------------------------------------------- - | CAS URI - |-------------------------------------------------------------------------- - | - | Sometimes is /cas - | - */ - - 'cas_uri' => '', - - /* - |-------------------------------------------------------------------------- - | CAS Validation - |-------------------------------------------------------------------------- - | - | CAS server SSL validation: 'self' for self-signed certificate, 'ca' for - | certificate from a CA, empty for no SSL validation. - | - */ - - 'cas_validation' => '', - - /* - |-------------------------------------------------------------------------- - | CAS Certificate - |-------------------------------------------------------------------------- - | - | Path to the CAS certificate file - | - */ - - 'cas_cert' => '/path/to/cert/file', - - /* - |-------------------------------------------------------------------------- - | CAS Login URI - |-------------------------------------------------------------------------- - | - | Empty is fine - | - */ - - 'cas_login_url' => '', - - /* - |-------------------------------------------------------------------------- - | CAS Logout URI - |-------------------------------------------------------------------------- - */ - - 'cas_logout_url' => 'https://cas.domain.fr/logout?service=%s', - - /* - |-------------------------------------------------------------------------- - | CAS Post Authenticate Callback - |-------------------------------------------------------------------------- - | - | This function is called after authentication is successful and takes in - | the ticket as an argument. - | - */ - 'cas_post_authenticate_callback' => '', - ) -); diff --git a/src/config/config_BASE_3928.php b/src/config/config_BASE_3928.php deleted file mode 100644 index 6d53a28..0000000 --- a/src/config/config_BASE_3928.php +++ /dev/null @@ -1,105 +0,0 @@ - array( - - /* - |-------------------------------------------------------------------------- - | PHPCas Hostname - |-------------------------------------------------------------------------- - | - | Exemple: 'cas.myuniv.edu'. - | - */ - - 'cas_hostname' => 'cas.domain.fr', - - /* - |-------------------------------------------------------------------------- - | Use as Cas proxy ? - |-------------------------------------------------------------------------- - */ - - 'cas_proxy' => false, - - /* - |-------------------------------------------------------------------------- - | Enable service to be proxied - |-------------------------------------------------------------------------- - | - | Example: - | phpCAS::allowProxyChain(new CAS_ProxyChain(array( - | '/^https:\/\/app[0-9]\.example\.com\/rest\//', - | 'http://client.example.com/' - | ))); - | For the exemple above: - | 'cas_service' => array('/^https:\/\/app[0-9]\.example\.com\/rest\//','http://client.example.com/'), - */ - - 'cas_service' => array(), - - /* - |-------------------------------------------------------------------------- - | Cas Port - |-------------------------------------------------------------------------- - | - | Usually 443 is default - | - */ - - 'cas_port' => 443, - - /* - |-------------------------------------------------------------------------- - | CAS URI - |-------------------------------------------------------------------------- - | - | Sometimes is /cas - | - */ - - 'cas_uri' => '', - - /* - |-------------------------------------------------------------------------- - | CAS Validation - |-------------------------------------------------------------------------- - | - | CAS server SSL validation: 'self' for self-signed certificate, 'ca' for - | certificate from a CA, empty for no SSL validation. - | - */ - - 'cas_validation' => '', - - /* - |-------------------------------------------------------------------------- - | CAS Certificate - |-------------------------------------------------------------------------- - | - | Path to the CAS certificate file - | - */ - - 'cas_cert' => '/path/to/cert/file', - - /* - |-------------------------------------------------------------------------- - | CAS Login URI - |-------------------------------------------------------------------------- - | - | Empty is fine - | - */ - - 'cas_login_url' => '', - - /* - |-------------------------------------------------------------------------- - | CAS Logout URI - |-------------------------------------------------------------------------- - */ - - 'cas_logout_url' => 'https://cas.domain.fr/logout?service=%s', - ) -); diff --git a/src/config/config_LOCAL_3928.php b/src/config/config_LOCAL_3928.php deleted file mode 100644 index 4706d60..0000000 --- a/src/config/config_LOCAL_3928.php +++ /dev/null @@ -1,116 +0,0 @@ - array( - - /* - |-------------------------------------------------------------------------- - | PHPCas Hostname - |-------------------------------------------------------------------------- - | - | Exemple: 'cas.myuniv.edu'. - | - */ - - 'cas_hostname' => 'cas.domain.fr', - - /* - |-------------------------------------------------------------------------- - | Use as Cas proxy ? - |-------------------------------------------------------------------------- - */ - - 'cas_proxy' => false, - - /* - |-------------------------------------------------------------------------- - | Enable service to be proxied - |-------------------------------------------------------------------------- - | - | Example: - | phpCAS::allowProxyChain(new CAS_ProxyChain(array( - | '/^https:\/\/app[0-9]\.example\.com\/rest\//', - | 'http://client.example.com/' - | ))); - | For the exemple above: - | 'cas_service' => array('/^https:\/\/app[0-9]\.example\.com\/rest\//','http://client.example.com/'), - */ - - 'cas_service' => array(), - - /* - |-------------------------------------------------------------------------- - | Cas Port - |-------------------------------------------------------------------------- - | - | Usually 443 is default - | - */ - - 'cas_port' => 443, - - /* - |-------------------------------------------------------------------------- - | CAS URI - |-------------------------------------------------------------------------- - | - | Sometimes is /cas - | - */ - - 'cas_uri' => '', - - /* - |-------------------------------------------------------------------------- - | CAS Validation - |-------------------------------------------------------------------------- - | - | CAS server SSL validation: 'self' for self-signed certificate, 'ca' for - | certificate from a CA, empty for no SSL validation. - | - */ - - 'cas_validation' => '', - - /* - |-------------------------------------------------------------------------- - | CAS Certificate - |-------------------------------------------------------------------------- - | - | Path to the CAS certificate file - | - */ - - 'cas_cert' => '/path/to/cert/file', - - /* - |-------------------------------------------------------------------------- - | CAS Login URI - |-------------------------------------------------------------------------- - | - | Empty is fine - | - */ - - 'cas_login_url' => '', - - /* - |-------------------------------------------------------------------------- - | CAS Logout URI - |-------------------------------------------------------------------------- - */ - - 'cas_logout_url' => 'https://cas.domain.fr/logout?service=%s', - - /* - |-------------------------------------------------------------------------- - | CAS Post Authenticate Callback - |-------------------------------------------------------------------------- - | - | This function is called after authentication is successful and takes in - | the ticket as an argument. - | - */ - 'cas_post_authenticate_callback' => '', - ) -); diff --git a/src/config/config_REMOTE_3928.php b/src/config/config_REMOTE_3928.php deleted file mode 100644 index e69de29..0000000