Bugzilla – Attachment 32367 Details for
Bug 8446
Shibboleth authentication
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
BUG8446, Follow up: Remove unnecessary sysprefs, move to config
BUG8446-Follow-up-Remove-unnecessary-sysprefs-move.patch (text/plain), 11.35 KB, created by
Martin Renvoize (ashimema)
on 2014-10-15 16:23:00 UTC
(
hide
)
Description:
BUG8446, Follow up: Remove unnecessary sysprefs, move to config
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2014-10-15 16:23:00 UTC
Size:
11.35 KB
patch
obsolete
>From 3d1b4ae0b26c0e73d2b5b57b516514ae4515986a Mon Sep 17 00:00:00 2001 >From: Jesse Weaver <pianohacker@gmail.com> >Date: Mon, 21 Oct 2013 10:17:08 -0600 >Subject: [PATCH] BUG8446, Follow up: Remove unnecessary sysprefs, move to > config > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Signed-off-by: Matthias Meusburger <matthias.meusburger@biblibre.com> >Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> >--- > C4/Auth.pm | 11 +++-------- > C4/Auth_with_Shibboleth.pm | 11 ++++++++--- > installer/data/mysql/updatedatabase.pl | 9 --------- > .../prog/en/modules/admin/preferences/admin.pref | 11 ----------- > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt | 16 ++++++++++++++++ > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt | 2 +- > koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tt | 6 +++--- > koha-tmpl/opac-tmpl/prog/en/modules/opac-main.tt | 3 +-- > opac/opac-main.pl | 3 +-- > opac/opac-user.pl | 3 +-- > 10 files changed, 34 insertions(+), 41 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index b2dd941..552a018 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -55,7 +55,7 @@ BEGIN { > %EXPORT_TAGS = ( EditPermissions => [qw(get_all_subpermissions get_user_subpermissions)] ); > $ldap = C4::Context->config('useldapserver') || 0; > $cas = C4::Context->preference('casAuthentication'); >- $shib = C4::Context->preference('shibbolethAuthentication'); >+ $shib = C4::Context->config('useshibboleth') || 0; > $caslogout = C4::Context->preference('casLogout'); > require C4::Auth_with_cas; # no import > require C4::Auth_with_Shibboleth; >@@ -825,7 +825,7 @@ sub checkauth { > || $userid > || $shib > || $pki_field ne 'None' >- || $persona ) >+ || $persona ) > { > my $password = $query->param('password'); > >@@ -1083,7 +1083,7 @@ sub checkauth { > login => 1, > INPUTS => \@inputs, > casAuthentication => C4::Context->preference("casAuthentication"), >- shibbolethAuthentication => C4::Context->preference("shibbolethAuthentication"), >+ shibbolethAuthentication => $shib, > suggestion => C4::Context->preference("suggestion"), > virtualshelves => C4::Context->preference("virtualshelves"), > LibraryName => "" . C4::Context->preference("LibraryName"), >@@ -1602,11 +1602,6 @@ sub checkpw { > # (defined in the shibbolethLoginAttribute) tto contain the login of the > # shibboleth-authenticated user > >- # Shibboleth attributes are mapped into http environmement variables, >- # so we're getting the login of the user this way >- my $attributename = C4::Context->preference('shibbolethLoginAttribute'); >- my $attributevalue = $ENV{$attributename}; >- > # Then, we check if it matches a valid koha user > if ($shib_login) { > my ( $retval, $retcard, $retuserid ) = C4::Auth_with_Shibboleth::checkpw_shib( $dbh, $shib_login ); # EXTERNAL AUTH >diff --git a/C4/Auth_with_Shibboleth.pm b/C4/Auth_with_Shibboleth.pm >index 13f4b79..5c6c6b3 100644 >--- a/C4/Auth_with_Shibboleth.pm >+++ b/C4/Auth_with_Shibboleth.pm >@@ -22,6 +22,7 @@ use warnings; > > use C4::Debug; > use C4::Context; >+use Carp; > use CGI; > > use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $debug); >@@ -64,11 +65,13 @@ sub get_login_shib { > # Shibboleth attributes are mapped into http environmement variables, > # so we're getting the login of the user this way > >- my $shibbolethLoginAttribute = C4::Context->preference('shibbolethLoginAttribute'); >- $debug and warn "shibbolethLoginAttribute value: $shibbolethLoginAttribute"; >+ my $shib = C4::Context->config('shibboleth') or croak 'No <shibboleth> in koha-conf.xml'; >+ >+ my $shibbolethLoginAttribute = $shib->{'userid'}; >+ $debug and warn "shibboleth->userid value: $shibbolethLoginAttribute"; > $debug and warn "$shibbolethLoginAttribute value: " . $ENV{$shibbolethLoginAttribute}; > >- return $ENV{$shibbolethLoginAttribute}; >+ return $ENV{$shibbolethLoginAttribute} || ''; > } > > # Checks for password correctness >@@ -80,6 +83,8 @@ sub checkpw_shib { > my $retnumber; > $debug and warn "User Shibboleth-authenticated as: $userid"; > >+ my $shib = C4::Context->config('shibboleth') or croak 'No <shibboleth> in koha-conf.xml'; >+ > # Does it match one of our users ? > my $sth = $dbh->prepare("select cardnumber from borrowers where userid=?"); > $sth->execute($userid); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index cdad32e..eb12838 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -8800,15 +8800,6 @@ if ( CheckVersion($DBversion) ) { > SetVersion($DBversion); > } > >- >-$DBversion = "XXX"; >-if (C4::Context->preference("Version") < TransformToNum($DBversion)) { >- $dbh->do("INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('shibbolethAuthentication','','','Enable or disable Shibboleth authentication','YesNo')"); >- $dbh->do("INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('shibbolethLoginAttribute','','','Which shibboleth user attribute should be used to match koha user login?','')"); >- print "Upgrade to $DBversion done (Adds shibbolethAuthentication and shibbolethLoginAttribute preferences)\n"; >- SetVersion ($DBversion); >-} >- > =head1 FUNCTIONS > > =head2 TableExists($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref >index 32665b2..1215ac1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref >@@ -105,17 +105,6 @@ Administration: > yes: Allow > no: "Don't Allow" > - Mozilla persona for login >- Shibboleth Authentication: >- - >- - pref: shibbolethAuthentication >- default: 0 >- choices: >- yes: Use >- no: "Don't use" >- - Shibboleth for login authentication. >- - >- - Which shibboleth user attribute should be used to match koha user login? >- - pref: shibbolethLoginAttribute > Search Engine: > - > - pref: SearchEngine >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt >index ca492d0..f501c22 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt >@@ -57,6 +57,22 @@ > </div> > [% END %] > >+ [% IF ( shibbolethAuthentication ) %] >+ <h4>Shibboleth Login</h4> >+ >+ [% IF ( invalidShibLogin ) %] >+ <!-- This is what is displated if shibboleth login has failed --> >+ <p>Sorry, the Shibboleth login failed.</p> >+ [% END %] >+ >+ <p>If you have a Shibboleth account, >+ please <a href="[% shibbolethLoginUrl %]">click here to login</a>.</p> >+ >+ <h4>Local Login</h4> >+ <p>If you do not have a Shibboleth account, but a local account, you can still log in : </p> >+ >+ [% END %] >+ > [% IF ( casAuthentication ) %] > <h4>CAS login</h4> > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt >index 5486492..bda8913 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt >@@ -65,7 +65,7 @@ > <div class="span3"> > [% IF Koha.Preference( 'opacuserlogin' ) == 1 %] > [% UNLESS ( loggedinusername ) %] >- [% UNLESS ( casAuthentication ) %] >+ [% UNLESS ( casAuthentication || shibbolethAuthentication ) %] > <div id="login"> > <form action="/cgi-bin/koha/opac-user.pl" method="post" name="auth" id="auth"> > <input type="hidden" name="koha_login_context" value="opac" /> >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tt >index 9bf09c5..4d561ba 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tt >@@ -51,14 +51,14 @@ > > [% IF ( invalidShibLogin ) %] > <!-- This is what is displated if shibboleth login has failed --> >-<p>Sorry, the shibboleth login failed.</p> >+<p>Sorry, the Shibboleth login failed.</p> > [% END %] > >-<p>If you have a shibboleth account, >+<p>If you have a Shibboleth account, > please <a href="[% shibbolethLoginUrl %]">click here to login</a>.</p> > > <h4>Local Login</h4> >-<p>If you do not have a shibboleth account, but a local account, you can still log in : </p> >+<p>If you do not have a Shibboleth account, but a local account, you can still log in : </p> > > [% END %] > >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-main.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-main.tt >index 4a783e5..dd3c3e2 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-main.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-main.tt >@@ -46,8 +46,7 @@ > <div class="yui-u"> > [% IF ( opacuserlogin ) %] > [% UNLESS ( loggedinusername ) %] >- [% UNLESS ( casAuthentication ) %] >- [% UNLESS ( shibbolethAuthentication ) %] >+ [% UNLESS ( casAuthentication || shibbolethAuthentication ) %] > <div id="login" class="container clearfix"> > <form action="/cgi-bin/koha/opac-user.pl" method="post" name="auth" id="auth"> > <input type="hidden" name="koha_login_context" value="opac" /> >diff --git a/opac/opac-main.pl b/opac/opac-main.pl >index 6eb6add..b1b92c0 100755 >--- a/opac/opac-main.pl >+++ b/opac/opac-main.pl >@@ -44,8 +44,7 @@ $template->param( > casAuthentication => $casAuthentication, > ); > >-my $shibbolethAuthentication = C4::Context->preference('shibbolethAuthentication'); >-$template->param( shibbolethAuthentication => $shibbolethAuthentication); >+$template->param( shibbolethAuthentication => C4::Context->config('useshibboleth') ); > > # display news > # use cookie setting for language, bug default to syspref if it's not set >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index 9c7f292..aae78ec 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -74,8 +74,7 @@ for ( C4::Context->preference("OPACShowHoldQueueDetails") ) { > my $patronupdate = $query->param('patronupdate'); > my $canrenew = 1; > >-my $shibbolethAuthentication = C4::Context->preference('shibbolethAuthentication'); >-$template->param( shibbolethAuthentication => $shibbolethAuthentication ); >+$template->param( shibbolethAuthentication => C4::Context->config('useshibboleth') ); > > # get borrower information .... > my ( $borr ) = GetMemberDetails( $borrowernumber ); >-- >1.7.10.4
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 8446
:
10841
|
22098
|
22107
|
22860
|
23224
|
23225
|
23226
|
25765
|
25766
|
26176
|
26177
|
26178
|
26187
|
26749
|
26750
|
26751
|
26752
|
26760
|
26761
|
26762
|
28892
|
28893
|
28894
|
28895
|
28896
|
28897
|
28898
|
28899
|
28900
|
28901
|
28902
|
28903
|
30017
|
30018
|
30019
|
30020
|
30021
|
30022
|
30023
|
30030
|
30031
|
30033
|
30283
|
30284
|
30285
|
30286
|
30335
|
30353
|
30354
|
30355
|
30356
|
30384
|
30594
|
30604
|
30605
|
30616
|
30617
|
30618
|
30619
|
30620
|
30621
|
30684
|
31407
|
31408
|
31836
|
31905
|
31906
|
31907
|
32125
|
32158
|
32162
|
32163
|
32164
|
32165
|
32166
|
32167
|
32168
|
32169
|
32170
|
32365
|
32366
| 32367 |
32368
|
32369
|
32370
|
32371
|
32372
|
32373
|
32374
|
32426
|
32427