|
Lines 29-41
use Carp qw( carp );
Link Here
|
| 29 |
use List::MoreUtils qw( any ); |
29 |
use List::MoreUtils qw( any ); |
| 30 |
|
30 |
|
| 31 |
use Koha::Logger; |
31 |
use Koha::Logger; |
|
|
32 |
use Koha::ShibbolethConfigs; |
| 32 |
|
33 |
|
| 33 |
our ( @ISA, @EXPORT_OK ); |
34 |
our ( @ISA, @EXPORT_OK ); |
| 34 |
|
35 |
|
| 35 |
BEGIN { |
36 |
BEGIN { |
| 36 |
require Exporter; |
37 |
require Exporter; |
| 37 |
@ISA = qw(Exporter); |
38 |
@ISA = qw(Exporter); |
| 38 |
@EXPORT_OK = qw(shib_ok logout_shib login_shib_url checkpw_shib get_login_shib); |
39 |
@EXPORT_OK = qw(shib_ok logout_shib login_shib_url checkpw_shib get_login_shib get_force_sso_setting); |
| 39 |
} |
40 |
} |
| 40 |
|
41 |
|
| 41 |
# Check that shib config is not malformed |
42 |
# Check that shib config is not malformed |
|
Lines 243-256
sub _get_return {
Link Here
|
| 243 |
return $uri_base_part . URI::Escape::uri_escape_utf8($uri_params_part); |
244 |
return $uri_base_part . URI::Escape::uri_escape_utf8($uri_params_part); |
| 244 |
} |
245 |
} |
| 245 |
|
246 |
|
|
|
247 |
sub get_force_sso_setting { |
| 248 |
my ($interface) = @_; |
| 249 |
|
| 250 |
my $db_config = Koha::ShibbolethConfigs->new->get_configuration; |
| 251 |
return 0 unless $db_config; |
| 252 |
|
| 253 |
if ( $interface eq 'opac' ) { |
| 254 |
return $db_config->get_value('force_opac_sso') || 0; |
| 255 |
} else { |
| 256 |
return $db_config->get_value('force_staff_sso') || 0; |
| 257 |
} |
| 258 |
} |
| 259 |
|
| 246 |
sub _get_shib_config { |
260 |
sub _get_shib_config { |
| 247 |
my $config = C4::Context->config('shibboleth'); |
261 |
my $db_config = Koha::ShibbolethConfigs->new->get_configuration; |
| 248 |
|
262 |
|
| 249 |
if ( !$config ) { |
263 |
if ( !$db_config ) { |
| 250 |
Koha::Logger->get->warn('shibboleth config not defined'); |
264 |
Koha::Logger->get->warn('shibboleth config not defined'); |
| 251 |
return 0; |
265 |
return 0; |
| 252 |
} |
266 |
} |
| 253 |
|
267 |
|
|
|
268 |
my $config = $db_config->get_combined_config; |
| 269 |
|
| 270 |
if ( !$config ) { |
| 271 |
Koha::Logger->get->warn('shibboleth config could not be loaded'); |
| 272 |
return 0; |
| 273 |
} |
| 274 |
|
| 254 |
if ( $config->{matchpoint} |
275 |
if ( $config->{matchpoint} |
| 255 |
&& defined( $config->{mapping}->{ $config->{matchpoint} }->{is} ) ) |
276 |
&& defined( $config->{mapping}->{ $config->{matchpoint} }->{is} ) ) |
| 256 |
{ |
277 |
{ |
|
Lines 408-413
A sugar function to that simply returns the current page URI with appropriate pr
Link Here
|
| 408 |
|
429 |
|
| 409 |
This routine is NOT exported |
430 |
This routine is NOT exported |
| 410 |
|
431 |
|
|
|
432 |
=head2 get_force_sso_setting |
| 433 |
|
| 434 |
my $force_sso = get_force_sso_setting($interface); |
| 435 |
|
| 436 |
Returns the force SSO setting for the given interface (opac or intranet). |
| 437 |
Returns 0 if shibboleth is not configured or the setting is disabled. |
| 438 |
|
| 439 |
$interface - 'opac' or 'intranet' |
| 440 |
|
| 411 |
=head2 _get_shib_config |
441 |
=head2 _get_shib_config |
| 412 |
|
442 |
|
| 413 |
my $config = _get_shib_config(); |
443 |
my $config = _get_shib_config(); |
| 414 |
- |
|
|