Bugzilla – Attachment 31836 Details for
Bug 8446
Shibboleth authentication
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
BUG8446, qa-followup: Cleanup tabs and license
BUG8446-qa-followup-Cleanup-tabs-and-license.patch (text/plain), 9.39 KB, created by
Martin Renvoize (ashimema)
on 2014-09-23 13:58:06 UTC
(
hide
)
Description:
BUG8446, qa-followup: Cleanup tabs and license
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2014-09-23 13:58:06 UTC
Size:
9.39 KB
patch
obsolete
>From 3c7180601048c0918a431818c3745c207356b77f Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 23 Sep 2014 13:52:07 +0000 >Subject: [PATCH] BUG8446, qa-followup: Cleanup tabs and license > >--- > C4/Auth.pm | 26 ++++----- > C4/Auth_with_shibboleth.pm | 55 +++++++++++--------- > .../opac-tmpl/bootstrap/en/includes/masthead.inc | 2 +- > 3 files changed, 44 insertions(+), 39 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 646d933..c0bd618 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -305,10 +305,10 @@ sub get_template_and_user { > } > else { # if this is an anonymous session, setup to display public lists... > >- # If shibboleth is enabled, and we're in an anonymous session, we should allow >+ # If shibboleth is enabled, and we're in an anonymous session, we should allow > # the user to attemp login via shibboleth. >- if ( $shib ) { >- $template->param( shibbolethAuthentication => $shib, >+ if ( $shib ) { >+ $template->param( shibbolethAuthentication => $shib, > shibbolethLoginUrl => login_shib_url($in->{'query'}), > ); > # If shibboleth is enabled and we have a shibboleth login attribute, >@@ -761,7 +761,7 @@ sub checkauth { > } > elsif ($logout) { > # voluntary logout the user >- # check wether the user was using their shibboleth session or a local one >+ # check wether the user was using their shibboleth session or a local one > my $shibSuccess = C4::Context->userenv->{'shibboleth'}; > $session->delete(); > $session->flush; >@@ -853,21 +853,21 @@ sub checkauth { > || $persona ) > { > my $password = $query->param('password'); >- my $shibSuccess = 0; >+ my $shibSuccess = 0; > > my ( $return, $cardnumber ); >- # If shib is enabled and we have a shib login, does the login match a valid koha user >+ # If shib is enabled and we have a shib login, does the login match a valid koha user > if ( $shib && $shib_login && $type eq 'opac' ) { > my $retuserid; >- # Do not pass password here, else shib will not be checked in checkpw. >+ # Do not pass password here, else shib will not be checked in checkpw. > ( $return, $cardnumber, $retuserid ) = checkpw( $dbh, $userid, undef, $query ); > $userid = $retuserid; >- $shibSuccess = $return; >+ $shibSuccess = $return; > $info{'invalidShibLogin'} = 1 unless ($return); > } >- # If shib login and match were successfull, skip further login methods >- unless ( $shibSuccess ) { >- if ( $cas && $query->param('ticket') ) { >+ # If shib login and match were successfull, skip further login methods >+ unless ( $shibSuccess ) { >+ if ( $cas && $query->param('ticket') ) { > my $retuserid; > ( $return, $cardnumber, $retuserid ) = > checkpw( $dbh, $userid, $password, $query ); >@@ -934,7 +934,7 @@ sub checkauth { > ( $return, $cardnumber, $retuserid ) = > checkpw( $dbh, $userid, $password, $query ); > $userid = $retuserid if ( $retuserid ); >- $info{'invalid_username_or_password'} = 1 unless ($return); >+ $info{'invalid_username_or_password'} = 1 unless ($return); > } } > if ($return) { > #_session_log(sprintf "%20s from %16s logged in at %30s.\n", $userid,$ENV{'REMOTE_ADDR'},(strftime '%c', localtime)); >@@ -1023,7 +1023,7 @@ sub checkauth { > $session->param('emailaddress',$emailaddress); > $session->param('ip',$session->remote_addr()); > $session->param('lasttime',time()); >- $session->param('shibboleth',$shibSuccess); >+ $session->param('shibboleth',$shibSuccess); > $debug and printf STDERR "AUTH_4: (%s)\t%s %s - %s\n", map {$session->param($_)} qw(cardnumber firstname surname branch) ; > } > elsif ( $return == 2 ) { >diff --git a/C4/Auth_with_shibboleth.pm b/C4/Auth_with_shibboleth.pm >index 863ea82..ec954cd 100644 >--- a/C4/Auth_with_shibboleth.pm >+++ b/C4/Auth_with_shibboleth.pm >@@ -1,21 +1,21 @@ > package C4::Auth_with_shibboleth; > >-# Copyright 2011 BibLibre >+# Copyright 2014 PTFS Europe > # > # This file is part of Koha. > # >-# Koha is free software; you can redistribute it and/or modify it under the >-# terms of the GNU General Public License as published by the Free Software >-# Foundation; either version 2 of the License, or (at your option) any later >-# version. >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. > # >-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >-# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. > # >-# You should have received a copy of the GNU General Public License along >-# with Koha; if not, write to the Free Software Foundation, Inc., >-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. > > use strict; > use warnings; >@@ -29,17 +29,18 @@ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $debug); > > BEGIN { > require Exporter; >- $VERSION = 3.03; # set the version for version checking >+ $VERSION = 3.03; # set the version for version checking > $debug = $ENV{DEBUG}; > @ISA = qw(Exporter); >- @EXPORT = qw(shib_ok logout_shib login_shib_url checkpw_shib get_login_shib); >+ @EXPORT = >+ qw(shib_ok logout_shib login_shib_url checkpw_shib get_login_shib); > } > > # Check that shib config is not malformed > sub shib_ok { > my $config = _get_shib_config(); > >- if ( $config ) { >+ if ($config) { > return 1; > } > >@@ -68,20 +69,20 @@ sub login_shib_url { > # Returns shibboleth user login > sub get_login_shib { > >- # In case of a Shibboleth authentication, we expect a shibboleth user attribute >- # to contain the login match point of the shibboleth-authenticated user. This match >- # point is configured in koha-conf.xml >+# In case of a Shibboleth authentication, we expect a shibboleth user attribute >+# to contain the login match point of the shibboleth-authenticated user. This match >+# point is configured in koha-conf.xml > >- # Shibboleth attributes are mapped into http environmement variables, so we're getting >- # the match point of the user this way >+# Shibboleth attributes are mapped into http environmement variables, so we're getting >+# the match point of the user this way > > # Get shibboleth config > my $config = _get_shib_config(); > > my $matchAttribute = $config->{mapping}->{ $config->{matchpoint} }->{is}; >- $debug and warn $matchAttribute . " value: " . $ENV{ $matchAttribute }; >+ $debug and warn $matchAttribute . " value: " . $ENV{$matchAttribute}; > >- return $ENV{ $matchAttribute } || ''; >+ return $ENV{$matchAttribute} || ''; > } > > # Checks for password correctness >@@ -94,18 +95,22 @@ sub checkpw_shib { > my $config = _get_shib_config(); > $debug and warn "User Shibboleth-authenticated as: $match"; > >- # Does the given shibboleth attribute value ($match) match a valid koha user ? >- my $sth = $dbh->prepare("select cardnumber, userid from borrowers where $config->{matchpoint}=?"); >+ # Does the given shibboleth attribute value ($match) match a valid koha user ? >+ my $sth = $dbh->prepare( >+ "select cardnumber, userid from borrowers where $config->{matchpoint}=?" >+ ); > $sth->execute($match); > if ( $sth->rows ) { > my @retvals = $sth->fetchrow; > $retnumber = $retvals[0]; >- $userid = $retvals[1]; >+ $userid = $retvals[1]; > return ( 1, $retnumber, $userid ); > } > > # If we reach this point, the user is not a valid koha user >- $debug and warn "User with $config->{matchpoint} of $match is not a valid Koha user"; >+ $debug >+ and warn >+ "User with $config->{matchpoint} of $match is not a valid Koha user"; > return 0; > } > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >index 43e0cd8..ca85378 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >@@ -292,7 +292,7 @@ > <p>If you have a Shibboleth account, please <a href="[% shibbolethLoginUrl %]">click here to login</a>.</p> > <h4>Local Login</h4> > [% END %] >- [% END %] >+ [% END %] > <input type="hidden" name="koha_login_context" value="opac" /> > <fieldset class="brief"> > <label for="muserid">Login:</label><input type="text" id="muserid" name="userid" /> >-- >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