@@ -, +, @@ sysprefs, move to config --- C4/Auth.pm | 11 +++-------- C4/Auth_with_Shibboleth.pm | 11 ++++++++--- installer/data/mysql/updatedatabase.pl | 8 -------- .../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(+), 40 deletions(-) --- a/C4/Auth.pm +++ a/C4/Auth.pm @@ -54,7 +54,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; @@ -805,7 +805,7 @@ sub checkauth { || $userid || $shib || $pki_field ne 'None' - || $persona ) + || $persona ) { my $password = $query->param('password'); @@ -1063,7 +1063,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"), @@ -1581,11 +1581,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 --- a/C4/Auth_with_Shibboleth.pm +++ a/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 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 in koha-conf.xml'; + # Does it match one of our users ? my $sth = $dbh->prepare("select cardnumber from borrowers where userid=?"); $sth->execute($userid); --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -8056,14 +8056,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) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref +++ a/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 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt +++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt @@ -57,6 +57,22 @@ [% END %] + [% IF ( shibbolethAuthentication ) %] +

Shibboleth Login

+ + [% IF ( invalidShibLogin ) %] + +

Sorry, the Shibboleth login failed.

+ [% END %] + +

If you have a Shibboleth account, + please click here to login.

+ +

Local Login

+

If you do not have a Shibboleth account, but a local account, you can still log in :

+ + [% END %] + [% IF ( casAuthentication ) %]

CAS login

--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt +++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt @@ -65,7 +65,7 @@
[% IF Koha.Preference( 'opacuserlogin' ) == 1 %] [% UNLESS ( loggedinusername ) %] - [% UNLESS ( casAuthentication ) %] + [% UNLESS ( casAuthentication || shibbolethAuthentication ) %]
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tt +++ a/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tt @@ -51,14 +51,14 @@ [% IF ( invalidShibLogin ) %] -

Sorry, the shibboleth login failed.

+

Sorry, the Shibboleth login failed.

[% END %] -

If you have a shibboleth account, +

If you have a Shibboleth account, please click here to login.

Local Login

-

If you do not have a shibboleth account, but a local account, you can still log in :

+

If you do not have a Shibboleth account, but a local account, you can still log in :

[% END %] --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-main.tt +++ a/koha-tmpl/opac-tmpl/prog/en/modules/opac-main.tt @@ -46,8 +46,7 @@
[% IF ( opacuserlogin ) %] [% UNLESS ( loggedinusername ) %] - [% UNLESS ( casAuthentication ) %] - [% UNLESS ( shibbolethAuthentication ) %] + [% UNLESS ( casAuthentication || shibbolethAuthentication ) %]
--- a/opac/opac-main.pl +++ a/opac/opac-main.pl @@ -43,8 +43,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 --- a/opac/opac-user.pl +++ a/opac/opac-user.pl @@ -71,8 +71,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 ); --