View | Details | Raw Unified | Return to bug 17776
Collapse All | Expand All

(-)a/C4/Auth.pm (-10 / +8 lines)
Lines 76-91 BEGIN { Link Here
76
          qw(shib_ok checkpw_shib logout_shib login_shib_url get_login_shib);
76
          qw(shib_ok checkpw_shib logout_shib login_shib_url get_login_shib);
77
77
78
        # Check for good config
78
        # Check for good config
79
        if ( shib_ok() ) {
79
        $shib = 0 unless shib_ok();
80
81
            # Get shibboleth login attribute
82
            $shib_login = get_login_shib();
83
        }
84
85
        # Bad config, disable shibboleth
86
        else {
87
            $shib = 0;
88
        }
89
    }
80
    }
90
    if ($cas) {
81
    if ($cas) {
91
        import C4::Auth_with_cas qw(check_api_auth_cas checkpw_cas login_cas logout_cas login_cas_url logout_if_required);
82
        import C4::Auth_with_cas qw(check_api_auth_cas checkpw_cas login_cas logout_cas login_cas_url logout_if_required);
Lines 161-166 sub get_template_and_user { Link Here
161
    my $in = shift;
152
    my $in = shift;
162
    my ( $user, $cookie, $sessionID, $flags );
153
    my ( $user, $cookie, $sessionID, $flags );
163
154
155
    # Get shibboleth login attribute
156
    $shib_login = get_login_shib() if $shib;
157
164
    C4::Context->interface( $in->{type} );
158
    C4::Context->interface( $in->{type} );
165
159
166
    $in->{'authnotrequired'} ||= 0;
160
    $in->{'authnotrequired'} ||= 0;
Lines 790-795 sub _timeout_syspref { Link Here
790
sub checkauth {
784
sub checkauth {
791
    my $query = shift;
785
    my $query = shift;
792
    $debug and warn "Checking Auth";
786
    $debug and warn "Checking Auth";
787
788
    # Get shibboleth login attribute
789
    $shib_login = get_login_shib() if $shib;
790
793
    # $authnotrequired will be set for scripts which will run without authentication
791
    # $authnotrequired will be set for scripts which will run without authentication
794
    my $authnotrequired = shift;
792
    my $authnotrequired = shift;
795
    my $flagsrequired   = shift;
793
    my $flagsrequired   = shift;
(-)a/C4/Auth_with_shibboleth.pm (-4 / +18 lines)
Lines 27-32 use Koha::Patrons; Link Here
27
use C4::Members::Messaging;
27
use C4::Members::Messaging;
28
use Carp;
28
use Carp;
29
use CGI;
29
use CGI;
30
use List::Util qw(any);
30
31
31
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $debug);
32
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $debug);
32
33
Lines 82-90 sub get_login_shib { Link Here
82
    my $config = _get_shib_config();
83
    my $config = _get_shib_config();
83
84
84
    my $matchAttribute = $config->{mapping}->{ $config->{matchpoint} }->{is};
85
    my $matchAttribute = $config->{mapping}->{ $config->{matchpoint} }->{is};
85
    $debug and warn $matchAttribute . " value: " . $ENV{$matchAttribute};
86
86
87
    return $ENV{$matchAttribute} || '';
87
    if ( any { /(^psgi|^plack)/i } keys %ENV ) {
88
      $debug and warn $matchAttribute . " value: " . $ENV{"HTTP_".uc($matchAttribute)};
89
      return $ENV{"HTTP_".uc($matchAttribute)} || '';
90
    } else {
91
      $debug and warn $matchAttribute . " value: " . $ENV{$matchAttribute};
92
      return $ENV{$matchAttribute} || '';
93
    }
88
}
94
}
89
95
90
# Checks for password correctness
96
# Checks for password correctness
Lines 247-257 Map their attributes to what you want to see in koha Link Here
247
253
248
Tell apache that we wish to allow koha to authenticate via shibboleth.
254
Tell apache that we wish to allow koha to authenticate via shibboleth.
249
255
250
This is as simple as adding the below to your virtualhost config:
256
This is as simple as adding the below to your virtualhost config (for CGI running):
257
258
 <Location />
259
   AuthType shibboleth
260
   Require shibboleth
261
 </Location>
262
263
Or (for Plack running):
251
264
252
 <Location />
265
 <Location />
253
   AuthType shibboleth
266
   AuthType shibboleth
254
   Require shibboleth
267
   Require shibboleth
268
   ShibUseEnvironment Off
269
   ShibUseHeaders On
255
 </Location>
270
 </Location>
256
271
257
=item 5.
272
=item 5.
258
- 

Return to bug 17776