Remove unless less statement

This commit is contained in:
Christophe Maudoux 2021-09-23 21:45:42 +02:00
parent a7467b1d15
commit 644c62b81a

View File

@ -3,9 +3,9 @@ require Exporter;
use strict; use strict;
use Digest::MD5; use Digest::MD5;
use MIME::Base64 qw/encode_base64/; use MIME::Base64 qw(encode_base64);
our $VERSION = '2.0.10'; our $VERSION = '2.0.14';
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT_OK = qw(getSameSite getPSessionID genId2F); our @EXPORT_OK = qw(getSameSite getPSessionID genId2F);
@ -15,36 +15,27 @@ sub getPSessionID {
} }
sub genId2F { sub genId2F {
my ( $device ) = @_; my ($device) = @_;
return encode_base64( "$device->{epoch}::$device->{type}::$device->{name}", return encode_base64( "$device->{epoch}::$device->{type}::$device->{name}",
"" ); "" );
} }
sub getSameSite { sub getSameSite {
my ($conf) = @_; my ($conf) = @_;
# Initialize cookie SameSite value # Initialize cookie SameSite value
unless ( $conf->{sameSite} ) { return $conf->{sameSite} if $conf->{sameSite};
# SAML requires SameSite=None for POST bindings # SAML requires SameSite=None for POST bindings
if ( $conf->{issuerDBSAMLActivation} return (
or keys %{ $conf->{samlIDPMetaDataXML} } ) $conf->{issuerDBSAMLActivation}
{ or keys %{ $conf->{samlIDPMetaDataXML} }
return "None"; ) ? 'None' : 'Lax';
}
else {
return "Lax";
}
# if CDA, OIDC, CAS: Lax # if CDA, OIDC, CAS: Lax
# TODO: try to detect when we can use 'Strict'? # TODO: try to detect when we can use 'Strict'?
# Any scenario that uses pdata to save state during login, # Any scenario that uses pdata to save state during login,
# Issuers, and CDA all require at least Lax # Issuers, and CDA all require at least Lax
}
else {
return $conf->{sameSite};
}
} }
1; 1;