Merge branch 'v2.0'

This commit is contained in:
Xavier 2019-08-20 21:49:21 +02:00
commit bef05c6f5d
12 changed files with 44 additions and 70 deletions

View File

@ -386,14 +386,13 @@ portal_test: portal
manager_test: manager
@$(MAKE) -C ${SRCMANAGERDIR} test
autopkgtest: autopkg_common autopkg_handler autopkg_manager autopkg_portal autopkg_runtime
autopkgtest: all autopkg_common autopkg_handler autopkg_portal autopkg_manager autopkg_runner
autopkg_%:
./debian/tests/runner build-deps lemonldap-ng-$*
autopkg_runtime:
autopkg_runner:
./debian/tests/runner runtime-deps
#/usr/share/pkg-perl-autopkgtest/runner runtime-deps-and-recommends
# End-to-end tests
# ----------------

1
debian/tests/runner vendored
View File

@ -49,7 +49,6 @@ for LLLIB in $LIST; do
done
cd $LLSOURCEDIR/$LLLIB
pwd
ls -l .prov*
mv -f .proverc.$$ .proverc
cd $LLSOURCEDIR

View File

@ -1187,6 +1187,9 @@ qr/^(?:\*\.)?(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][
'default' => 3,
'type' => 'int'
},
'forceGlobalStorageUpgradeOTT' => {
'type' => 'bool'
},
'formTimeout' => {
'default' => 120,
'type' => 'int'

View File

@ -1403,6 +1403,11 @@ sub attributes {
default => 1,
documentation => 'Upgrade session activation',
},
forceGlobalStorageUpgradeOTT => {
type => 'bool',
documentation =>
'Force upgrade tokens be stored into Global Storage',
},
# 2F
max2FDevices => {

View File

@ -29,7 +29,7 @@ sub addRoutes {
my @enabledKeys = ();
my @keys = qw(virtualHosts samlIDPMetaDataNodes samlSPMetaDataNodes
applicationList oidcOPMetaDataNodes oidcRPMetaDataNodes
casSrvMetaDataNodes casAppMetaDataNodes
casSrvMetaDataNodes casAppMetaDataNodes sfExtra
authChoiceModules grantSessionRules combModules
openIdIDPList);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -56,6 +56,7 @@ my @notManagedAttributes = (
'max2FDevices', 'max2FDevicesNameLength', 'checkTime',
'mySessionAuthorizedRWKeys', 'handlerInternalCache',
'handlerServiceTokenTTL', 'impersonationPrefix', 'pdataDomain',
'forceGlobalStorageUpgradeOTT'
);
# Words used either as attribute name and node title

View File

@ -147,6 +147,14 @@ sub authLogout {
return $res;
}
sub authFinish {
PE_OK;
}
sub authForce {
return 0;
}
## UserDB steps
###############
# Note that UserDB::Combination uses the same object.

View File

@ -56,7 +56,8 @@ sub handler {
my $res = $self->Lemonldap::NG::Common::PSGI::Router::handler($req);
# Avoid permanent loop 'Portal <-> _url' if pdata cookie is not removed
my $url64 = encode_base64( $req->userData->{_url}, '' );
my $url64 = encode_base64( $req->userData->{_url}, '' )
if $req->userData->{_url};
if ( $url64
and !$req->pdata->{keepPdata}
and $req->userData->{_session_id}

View File

@ -30,8 +30,8 @@
# * GET /config/<latest|cfgNum>/<key> : get conf key value
# * GET /config/<latest|cfgNum>?full : get the full configuration
# where <type> is the session type ("global" for SSO session or "persistent")
# * GET /error/<lang>/<errNum> : get <errNum> message from <lang>.json
# Return all error messages if no <errNum> specified
# * GET /error/<lang>/<errNum> : get <errNum> message reference and errors file <lang>.json
# Return 'en' error file if no <lang> specified
#
# - Authorizations for connected users (always):
# * GET /mysession/?whoami : get "my" uid
@ -534,31 +534,10 @@ sub delKeyInMySession {
sub getError {
my ( $self, $req, $lang, $errNum ) = @_;
my $json;
my $langsDir =
$self->conf->{templateDir}
. '/../htdocs'
. $self->conf->{staticPrefix}
. '/languages';
$lang ||= 'en';
$errNum
? $self->logger->debug("GET error: $errNum message from lang: $lang")
: $self->logger->debug("GET ALL error messages from lang: $lang");
if ( open my $file, "<", $langsDir . "/$lang.json" ) {
local $/ = undef;
$json = from_json(<$file>);
}
else {
$self->logger->error("Unable to read $langsDir/$lang.json");
return $self->p->sendJSONresponse( $req,
{ result => 0, lang => $lang, error => 'Unable to read language file' } );
}
%$json = map { $_ =~ /^PE\d+$/ ? ( $_ => $json->{$_} ) : () }
keys %$json
unless ($errNum);
? $self->logger->debug("Send $lang error file path with error: $errNum")
: $self->logger->debug("Send $lang error file path");
return $self->p->sendJSONresponse(
$req,
@ -566,11 +545,9 @@ sub getError {
result => 1,
lang => $lang,
errorNum => $errNum ? $errNum : 'all',
errorMsg => (
$errNum
? $json->{"PE$errNum"}
: $json
)
errorsFileURL =>
"$self->{conf}->{staticPrefix}/languages/$lang.json",
( $errNum ? ( errorMsgRef => "PE$errNum" ) : () ),
}
);
}

View File

@ -131,22 +131,6 @@ ok( $res->{cn} eq 'Frédéric Accents', ' UTF-8 values' );
count(5);
# Retrieve error messages
ok(
$res = $issuer->_get("/error/zz/9"),
'Retrieve error message: 9 from lang: zz'
);
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{result} eq '0', ' Error returned' )
or explain( $res, 'result => 0' );
ok( $res->{lang} eq 'zz', ' Goog lang' )
or explain( $res, 'lang => zz' );
ok( $res->{error} eq 'Unable to read language file',
' Unable to read lang file' )
or explain( $res, 'Unable to read lang file' );
count(5);
ok(
$res = $issuer->_get("/error/fr/9"),
'Retrieve error message: 9 from lang: fr'
@ -158,11 +142,13 @@ ok( $res->{lang} eq 'fr', ' Good lang' )
or explain( $res, 'lang => fr' );
ok( $res->{errorNum} eq '9', ' Good errorNum' )
or explain( $res, 'errorNum => 9' );
ok( $res->{errorMsg} eq 'Veuillez vous authentifier', ' Good errorMsg' )
or explain( $res, 'errorMsg => Veuillez vous authentifier' );
ok( $res->{errorMsgRef} eq 'PE9', ' Good errorMsgName' )
or explain( $res, 'errorMsgName => PE9' );
ok( $res->{errorsFileURL} eq '/static/languages/fr.json', ' Good file URL' )
or explain( $res, 'URL' );
ok( $res->{result} eq '1', ' Good result' )
or explain( $res, 'result => 1' );
count(6);
count(7);
ok(
$res = $issuer->_get("/error/es"),
@ -173,15 +159,13 @@ ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{lang} eq 'es', ' Good lang' )
or explain( $res, 'lang => es' );
ok( $res->{errorNum} eq 'all', ' Good all errorNum' )
ok( $res->{errorNum} eq 'all', ' Good errorNum' )
or explain( $res, 'errorNum => all' );
ok( $res->{errorMsg}->{PE4} eq 'Usuario no reconocido', ' Good errorMsg' )
or explain( $res, 'errorMsg PE4 => Usuario no reconocido' );
ok( keys %{ $res->{errorMsg} } eq 82, ' Good number of error messages found' )
or explain( $res, 'Number of error messages' );
ok( $res->{errorsFileURL} eq '/static/languages/es.json', ' Good file URL' )
or explain( $res, 'URL' );
ok( $res->{result} eq '1', ' Good result' )
or explain( $res, 'result => 1' );
count(7);
count(6);
ok( $res = $issuer->_get("/error"),
'Retrieve ALL error messages from lang: en (default)' );
@ -190,15 +174,13 @@ ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{lang} eq 'en', ' Good lang' )
or explain( $res, 'lang => en' );
ok( $res->{errorNum} eq 'all', ' Good all errorNum' )
ok( $res->{errorNum} eq 'all', ' Good errorNum' )
or explain( $res, 'errorNum => all' );
ok( $res->{errorMsg}->{PE4} eq 'User not found in directory', ' Good errorMsg' )
or explain( $res, 'errorMsg PE4 => User not found in directory' );
ok( keys %{ $res->{errorMsg} } eq 82, ' Good number of error messages found' )
or explain( $res, 'Number of error messages' );
ok( $res->{errorsFileURL} eq '/static/languages/en.json', ' Good file URL' )
or explain( $res, 'URL' );
ok( $res->{result} eq '1', ' Good result' )
or explain( $res, 'result => 1' );
count(7);
count(6);
# Logout
switch ('sp');