my $persist = $cgi->param('persist');
# initial log form only
+ my $ticket = $cgi->param('ticket');
+ my $cas_redirect_to = $cgi->param('redirect_to');
+ if ($cgi->cookie(COOKIE_URL_CAS)) {
+ $cas_redirect_to = $cgi->cookie(COOKIE_URL_CAS);
+ }
+ my $cas_flag = '0';
+
+ # initial log form only
+ if ($ticket) {
+ # CAS does not have either username or password at this point, so we fudge these
+ # values for the other checks
+ $username = '_CAS_';
+ $password = '_CAS_';
+
+ }
+
+ my $login_page = sprintf('%s://%s%s/login',($self->ctx->{is_staff} ? 'oils' : 'https'), $self->ctx->{hostname}, $self->ctx->{opac_root});
+
+ # CAS does not handle complex URLs, so we put the URL in a cookie
+ if (!$cgi->cookie(COOKIE_URL_CAS) && $cas_redirect_to && !$username && !$password) {
+ return $self->generic_redirect(
+ "$login_page?redirect_to=$cas_redirect_to",
+ [
+ # contains the service url for CAS
+ $cgi->cookie(
+ -name => COOKIE_URL_CAS,
+ -path => '/',
+ -secure => 0,
+ -value => $cas_redirect_to,
+ -expires => '+10m'
+ )
+ ]
+ );
+ }
+
return Apache2::Const::OK unless $username and $password;
+ # Should we append an email hostname to the username?
+ my $ou_email_host = $cgi->param('ou_email_host') || '';
+
my $auth_proxy_enabled = 0; # default false
try { # if the service is not running, just let this fail silently
$auth_proxy_enabled = $U->simplereq(