BUG8446, Follow up: Adds Shibboleth authentication

- Use syspref OpacBaseURL instead of ENV{'SERVER_NAME'} as this wont
  work if koha is behind a reverse proxy.
  - To use multiple vhosts, set OpacBaseURL per vhost explicitly with
    'SetEnv OpacBaseURL Value' as per Bug 10325

BUG8446, Follow up: Adds Shibboleth authentication

- Ensure user is returned to requested page after authentication
  - Added querystring to the target path in shibboleth URL so
    that when a user is authenticated he/she is returned to the
    correct page they requested before authentication.
    Example where this is important: When a user clicks a direct
    biblio link of the form - /opac-detail.pl?biblionumber=12345

BUG8446, Follow up: Remove unused imports from scripts

- Remove import of deprecated C4::Utils module from shibboleth
  authentication module: Auth_with_shibboleth.pm

Signed-off-by: Jesse Weaver <pianohacker@gmail.com>
Signed-off-by: Matthias Meusburger <matthias.meusburger@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Martin Renvoize 2013-11-29 14:16:27 +00:00 committed by Tomas Cohen Arazi
parent 400b538078
commit 8e09a48e8c
1 changed files with 6 additions and 4 deletions

View File

@ -22,7 +22,6 @@ use warnings;
use C4::Debug;
use C4::Context;
use C4::Utils qw( :all );
use CGI;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $debug);
@ -40,7 +39,7 @@ my $protocol = "https://";
# Logout from Shibboleth
sub logout_shib {
my ($query) = @_;
my $uri = $protocol . $ENV{'SERVER_NAME'};
my $uri = $protocol . C4::Context->preference('OPACBaseURL');
print $query->redirect( $uri . "/Shibboleth.sso/Logout?return=$uri" );
}
@ -48,8 +47,11 @@ sub logout_shib {
sub login_shib_url {
my ($query) = @_;
my $param = $protocol . $ENV{'SERVER_NAME'} . $query->script_name();
my $uri = $protocol . $ENV{'SERVER_NAME'} . "/Shibboleth.sso/Login?target=$param";
my $param = $protocol . C4::Context->preference('OPACBaseURL') . $query->script_name();
if ( $query->query_string() ) {
$param = $param . '%3F' . $query->query_string();
}
my $uri = $protocol . C4::Context->preference('OPACBaseURL') . "/Shibboleth.sso/Login?target=$param";
return $uri;
}