Fix Apache::Session::REST::get_key_from_all_sessions when using CODE (#1813)

environments/ppa-mbqj77/deployments/765
Xavier Guimard 6 years ago
parent 93ccb9fd76
commit 390ccb4f5b
  1. 2
      lemonldap-ng-common/lib/Lemonldap/NG/Common/Apache/Session/REST.pm
  2. 18
      lemonldap-ng-portal/t/34-Auth-Proxy-and-REST-Server.t

@ -299,7 +299,7 @@ sub _getAll {
foreach (qw(baseUrl user password realm lwpOpts lwpSslOpts kind)) {
$self->{$_} = $args->{$_};
}
$self->{data} = { data => ( ref($data) eq 'CODE' ? {} : $data ) };
$self->{data} = { data => ( ref($data) eq 'CODE' ? undef : $data ) };
die('baseUrl is required') unless ( $self->{baseUrl} );
my $req = HTTP::Request->new( POST => $self->base . "?$query" );
eval {

@ -195,6 +195,24 @@ if ( ok( ref($res) eq 'HASH', ' Result is an hash' ) ) {
}
count(3);
ok($res=Lemonldap::NG::Common::Apache::Session::REST->get_key_from_all_sessions( {baseUrl => 'http://auth.idp.com/sessions/global/'},sub{return 'a'}),'Search all sessions with a code');
if ( ok( ref($res) eq 'HASH', ' Result is an hash' ) ) {
my $tmp = 1;
my $c = 0;
foreach ( keys %$res ) {
$c++;
unless ( $res->{$_} eq 'a' ) {
$tmp = 0;
diag "Bad session:\n" . Dumper( $res->{$_} );
}
}
ok( $c == $c1, " Found the same count") or explain($c,$c1);
ok( $tmp, ' All sessions are valid' );
count(2);
}
count(1);
ok(
$res = Lemonldap::NG::Common::Apache::Session::REST->searchOn( {
baseUrl => 'http://auth.idp.com/sessions/global/'

Loading…
Cancel
Save