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

(-)a/C4/Auth.pm (-10 / +7 lines)
Lines 74-89 BEGIN { Link Here
74
          qw(shib_ok checkpw_shib logout_shib login_shib_url get_login_shib);
74
          qw(shib_ok checkpw_shib logout_shib login_shib_url get_login_shib);
75
75
76
        # Check for good config
76
        # Check for good config
77
        if ( shib_ok() ) {
77
        $shib = 0 unless shib_ok();
78
79
            # Get shibboleth login attribute
80
            $shib_login = get_login_shib();
81
        }
82
83
        # Bad config, disable shibboleth
84
        else {
85
            $shib = 0;
86
        }
87
    }
78
    }
88
    if ($cas) {
79
    if ($cas) {
89
        import C4::Auth_with_cas qw(check_api_auth_cas checkpw_cas login_cas logout_cas login_cas_url);
80
        import C4::Auth_with_cas qw(check_api_auth_cas checkpw_cas login_cas logout_cas login_cas_url);
Lines 159-164 sub get_template_and_user { Link Here
159
    my $in = shift;
150
    my $in = shift;
160
    my ( $user, $cookie, $sessionID, $flags );
151
    my ( $user, $cookie, $sessionID, $flags );
161
152
153
    # Get shibboleth login attribute
154
    $shib_login = get_login_shib() if $shib;
155
162
    C4::Context->interface( $in->{type} );
156
    C4::Context->interface( $in->{type} );
163
157
164
    my $safe_chars = 'a-zA-Z0-9_\-\/';
158
    my $safe_chars = 'a-zA-Z0-9_\-\/';
Lines 749-754 sub checkauth { Link Here
749
    my $query = shift;
743
    my $query = shift;
750
    $debug and warn "Checking Auth";
744
    $debug and warn "Checking Auth";
751
745
746
    # Get shibboleth login attribute
747
    $shib_login = get_login_shib() if $shib;
748
752
    # $authnotrequired will be set for scripts which will run without authentication
749
    # $authnotrequired will be set for scripts which will run without authentication
753
    my $authnotrequired = shift;
750
    my $authnotrequired = shift;
754
    my $flagsrequired   = shift;
751
    my $flagsrequired   = shift;
(-)a/C4/Auth_with_shibboleth.pm (-4 / +18 lines)
Lines 27-32 use C4::Members qw( AddMember_Auto ); 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 236-246 Map their attributes to what you want to see in koha Link Here
236
242
237
Tell apache that we wish to allow koha to authenticate via shibboleth.
243
Tell apache that we wish to allow koha to authenticate via shibboleth.
238
244
239
This is as simple as adding the below to your virtualhost config:
245
This is as simple as adding the below to your virtualhost config (for CGI running):
246
247
 <Location />
248
   AuthType shibboleth
249
   Require shibboleth
250
 </Location>
251
252
Or (for Plack running):
240
253
241
 <Location />
254
 <Location />
242
   AuthType shibboleth
255
   AuthType shibboleth
243
   Require shibboleth
256
   Require shibboleth
257
   ShibUseEnvironment Off
258
   ShibUseHeaders On
244
 </Location>
259
 </Location>
245
260
246
=item 5.
261
=item 5.
247
- 

Return to bug 17776