diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/REST.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/REST.pm index f7e27b02a..58279b8f4 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/REST.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/REST.pm @@ -122,7 +122,7 @@ sub verify { $args->{$k} = ( $k eq 'code' ? $code - : $req->sessionInfo->{ $self->{vrfyAttrs}->{$k} } + : $session->{ $self->{vrfyAttrs}->{$k} } ); } diff --git a/lemonldap-ng-portal/t/72-2F-REST-with-History.t b/lemonldap-ng-portal/t/72-2F-REST-with-History.t index ff0b13e47..e85bd69cf 100644 --- a/lemonldap-ng-portal/t/72-2F-REST-with-History.t +++ b/lemonldap-ng-portal/t/72-2F-REST-with-History.t @@ -5,20 +5,22 @@ use IO::String; use LWP::UserAgent; use LWP::Protocol::PSGI; use Plack::Request; +use JSON qw/from_json/; require 't/test-lib.pm'; -my $maintests = 6; +my $maintests = 7; LWP::Protocol::PSGI->register( sub { my $req = Plack::Request->new(@_); if ( $req->path_info eq '/init' ) { - ok( $req->content eq '{"name":"dwho"}', ' Init req gives dwho' ) - or explain( $req->content, '{"name":"dwho"}' ); + my $json = from_json( $req->content ); + is( $json->{name}, "dwho", ' Init req gives dwho' ); } elsif ( $req->path_info eq '/vrfy' ) { - ok( $req->content eq '{"code":"1234"}', ' Code is 1234' ) - or explain( $req->content, '{"code":"1234"}' ); + my $json = from_json( $req->content ); + is( $json->{name}, "dwho", ' Verify req contains name' ); + is( $json->{code}, "1234", ' Verify req contains code' ); } else { fail( ' Bad REST call ' . $req->path_info ); @@ -38,7 +40,7 @@ my $client = LLNG::Manager::Test->new( { rest2fInitUrl => 'http://auth.example.com/init', rest2fInitArgs => { name => 'uid' }, rest2fVerifyUrl => 'http://auth.example.com/vrfy', - rest2fVerifyArgs => { code => 'code' }, + rest2fVerifyArgs => { name => 'uid', code => 'code' }, loginHistoryEnabled => 1, authentication => 'Demo', userDB => 'Same',