Commit ecd90122 authored by Tim Steiner's avatar Tim Steiner
Browse files

When doing CAS logins, support a baseUrl with schema and host specified.

parent 79ea59da
......@@ -126,17 +126,23 @@ abstract class Unl_Controller_Action_Authenticate extends Unl_Controller_Action
static $adapter = NULL;
if (!$adapter) {
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
$serviceUrl = 'https://';
} else {
$serviceUrl = 'http://';
}
$path = Zend_Controller_Front::getInstance()->getRouter()->assemble(array(
'module' => $this->getRequest()->getModuleName(),
'controller' => $this->getRequest()->getControllerName(),
'action' => 'cas'
));
$serviceUrl .= $_SERVER['SERVER_NAME'] . $path;
if (parse_url($path, PHP_URL_SCHEME)) {
$serviceUrl = $path;
} else {
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
$serviceUrl = 'https://';
} else {
$serviceUrl = 'http://';
}
$serviceUrl .= $_SERVER['SERVER_NAME'] . $path;
}
$adapter = new Unl_Cas($serviceUrl, 'https://login.unl.edu/cas');
}
......
......@@ -63,17 +63,22 @@ class Unl_Controller_Plugin_Auth_Cas extends Zend_Controller_Plugin_Abstract
}
// Build the cas service URL.
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
$serviceUrl = 'https://';
} else {
$serviceUrl = 'http://';
}
$casPath = Zend_Controller_Front::getInstance()->getRouter()->assemble(array(
'module' => $casModule,
'controller' => $casController,
'action' => $casAction,
));
$serviceUrl .= $_SERVER['SERVER_NAME'] . $casPath;
if (parse_url($path, PHP_URL_SCHEME)) {
$serviceUrl = $casPath;
} else {
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
$serviceUrl = 'https://';
} else {
$serviceUrl = 'http://';
}
$serviceUrl .= $_SERVER['SERVER_NAME'] . $casPath;
}
// Init the CAS Adapter.
$casAdapter = new Unl_Cas($serviceUrl, 'https://login.unl.edu/cas');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment