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 742-747 sub checkauth { Link Here
742
    my $query = shift;
736
    my $query = shift;
743
    $debug and warn "Checking Auth";
737
    $debug and warn "Checking Auth";
744
738
739
    # Get shibboleth login attribute
740
    $shib_login = get_login_shib() if $shib;
741
745
    # $authnotrequired will be set for scripts which will run without authentication
742
    # $authnotrequired will be set for scripts which will run without authentication
746
    my $authnotrequired = shift;
743
    my $authnotrequired = shift;
747
    my $flagsrequired   = shift;
744
    my $flagsrequired   = shift;
(-)a/C4/Auth_with_shibboleth.pm (-4 / +18 lines)
Lines 25-30 use Koha::AuthUtils qw(get_script_name); Link Here
25
use Koha::Database;
25
use Koha::Database;
26
use Carp;
26
use Carp;
27
use CGI;
27
use CGI;
28
use List::Util qw(any);
28
29
29
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $debug);
30
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $debug);
30
31
Lines 80-88 sub get_login_shib { Link Here
80
    my $config = _get_shib_config();
81
    my $config = _get_shib_config();
81
82
82
    my $matchAttribute = $config->{mapping}->{ $config->{matchpoint} }->{is};
83
    my $matchAttribute = $config->{mapping}->{ $config->{matchpoint} }->{is};
83
    $debug and warn $matchAttribute . " value: " . $ENV{$matchAttribute};
84
84
85
    return $ENV{$matchAttribute} || '';
85
    if ( any { /(^psgi|^plack)/i } keys %ENV ) {
86
      $debug and warn $matchAttribute . " value: " . $ENV{"HTTP_".uc($matchAttribute)};
87
      return $ENV{"HTTP_".uc($matchAttribute)} || '';
88
    } else {
89
      $debug and warn $matchAttribute . " value: " . $ENV{$matchAttribute};
90
      return $ENV{$matchAttribute} || '';
91
    }
86
}
92
}
87
93
88
# Checks for password correctness
94
# Checks for password correctness
Lines 217-227 Map their attributes to what you want to see in koha Link Here
217
223
218
Tell apache that we wish to allow koha to authenticate via shibboleth.
224
Tell apache that we wish to allow koha to authenticate via shibboleth.
219
225
220
This is as simple as adding the below to your virtualhost config:
226
This is as simple as adding the below to your virtualhost config (for CGI running):
227
228
 <Location />
229
   AuthType shibboleth
230
   Require shibboleth
231
 </Location>
232
233
Or (for Plack running):
221
234
222
 <Location />
235
 <Location />
223
   AuthType shibboleth
236
   AuthType shibboleth
224
   Require shibboleth
237
   Require shibboleth
238
   ShibUseEnvironment Off
239
   ShibUseHeaders On
225
 </Location>
240
 </Location>
226
241
227
=item 5.
242
=item 5.
228
- 

Return to bug 17776