Bugzilla – Attachment 3550 Details for
Bug 5630
CAS improvements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Follow up patch number 1
0002-Bug-5630-MT4057-Let-the-user-choose-the-CAS-server-t.patch (text/plain), 5.25 KB, created by
Chris Cormack
on 2011-03-30 21:13:21 UTC
(
hide
)
Description:
Follow up patch number 1
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2011-03-30 21:13:21 UTC
Size:
5.25 KB
patch
obsolete
>From 320d4e128432821f6c509ae565a02e472d084db9 Mon Sep 17 00:00:00 2001 >From: Matthias Meusburger <matthias.meusburger@biblibre.com> >Date: Mon, 13 Sep 2010 15:25:16 +0200 >Subject: [PATCH 2/2] Bug 5630 : MT4057: Let the user choose the CAS server to authenticate against in case of multiple CAS servers > >--- > C4/Auth.pm | 31 ++++++++++++++++--- > C4/Auth_with_cas.pm | 21 ++++++++++--- > koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tmpl | 14 ++++++++- > 3 files changed, 55 insertions(+), 11 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 3870692..fa4fd04 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -943,12 +943,33 @@ sub checkauth { > $template->param( OpacPublic => C4::Context->preference("OpacPublic")); > $template->param( loginprompt => 1 ) unless $info{'nopermission'}; > >- if ($cas) { >+ if ($cas) { >+ >+ # Is authentication against multiple CAS servers enabled? >+ >+ if (C4::Auth_with_cas::multipleAuth && !$casparam) { >+ my $casservers = C4::Auth_with_cas::getMultipleAuth(); >+# warn Data::Dumper::Dumper($casservers); >+ my @tmplservers; >+ foreach my $key (keys %$casservers) { >+ warn $key, $casservers->{$key}; >+ push @tmplservers, {name => $key, value => login_cas_url($query, $key)}; >+ } >+ #warn Data::Dumper::Dumper(\@tmplservers); >+ $template->param( >+ casServersLoop => \@tmplservers >+ ); >+ } else { >+ $template->param( >+ casServerUrl => login_cas_url($query), >+ ); >+ } >+ > $template->param( >- casServerUrl => login_cas_url($query), >- invalidCasLogin => $info{'invalidCasLogin'} >- ); >- } >+ invalidCasLogin => $info{'invalidCasLogin'} >+ ); >+ } >+ > my $self_url = $query->url( -absolute => 1 ); > $template->param( > url => $self_url, >diff --git a/C4/Auth_with_cas.pm b/C4/Auth_with_cas.pm >index 6c69fb5..b096232 100644 >--- a/C4/Auth_with_cas.pm >+++ b/C4/Auth_with_cas.pm >@@ -40,11 +40,12 @@ BEGIN { > my $context = C4::Context->new() or die 'C4::Context->new failed'; > my $defaultcasserver; > my $casservers; >+my $yamlauthfile = "../C4/Auth_cas_servers.yaml"; > > > # If there's a configuration for multiple cas servers, then we get it >-if (-e qq($FindBin::Bin/../C4/Auth_cas_servers.yaml)) { >- ($defaultcasserver, $casservers) = YAML::LoadFile(qq($FindBin::Bin/../C4/Auth_cas_servers.yaml)); >+if (multipleAuth()) { >+ ($defaultcasserver, $casservers) = YAML::LoadFile(qq($FindBin::Bin/$yamlauthfile)); > $defaultcasserver = $defaultcasserver->{'default'}; > } else { > # Else, we fall back to casServerUrl syspref >@@ -52,6 +53,16 @@ if (-e qq($FindBin::Bin/../C4/Auth_cas_servers.yaml)) { > $casservers = { 'default' => C4::Context->preference('casServerUrl') }; > } > >+# Is there a configuration file for multiple cas servers? >+sub multipleAuth { >+ return (-e qq($FindBin::Bin/$yamlauthfile)); >+} >+ >+# Returns configured CAS servers' list if multiple authentication is enabled >+sub getMultipleAuth { >+ return $casservers; >+} >+ > # Logout from CAS > sub logout_cas { > my ($query) = @_; >@@ -71,7 +82,6 @@ sub login_cas { > my $casparam = $query->param('cas'); > # FIXME: This should be more generic and handle whatever parameters there might be > $uri .= "?cas=" . $casparam if (defined $casparam); >- warn $defaultcasserver; > $casparam = $defaultcasserver if (not defined $casparam); > my $cas = Authen::CAS::Client->new($casservers->{$casparam}); > print $query->redirect( $cas->login_url($uri)); >@@ -79,13 +89,14 @@ sub login_cas { > > # Returns CAS login URL with callback to the requesting URL > sub login_cas_url { >- my ($query) = @_; >+ >+ my ($query, $key) = @_; > my $uri = $ENV{'SCRIPT_URI'}; > my $casparam = $query->param('cas'); > # FIXME: This should be more generic and handle whatever parameters there might be > $uri .= "?cas=" . $casparam if (defined $casparam); > $casparam = $defaultcasserver if (not defined $casparam); >- warn $defaultcasserver; >+ $casparam = $key if (defined $key); > my $cas = Authen::CAS::Client->new($casservers->{$casparam}); > return $cas->login_url($uri); > } >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tmpl >index bef863d..fcb9cab 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tmpl >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tmpl >@@ -53,7 +53,19 @@ > <p>Sorry, the CAS login failed.</p> > <!-- /TMPL_IF --> > >-<p>If you have a <acronym title="Central Authentication Service">CAS</acronym> account, please <a href="<!-- TMPL_VAR NAME="casServerUrl" -->">click here to login</a>.<p> >+<p>If you have a <acronym title="Central Authentication Service">CAS</acronym> account, >+<!-- TMPL_IF name="casServerUrl" --> >+ please <a href="<!-- TMPL_VAR NAME="casServerUrl" -->">click here to login</a>.<p> >+<!-- /TMPL_IF --> >+ >+<!-- TMPL_IF name="casServersLoop" --> >+please choose against which one you would like to authenticate: </p> >+<ul> >+ <!-- TMPL_LOOP name="casServersLoop" --> >+ <li><a href="<!-- TMPL_VAR name="value" -->"><!-- TMPL_VAR name="name" --></a></li> >+ <!-- /TMPL_LOOP --> >+<!-- /TMPL_IF --> >+</ul> > > <h4>Local Login</h4> > <p>If you do not have a CAS account, but a local account, you can still log in : </p> >-- >1.7.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 5630
:
3549
|
3550
|
3551
|
3552
|
3553
|
3813
|
4716
|
5219
|
5297