From 9af1b846234dc61a2e5e11b9b20c2fd13f80d66c Mon Sep 17 00:00:00 2001 From: Ernesto Rodriguez Ortiz Date: Thu, 15 Dec 2016 17:19:20 -0500 Subject: [PATCH] Add a configuration to use custom URL validation. --- src/Xavrsl/Cas/Sso.php | 22 ++++++++++++++++++++++ src/config/cas.php | 14 ++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/src/Xavrsl/Cas/Sso.php b/src/Xavrsl/Cas/Sso.php index e8e3fb3..ef5ebd2 100644 --- a/src/Xavrsl/Cas/Sso.php +++ b/src/Xavrsl/Cas/Sso.php @@ -42,6 +42,7 @@ private function initializeCas() $this->configureCasClient(); $this->configureSslValidation(); + $this->configureServerValidateURL(); phpCAS::handleLogoutRequests(); $this->configureProxyChain(); @@ -99,6 +100,27 @@ private function configureSslValidation() } } + /** + * Configure Server Validate URL + * + * Override the validation URL is sometimes wanted. + */ + private function configureServerValidateURL() + { + // override validation URL for the CAS server + if ($this->config['cas_validation_url']) + { + if ($this->config['cas_saml']) + { + phpCAS::setServerSamlValidateURL($this->config['cas_validation_url']); + } + else + { + phpCAS::setServerServiceValidateURL($this->config['cas_validation_url']); + } + } + } + /** * Configure Cas Proxy Chain * diff --git a/src/config/cas.php b/src/config/cas.php index ff49325..253bc3c 100644 --- a/src/config/cas.php +++ b/src/config/cas.php @@ -63,6 +63,20 @@ 'cas_validation' => env('CAS_VALIDATION', ''), + /* + |-------------------------------------------------------------------------- + | Custom CAS Validation URL + |-------------------------------------------------------------------------- + | + | Custom CAS server URL validation: In general the validation URL is in the same + | server and we don't need to provide this URL, but in some cases we can + | or need to provide a custom URL validation. + | + */ + + 'cas_validation_url' => env('CAS_VALIDATION_URL', false), + + /* |-------------------------------------------------------------------------- | CAS Certificate