Update test to use getSession (#3075)

git-backend
Yadd 2 years ago
parent 7ba02e9b4c
commit 737d5c5265
  1. 7
      lemonldap-ng-portal/t/02-Password-Demo.t
  2. 6
      lemonldap-ng-portal/t/02-Password-Encrypted-Demo.t
  3. 22
      lemonldap-ng-portal/t/04-language-selection.t
  4. 16
      lemonldap-ng-portal/t/20-Auth-DBI-utf8.t
  5. 13
      lemonldap-ng-portal/t/28-AuthChoice-Custom.t
  6. 13
      lemonldap-ng-portal/t/28-AuthChoice-with-over.t
  7. 14
      lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Artifact-with-SOAP-SLO-IdP-initiated.t
  8. 14
      lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Artifact-with-SOAP-SLO.t
  9. 7
      lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-POST-Choice-2FA.t
  10. 20
      lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-POST-IdP-initiated.t
  11. 14
      lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-POST-Missing-SLO.t
  12. 19
      lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-POST.t
  13. 14
      lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Redirect-IdP-initiated.t
  14. 17
      lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Redirect-MultipleSP-Missing-SLO.t
  15. 20
      lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Redirect-MultipleSP.t
  16. 14
      lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Redirect.t
  17. 17
      lemonldap-ng-portal/t/30-CDC.t
  18. 14
      lemonldap-ng-portal/t/31-Auth-and-issuer-CAS-Logout-20.t
  19. 14
      lemonldap-ng-portal/t/31-Auth-and-issuer-CAS-Logout-30.t
  20. 14
      lemonldap-ng-portal/t/31-Auth-and-issuer-CAS-declared-app-multiple-urls.t
  21. 14
      lemonldap-ng-portal/t/31-Auth-and-issuer-CAS-declared-app-userattr.t
  22. 14
      lemonldap-ng-portal/t/31-Auth-and-issuer-CAS-declared-app.t
  23. 13
      lemonldap-ng-portal/t/31-Auth-and-issuer-CAS-default.t
  24. 14
      lemonldap-ng-portal/t/31-Auth-and-issuer-CAS-proxied.t
  25. 13
      lemonldap-ng-portal/t/32-Auth-and-issuer-OIDC-authorization_code-OP-logout.t
  26. 2
      lemonldap-ng-portal/t/32-Auth-and-issuer-OIDC-authorization_code-different-sub.t
  27. 18
      lemonldap-ng-portal/t/32-Auth-and-issuer-OIDC-authorization_code-jwt-userinfo.t
  28. 22
      lemonldap-ng-portal/t/32-Auth-and-issuer-OIDC-authorization_code-public_client.t
  29. 18
      lemonldap-ng-portal/t/32-Auth-and-issuer-OIDC-authorization_code-with-info.t
  30. 18
      lemonldap-ng-portal/t/32-Auth-and-issuer-OIDC-authorization_code-with-none-alg.t
  31. 25
      lemonldap-ng-portal/t/32-Auth-and-issuer-OIDC-authorization_code.t
  32. 18
      lemonldap-ng-portal/t/32-OIDC-Code-Flow-with-2F.t
  33. 12
      lemonldap-ng-portal/t/32-OIDC-Logout-from-RP-bypass-confirm.t
  34. 12
      lemonldap-ng-portal/t/32-OIDC-Logout-redirect-uri-not-allowed.t
  35. 124
      lemonldap-ng-portal/t/34-Auth-Proxy-and-REST-Server.t
  36. 30
      lemonldap-ng-portal/t/35-REST-config-backend.t
  37. 20
      lemonldap-ng-portal/t/35-REST-export-password.t
  38. 41
      lemonldap-ng-portal/t/35-REST-sessions-with-REST-server.t
  39. 12
      lemonldap-ng-portal/t/36-Combination-Custom.t
  40. 12
      lemonldap-ng-portal/t/36-Combination.t
  41. 17
      lemonldap-ng-portal/t/37-SAML-SP-POST-to-CAS-server-with-Choice.t
  42. 17
      lemonldap-ng-portal/t/37-SAML-SP-POST-to-CAS-server.t
  43. 6
      lemonldap-ng-portal/t/61-AdaptativeAuthenticationLevel.t
  44. 13
      lemonldap-ng-portal/t/62-Refresh-plugin.t
  45. 12
      lemonldap-ng-portal/t/77-2F-Extra.t

@ -10,8 +10,7 @@ require 't/test-lib.pm';
my $res;
my $client = LLNG::Manager::Test->new(
{
my $client = LLNG::Manager::Test->new( {
ini => {
logLevel => 'error',
passwordDB => 'Demo',
@ -140,9 +139,7 @@ count(1);
expectReject( $res, 200, 35, "Expect PE_PASSWORD_OK" );
# Check updated password in session (#2430)
$json =
expectJSON( $client->_get("/sessions/global/$id", query => 'hash=1'), 'Get session content' );
is( $json->{_password}, "test", "password updated in session" );
is( getSession($id)->data->{_password}, "test", "password updated in session" );
count(1);
# Test $client->logout

@ -8,8 +8,7 @@ require 't/test-lib.pm';
my $res;
my $client = LLNG::Manager::Test->new(
{
my $client = LLNG::Manager::Test->new( {
ini => {
logLevel => 'error',
passwordDB => 'Demo',
@ -38,8 +37,7 @@ expectOK($res);
my $id = expectCookie($res);
# Check encrypted password in session
my $json =
expectJSON( $client->_get("/sessions/global/$id", query => 'hash=1'), 'Get session content' );
my $json = getSession($id)->data;
ok( $json->{_password} ne "dwho", "password encrypted in session" );
count(1);

@ -9,8 +9,7 @@ BEGIN {
my ( $client, $res, $id );
$client = LLNG::Manager::Test->new(
{
$client = LLNG::Manager::Test->new( {
ini => {
logLevel => 'error',
restSessionServer => 1,
@ -34,13 +33,7 @@ count(1);
expectOK($res);
$id = expectCookie($res);
ok( $res = $client->_get("/sessions/global/$id", query => 'hash=1'), 'Get session' );
count(1);
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
count(1);
ok( $res->{_language} eq 'en', 'Default value for _language' );
ok( getSession($id)->data->{_language} eq 'en', 'Default value for _language' );
count(1);
# Test logout
@ -61,15 +54,8 @@ $id = expectCookie($res);
my $rawCookie = getHeader( $res, 'Set-Cookie' );
ok( $rawCookie =~ /;\s*SameSite=Strict/, 'Found SameSite=Strict (conf)' )
or explain( $rawCookie, 'SameSite value must be "Strict"' );
count(1);
ok( $res = $client->_get("/sessions/global/$id", query => 'hash=1'), 'Get session' );
count(1);
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
count(1);
ok( $res->{_language} eq 'fr', 'Correct value for _language' );
count(1);
ok( getSession($id)->data->{_language} eq 'fr', 'Correct value for _language' );
count(2);
# Test logout
$client->logout($id);

@ -6,7 +6,7 @@ use IO::String;
require 't/test-lib.pm';
my $res;
my $maintests = 7;
my $maintests = 4;
my $userdb = tempdb();
@ -19,8 +19,7 @@ SKIP: {
$dbh->do('CREATE TABLE users (user text,password text,cn text)');
$dbh->do("INSERT INTO users VALUES ('french','french','Frédéric Accents')");
$dbh->do("INSERT INTO users VALUES ('russian','russian','Русский')");
my $client = LLNG::Manager::Test->new(
{
my $client = LLNG::Manager::Test->new( {
ini => {
logLevel => 'error',
useSafeJail => 1,
@ -57,10 +56,7 @@ SKIP: {
expectOK($res);
my $id = expectCookie($res);
ok( $res = $client->_get("/sessions/global/$id", query => 'hash=1'), 'Get UTF-8' );
expectOK($res);
$res = expectJSON($res);
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
ok( getSession($id)->data->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
# 2- Characters UTF-8 only
@ -74,11 +70,7 @@ SKIP: {
expectOK($res);
$id = expectCookie($res);
ok( $res = $client->_get("/sessions/global/$id", query => 'hash=1'), 'Get UTF-8' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{cn} eq 'Русский', 'UTF-8 values' )
ok( getSession($id)->data->{cn} eq 'Русский', 'UTF-8 values' )
or explain( $res, 'cn => Русский' );
clean_sessions();

@ -8,8 +8,7 @@ require 't/test-lib.pm';
my $res;
my $client = LLNG::Manager::Test->new(
{
my $client = LLNG::Manager::Test->new( {
ini => {
logLevel => 'error',
useSafeJail => 1,
@ -46,9 +45,8 @@ ok(
);
expectOK($res);
my $id = expectCookie($res);
ok( $res = $client->_get("/sessions/global/$id", query => 'hash=1'), 'Get session' );
my $sessiondata = from_json( $res->[2]->[0] );
is( $sessiondata->{authenticationLevel}, 3, "Overriden authentication level" );
is( getSession($id)->data->{authenticationLevel},
3, "Overriden authentication level" );
$client->logout($id);
# Authenticate on second choice
@ -66,9 +64,8 @@ ok(
);
expectOK($res);
$id = expectCookie($res);
ok( $res = $client->_get("/sessions/global/$id", query => 'hash=1'), 'Get session' );
$sessiondata = from_json( $res->[2]->[0] );
is( $sessiondata->{authenticationLevel}, 1, "Default authentication level" );
is( getSession($id)->data->{authenticationLevel},
1, "Default authentication level" );
$client->logout($id);
clean_sessions();
done_testing();

@ -8,8 +8,7 @@ require 't/test-lib.pm';
my $res;
my $client = LLNG::Manager::Test->new(
{
my $client = LLNG::Manager::Test->new( {
ini => {
logLevel => 'error',
useSafeJail => 1,
@ -44,9 +43,8 @@ ok(
);
expectOK($res);
my $id = expectCookie($res);
ok( $res = $client->_get("/sessions/global/$id", query => 'hash=1'), 'Get session' );
my $sessiondata = from_json( $res->[2]->[0] );
is( $sessiondata->{authenticationLevel}, 3, "Overriden authentication level" );
is( getSession($id)->data->{authenticationLevel},
3, "Overriden authentication level" );
$client->logout($id);
# Authenticate on second choice
@ -64,9 +62,8 @@ ok(
);
expectOK($res);
$id = expectCookie($res);
ok( $res = $client->_get("/sessions/global/$id", query => 'hash=1'), 'Get session' );
$sessiondata = from_json( $res->[2]->[0] );
is( $sessiondata->{authenticationLevel}, 1, "Default authentication level" );
is( getSession($id)->data->{authenticationLevel},
1, "Default authentication level" );
$client->logout($id);
clean_sessions();
done_testing();

@ -11,7 +11,7 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 13;
my $maintests = 11;
my $debug = 'error';
my ( $issuer, $sp, $res );
@ -90,11 +90,7 @@ SKIP: {
expectAuthenticatedAs( $res, 'ru@badwolf.org@idp' );
# Verify UTF-8
ok( $res = $sp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{cn} eq 'Русский', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Русский', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
# Logout initiated by IdP
@ -154,8 +150,7 @@ clean_sessions();
done_testing( count() );
sub issuer {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -368,8 +363,7 @@ EOF
}
sub sp {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'sp.com',

@ -11,7 +11,7 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 12;
my $maintests = 10;
my $debug = 'error';
my ( $issuer, $sp, $res );
@ -122,11 +122,7 @@ SKIP: {
expectAuthenticatedAs( $res, 'fa@badwolf.org@idp' );
# Verify UTF-8
ok( $res = $sp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
# Logout initiated by SP
@ -175,8 +171,7 @@ clean_sessions();
done_testing( count() );
sub issuer {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -388,8 +383,7 @@ EOF
}
sub sp {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'sp.com',

@ -161,11 +161,8 @@ SKIP: {
expectAuthenticatedAs( $res, 'fa@badwolf.org@idp' );
# Verify UTF-8
ok( $res = $sp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Frédéric Accents',
'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
# Logout initiated by IDP

@ -11,7 +11,7 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 18;
my $maintests = 16;
my $debug = 'error';
my ( $issuer, $sp, $res );
@ -50,8 +50,7 @@ SKIP: {
ok(
$res = $issuer->_get(
'/saml/singleSignOn',
query => buildForm(
{
query => buildForm( {
IDPInitiated => 1,
spConfKey => 'sp.com',
spDest =>
@ -71,8 +70,7 @@ SKIP: {
ok(
$res = $issuer->_get(
'/saml/singleSignOn',
query => buildForm(
{
query => buildForm( {
IDPInitiated => 1,
spConfKey => 'sp.com',
spDest =>
@ -119,11 +117,7 @@ SKIP: {
expectAuthenticatedAs( $res, 'ru@badwolf.org@idp' );
# Verify UTF-8
ok( $res = $sp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{cn} eq 'Русский', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Русский', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
# Logout initiated by IdP
@ -216,8 +210,7 @@ clean_sessions();
done_testing( count() );
sub issuer {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -262,8 +255,7 @@ sub issuer {
}
sub sp {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'sp.com',

@ -11,7 +11,7 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 18;
my $maintests = 16;
my $debug = 'error';
my ( $issuer, $sp, $res );
@ -137,11 +137,7 @@ SKIP: {
expectAuthenticatedAs( $res, 'fa@badwolf.org@idp' );
# Verify UTF-8
ok( $res = $sp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
# Logout initiated by SP
@ -206,8 +202,7 @@ clean_sessions();
done_testing( count() );
sub issuer {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -321,8 +316,7 @@ EOF
}
sub sp {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'sp.com',

@ -168,10 +168,7 @@ SKIP: {
expectAuthenticatedAs( $res, 'fa@badwolf.org@idp' );
# Verify UTF-8
ok( $res = $sp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
$res = getSession($spId)->data;
is( $res->{gotResponseHookCalled}, 1, 'samlGotResponseHook called' );
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
@ -326,10 +323,7 @@ SKIP: {
expectAuthenticatedAs( $res, 'fa@badwolf.org@idp' );
# Verify UTF-8
ok( $res = $sp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
$res = getSession($spId)->data;
is( $res->{gotResponseHookCalled}, 1, 'samlGotResponseHook called' );
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
@ -338,8 +332,7 @@ SKIP: {
ok(
$res = $sp->_get(
'/',
query => buildForm(
{
query => buildForm( {
logout => 1,
url => encodeUrl("http://test1.example.com")
}
@ -409,8 +402,7 @@ clean_sessions();
done_testing();
sub issuer {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -458,8 +450,7 @@ sub issuer {
}
sub sp {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'sp.com',

@ -11,7 +11,7 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 17;
my $maintests = 15;
my $debug = 'error';
my ( $issuer, $sp, $res );
@ -89,11 +89,7 @@ SKIP: {
expectAuthenticatedAs( $res, 'ru@badwolf.org@idp' );
# Verify UTF-8
ok( $res = $sp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{cn} eq 'Русский', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Русский', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
# Logout initiated by IdP
@ -162,8 +158,7 @@ clean_sessions();
done_testing( count() );
sub issuer {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -208,8 +203,7 @@ sub issuer {
}
sub sp {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'sp.com',

@ -11,7 +11,7 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 19;
my $maintests = 17;
my $debug = 'error';
my ( $issuer, $sp, $sp2, $res );
@ -105,11 +105,7 @@ SKIP: {
expectAuthenticatedAs( $res, 'fa@badwolf.org@idp' );
# Verify UTF-8
ok( $res = $sp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
# Simple SP2 access
@ -228,8 +224,7 @@ clean_sessions();
done_testing( count() );
sub issuer {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -428,8 +423,7 @@ EOF
}
sub sp {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'sp.com',
@ -483,8 +477,7 @@ sub sp {
}
sub sp2 {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'sp2.com',

@ -11,7 +11,7 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 30;
my $maintests = 28;
my $debug = 'error';
my ( $issuer, $sp, $sp2, $sp3, $res );
@ -109,11 +109,7 @@ SKIP: {
expectAuthenticatedAs( $res, 'fa@badwolf.org@idp' );
# Verify UTF-8
ok( $res = $sp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
# Simple SP2 access
@ -368,8 +364,7 @@ clean_sessions();
done_testing( count() );
sub issuer {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -448,8 +443,7 @@ sub issuer {
}
sub sp {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'sp.com',
@ -504,8 +498,7 @@ sub sp {
}
sub sp2 {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'sp2.com',
@ -559,8 +552,7 @@ sub sp2 {
}
sub sp3 {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'sp3.com',

@ -13,7 +13,7 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 21;
my $maintests = 19;
my $debug = 'error';
my ( $issuer, $sp, $res );
@ -180,11 +180,7 @@ qr@SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"
expectAuthenticatedAs( $res, 'fa@badwolf.org@idp' );
# Verify UTF-8
ok( $res = $sp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
# Logout initiated by SP
@ -262,8 +258,7 @@ clean_sessions();
done_testing( count() );
sub issuer {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -310,8 +305,7 @@ sub issuer {
}
sub sp {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'sp.com',

@ -11,7 +11,7 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 18;
my $maintests = 16;
my $debug = 'error';
my ( $issuer, $sp, $cdc, $res );
@ -37,8 +37,7 @@ SKIP: {
use_ok('Lemonldap::NG::Portal::CDC');
ok(
$cdc = LLNG::Manager::Test->new(
{
$cdc = LLNG::Manager::Test->new( {
ini => {
logLevel => 'error',
samlCommonDomainCookieDomain => 'cdc.com',
@ -127,11 +126,7 @@ m#<iframe.*src="http://auth.cdc.com/\?(action=write&idp=http://auth.idp.com/saml
expectAuthenticatedAs( $res, 'fa@badwolf.org@idp' );
# Verify UTF-8
ok( $res = $sp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
# Logout initiated by SP
@ -200,8 +195,7 @@ clean_sessions();
done_testing( count() );
sub issuer {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -250,8 +244,7 @@ sub issuer {
}
sub sp {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'sp.com',

@ -137,13 +137,9 @@ expectOK($res);
expectAuthenticatedAs( $res, 'french' );
# Test attributes
ok( $res = $sp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
count(3);
count(1);
# Logout initiated by CAS
ok(
@ -172,8 +168,7 @@ clean_sessions();
done_testing( count() );
sub issuer {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -196,8 +191,7 @@ sub issuer {
}
sub sp {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'sp.com',

@ -137,13 +137,9 @@ expectOK($res);
expectAuthenticatedAs( $res, 'french' );
# Test attributes
ok( $res = $sp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
count(3);
count(1);
# Logout initiated by CAS, try with invalid service URL first
ok(
@ -180,8 +176,7 @@ clean_sessions();
done_testing( count() );
sub issuer {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -204,8 +199,7 @@ sub issuer {
}
sub sp {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'sp.com',

@ -168,13 +168,9 @@ expectOK($res);
expectAuthenticatedAs( $res, 'french' );
# Test attributes
ok( $res = $sp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
count(3);
count(1);
# Logout initiated by SP
ok(
@ -234,8 +230,7 @@ clean_sessions();
done_testing( count() );
sub issuer {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -266,8 +261,7 @@ sub issuer {
}
sub sp {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'sp.com',

@ -168,13 +168,9 @@ expectOK($res);
expectAuthenticatedAs( $res, 'fa@badwolf.org' );
# Test attributes
ok( $res = $sp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
count(3);
count(1);
# Logout initiated by SP
ok(
@ -234,8 +230,7 @@ clean_sessions();
done_testing( count() );
sub issuer {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -269,8 +264,7 @@ sub issuer {
}
sub sp {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'sp.com',

@ -168,13 +168,9 @@ expectOK($res);
expectAuthenticatedAs( $res, 'french' );
# Test attributes
ok( $res = $sp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
count(3);
count(1);
# Logout initiated by SP
ok(
@ -234,8 +230,7 @@ clean_sessions();
done_testing( count() );
sub issuer {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -268,8 +263,7 @@ sub issuer {
}
sub sp {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'sp.com',

@ -137,15 +137,12 @@ expectOK($res);
expectAuthenticatedAs( $res, 'french' );
# Test attributes
ok( $res = $sp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
$res = getSession($spId)->data;
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
ok( $res->{multi} =~ /value1;value2/ )
or explain( $res->{multi}, 'Multi valued attribute' );
count(4);
count(2);
# Logout initiated by SP
ok(
@ -208,8 +205,7 @@ clean_sessions();
done_testing( count() );
sub issuer {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -229,8 +225,7 @@ sub issuer {
}
sub sp {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'sp.com',

@ -129,13 +129,9 @@ expectOK($res);
expectAuthenticatedAs( $res, 'french' );
# Test attributes
ok( $res = $sp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
count(3);
count(1);
# Logout initiated by SP
ok(
@ -198,8 +194,7 @@ clean_sessions();
done_testing( count() );
sub issuer {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -217,8 +212,7 @@ sub issuer {
}
sub sp {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'sp.com',

@ -144,11 +144,9 @@ ok( getHeader( $res, 'Content-Security-Policy' ) !~ /frame-ancestors/,
count(1);
# Verify UTF-8
ok( $res = $rp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
$res = expectJSON($res);
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
count(2);
count(1);
# Logout initiated by OP
ok(
@ -180,7 +178,6 @@ ok(
count(1);
expectReject($res);
# Launch font logout request
ok(
$res = $rp->_get(
@ -211,8 +208,7 @@ clean_sessions();
done_testing( count() );
sub op {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -267,8 +263,7 @@ sub op {
sub rp {
my ( $jwks, $metadata ) = @_;
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'rp.com',

@ -177,7 +177,7 @@ expectSessionAttributes(
_user => 'french',
mail => 'fa2@badwolf.org'
);
ok( $res = $rp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get session after refresh' );
ok( $res = $rp->_get("/sessions/global/$spId"), 'Get session after refresh' );
# Logout
ok(

@ -164,17 +164,9 @@ count(1);
$res = expectJWT( $res->[2]->[0], name => 'Frédéric Accents' );
ok( $res = $op->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
$res = expectJSON($res);
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
count(2);
ok( $res = $rp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
$res = expectJSON($res);
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
count(2);
count(1);
# Logout initiated by RP
ok(
@ -292,8 +284,7 @@ clean_sessions();
done_testing( count() );
sub op {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -348,8 +339,7 @@ sub op {
sub rp {
my ( $jwks, $metadata ) = @_;
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'rp.com',

@ -164,21 +164,9 @@ ok( $res->{name} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'name => Frédéric Accents' );
count(2);
ok( $res = $op->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
count(3);
ok( $res = $rp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
count(3);
count(1);
# Logout initiated by RP
ok(
@ -292,8 +280,7 @@ clean_sessions();
done_testing( count() );
sub op {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -347,8 +334,7 @@ sub op {
sub rp {
my ( $jwks, $metadata ) = @_;
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'rp.com',

@ -167,17 +167,9 @@ ok( $res->{name} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'name => Frédéric Accents' );
count(2);
ok( $res = $op->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
$res = expectJSON($res);
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
count(2);
ok( $res = $rp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
$res = expectJSON($res);
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
count(2);
count(1);
# Logout initiated by RP
ok(
@ -295,8 +287,7 @@ clean_sessions();
done_testing( count() );
sub op {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -351,8 +342,7 @@ sub op {
sub rp {
my ( $jwks, $metadata ) = @_;
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'rp.com',

@ -164,17 +164,9 @@ ok( $res->{name} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'name => Frédéric Accents' );
count(2);
ok( $res = $op->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
$res = expectJSON($res);
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
count(2);
ok( $res = $rp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
$res = expectJSON($res);
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
count(2);
count(1);
# Logout initiated by RP
ok(
@ -288,8 +280,7 @@ clean_sessions();
done_testing( count() );
sub op {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -343,8 +334,7 @@ sub op {
sub rp {
my ( $jwks, $metadata ) = @_;
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'rp.com',

@ -187,14 +187,11 @@ ok( $res->{name} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'name => Frédéric Accents' );
count(2);
ok( $res = $op->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
$res = expectJSON($res);
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
count(2);
count(1);
ok( $res = $rp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
$res = expectJSON($res);
$res = getSession($spId)->data;
my $access_token_eol = $res->{_oidc_access_token_eol};
my $access_token_old = $res->{_oidc_access_token};
ok( $access_token_eol, 'OIDC EOL time is stored' );
@ -218,7 +215,7 @@ is_deeply(
},
"Correct hGroups"
);
count(7);
count(6);
is( $res->{userinfo_hook}, "op/french", "oidcGotUserInfo called" );
is( $res->{id_token_hook}, "op/french", "oidcGotIDToken called" );
@ -250,9 +247,7 @@ ok(
);
count(1);
ok( $res = $rp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get session after refresh' );
count(1);
$res = expectJSON($res);
$res = getSession($spId)->data;
my $access_token_new = $res->{_oidc_access_token};
my $access_token_new_eol = $res->{_oidc_access_token_eol};
is( $access_token_new_eol, $access_token_eol,
@ -284,9 +279,7 @@ ok(
);
count(1);
ok( $res = $rp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get session after refresh' );
count(1);
$res = expectJSON($res);
$res = getSession($spId)->data;
$access_token_new = $res->{_oidc_access_token};
$access_token_new_eol = $res->{_oidc_access_token_eol};
isnt( $access_token_new_eol, $access_token_eol,
@ -434,8 +427,7 @@ clean_sessions();
done_testing( count() );
sub op {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -494,8 +486,7 @@ sub op {
sub rp {
my ( $jwks, $metadata ) = @_;
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'rp.com',

@ -212,17 +212,9 @@ ok( $res->{name} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'name => Frédéric Accents' );
count(2);
ok( $res = $op->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
$res = expectJSON($res);
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
count(2);
ok( $res = $rp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
$res = expectJSON($res);
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
count(2);
count(1);
# Logout initiated by RP
ok(
@ -313,8 +305,7 @@ clean_sessions();
done_testing( count() );
sub op {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -372,8 +363,7 @@ sub op {
sub rp {
my ( $jwks, $metadata ) = @_;
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'rp.com',

@ -146,11 +146,9 @@ ok( getHeader( $res, 'Content-Security-Policy' ) !~ /frame-ancestors/,
count(1);
# Verify UTF-8
ok( $res = $rp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
$res = expectJSON($res);
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
count(2);
count(1);
# Logout initiated by RP
$url = '/';
@ -210,8 +208,7 @@ clean_sessions();
done_testing( count() );
sub op {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -269,8 +266,7 @@ sub op {
sub rp {
my ( $jwks, $metadata ) = @_;
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'rp.com',

@ -146,11 +146,9 @@ ok( getHeader( $res, 'Content-Security-Policy' ) !~ /frame-ancestors/,
count(1);
# Verify UTF-8
ok( $res = $rp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
$res = expectJSON($res);
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
count(2);
count(1);
# Logout initiated by RP
ok(
@ -200,8 +198,7 @@ clean_sessions();
done_testing( count() );
sub op {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -256,8 +253,7 @@ sub op {
sub rp {
my ( $jwks, $metadata ) = @_;
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'rp.com',

@ -90,22 +90,30 @@ $spId = expectCookie($res);
# Test other REST queries
# Session content
ok( $res = $issuer->_get("/sessions/global/$idpId", query => 'hash=1'), 'Session content' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{_session_id} eq $idpId, ' Good ID' )
or explain( $res, "_session_id => $idpId" );
count(3);
ok(
getSession($idpId)->data->{_session_id} eq
( $ENV{LLNG_HASHED_SESSION_STORE} ? id2storage($idpId) : $idpId ),
' Good ID'
) or explain( $res, "_session_id => $idpId" );
count(1);
# Session key
ok( $res = $issuer->_get("/sessions/global/$idpId/[_session_id,uid]", query => 'hash=1'),
'Some session keys' );
ok(
$res = $issuer->_get(
"/sessions/global/"
. ( $ENV{LLNG_HASHED_SESSION_STORE} ? id2storage($idpId) : $idpId )
. "/[_session_id,uid]"
),
'Some session keys'
);
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{_session_id} eq $idpId, ' Good ID' )
or explain( $res, "_session_id => $idpId" );
ok(
$res->{_session_id} eq
( $ENV{LLNG_HASHED_SESSION_STORE} ? id2storage($idpId) : $idpId ),
' Good ID'
) or explain( $res, "_session_id => $idpId" );
ok( $res->{uid} eq 'dwho', ' Uid is dwho' ) or explain( $res, 'uid => dwho' );
count(4);
@ -124,21 +132,33 @@ ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
my $newId = $res->{session}->{_session_id};
# Verify a key
ok( $res = $issuer->_get("/sessions/global/$newId/uid", query => 'hash=1'), 'Verify uid' );
ok( $res->[2]->[0] eq 'zz', ' Uid is good' );
ok(
$res = $issuer->_get(
"/sessions/global/"
. ( $ENV{LLNG_HASHED_SESSION_STORE} ? id2storage($newId) : $newId )
. "/uid"
),
'Verify uid'
);
ok( $res->[2]->[0] eq 'zz', ' Uid is good' );
count(4);
# Update a key
ok(
$res = $issuer->app->(
{
HTTP_ACCEPT => 'application/json',
HTTP_ACCEPT_LANGUAGE => 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3',
HTTP_HOST => 'auth.idp.com',
PATH_INFO => "/sessions/global/$newId",
REMOTE_ADDR => '127.0.0.1',
REQUEST_METHOD => 'PUT',
REQUEST_URI => "/sessions/global/$newId?hash=1",
$res = $issuer->app->( {
HTTP_ACCEPT => 'application/json',
HTTP_ACCEPT_LANGUAGE => 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3',
HTTP_HOST => 'auth.idp.com',
PATH_INFO => "/sessions/global/"
. (
$ENV{LLNG_HASHED_SESSION_STORE} ? id2storage($newId) : $newId
),
REMOTE_ADDR => '127.0.0.1',
REQUEST_METHOD => 'PUT',
REQUEST_URI => "/sessions/global/"
. (
$ENV{LLNG_HASHED_SESSION_STORE} ? id2storage($newId) : $newId
),
SCRIPT_NAME => '',
SERVER_NAME => 'auth.example.com',
SERVER_PORT => '80',
@ -147,7 +167,6 @@ ok(
'psgi.input' => IO::String->new('{"cn":"CN"}'),
CONTENT_TYPE => 'application/json',
CONTENT_LENGTH => 11,
QUERY_STRING => 'hash=1',
}
),
'Put a new key'
@ -159,15 +178,21 @@ ok( $res->{result} == 1, ' Result is 1' );
count(3);
# Verify new key
ok( $res = $issuer->_get("/sessions/global/$newId/cn", query => 'hash=1'), 'Verify cn' );
ok( $res->[2]->[0] eq 'CN', ' CN is good' );
ok(
$res = $issuer->_get(
"/sessions/global/"
. ( $ENV{LLNG_HASHED_SESSION_STORE} ? id2storage($newId) : $newId )
. "/cn"
),
'Verify cn'
);
ok( $res->[2]->[0] eq 'CN', ' CN is good' );
count(2);
use_ok('Lemonldap::NG::Common::Apache::Session::REST');
ok(
$res =
Lemonldap::NG::Common::Apache::Session::REST->get_key_from_all_sessions(
{
Lemonldap::NG::Common::Apache::Session::REST->get_key_from_all_sessions( {
baseUrl => 'http://auth.idp.com/sessions/global/',
}
),
@ -216,8 +241,7 @@ if ( ok( ref($res) eq 'HASH', ' Result is an hash' ) ) {
count(2);
ok(
$res = Lemonldap::NG::Common::Apache::Session::REST->searchOn(
{
$res = Lemonldap::NG::Common::Apache::Session::REST->searchOn( {
baseUrl => 'http://auth.idp.com/sessions/global/'
},
'uid', 'dwho'
@ -244,20 +268,24 @@ count(3);
# Del new session
ok(
$res = $issuer->app->(
{
$res = $issuer->app->( {
HTTP_ACCEPT => 'application/json',
HTTP_ACCEPT_LANGUAGE => 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3',
HTTP_HOST => 'auth.idp.com',
PATH_INFO => "/sessions/global/$newId",
REMOTE_ADDR => '127.0.0.1',
REQUEST_METHOD => 'DELETE',
REQUEST_URI => "/sessions/global/$newId?hash=1",
SCRIPT_NAME => '',
SERVER_NAME => 'auth.example.com',
SERVER_PORT => '80',
SERVER_PROTOCOL => 'HTTP/1.1',
QUERY_STRING => 'hash=1'
PATH_INFO => "/sessions/global/"
. (
$ENV{LLNG_HASHED_SESSION_STORE} ? id2storage($newId) : $newId
),
REMOTE_ADDR => '127.0.0.1',
REQUEST_METHOD => 'DELETE',
REQUEST_URI => "/sessions/global/"
. (
$ENV{LLNG_HASHED_SESSION_STORE} ? id2storage($newId) : $newId
),
SCRIPT_NAME => '',
SERVER_NAME => 'auth.example.com',
SERVER_PORT => '80',
SERVER_PROTOCOL => 'HTTP/1.1',
}
),
'Delete new session'
@ -269,8 +297,14 @@ ok( $res->{result} == 1, ' Result is 1' );
count(3);
# Verify that session is deleted
ok( $res = $issuer->_get("/sessions/global/$newId/cn", query => 'hash=1'),
'New session is deleted' );
ok(
$res = $issuer->_get(
"/sessions/global/"
. ( $ENV{LLNG_HASHED_SESSION_STORE} ? id2storage($newId) : $newId )
. "/cn"
),
'New session is deleted'
);
ok( $res->[0] == 400, ' Session does not exist' );
count(2);
@ -302,8 +336,7 @@ done_testing( count() );
# Redefine LWP methods for tests
sub issuer {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'idp.com',
@ -318,8 +351,7 @@ sub issuer {
}
sub sp {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'sp.com',

@ -102,22 +102,30 @@ expectOK($res);
# Test other REST queries
# Session content
ok( $res = $issuer->_get("/sessions/global/$spId", query => 'hash=1'), 'Session content' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{_session_id} eq $spId, ' Good ID' )
or explain( $res, "_session_id => $spId" );
count(3);
ok(
getSession($spId)->data->{_session_id} eq
( $ENV{LLNG_HASHED_SESSION_STORE} ? id2storage($spId) : $spId ),
' Good ID'
) or explain( $res, "_session_id => $spId" );
count(1);
# Session key
ok( $res = $issuer->_get("/sessions/global/$spId/[_session_id,uid,cn]", query => 'hash=1'),
'Some session keys' );
ok(
$res = $issuer->_get(
"/sessions/global/"
. ( $ENV{LLNG_HASHED_SESSION_STORE} ? id2storage($spId) : $spId )
. "/[_session_id,uid,cn]"
),
'Some session keys'
);
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{_session_id} eq $spId, ' Good ID' )
or explain( $res, "_session_id => $spId" );
ok(
$res->{_session_id} eq
( $ENV{LLNG_HASHED_SESSION_STORE} ? id2storage($spId) : $spId ),
' Good ID'
) or explain( $res, "_session_id => $spId" );
ok( $res->{uid} eq 'french', ' Uid is french' )
or explain( $res, 'uid => french' );
ok( $res->{cn} eq 'Frédéric Accents', ' UTF-8 values' );

@ -32,7 +32,7 @@ LWP::Protocol::PSGI->register(
$res = $issuer->$mth(
$url,
IO::String->new($s),
query => $query,
query => $query,
length => length($s),
type => $req->header('Content-Type'),
),
@ -96,22 +96,8 @@ expectOK($res);
# Test other REST queries
# Session key
ok(
$res = $issuer->_get(
"/sessions/global/$spId"
. "/[_session_id,_password]",
query => 'hash=1',
),
'Some session keys'
);
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{_session_id} eq $spId, ' Good ID' )
or explain( $res, "_session_id => $spId" );
ok( $res->{_password} eq 'french', ' Password is exported' )
or explain( $res, '_password => french' );
count(4);
ok( getSession($spId)->data->{_password} eq 'french', ' Password is exported' );
count(1);
clean_sessions();
done_testing( count() );

@ -17,7 +17,9 @@ LWP::Protocol::PSGI->register(
my $req = Plack::Request->new(@_);
ok(
$req->uri =~ m#http://auth.idp.com(.*?)(?:\?(.*))?$#,
' @ REST request (' . $req->method . " $1".($2 ? "?$2":'').")"
' @ REST request ('
. $req->method . " $1"
. ( $2 ? "?$2" : '' ) . ")"
);
count(1);
my $url = $1;
@ -30,7 +32,7 @@ LWP::Protocol::PSGI->register(
$res = $issuer->$mth(
$url,
IO::String->new($s),
query => $query,
query => $query,
length => length($s),
type => $req->header('Content-Type'),
),
@ -94,30 +96,29 @@ expectOK($res);
# Test other REST queries
# Session content
ok( $res = $issuer->_get("/sessions/global/$spId", query => 'hash=1'), 'Session content' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{_session_id} eq $spId, ' Good ID' )
or explain( $res, "_session_id => $spId" );
$res = getSession($spId)->data;
ok(
$res->{_session_id} eq
( $ENV{LLNG_HASHED_SESSION_STORE} ? id2storage($spId) : $spId ),
' Good ID'
) or explain( $res, "_session_id => $spId" );
ok( $res->{array} =~ /;/, 'Mulivalued attribute found' )
or explain( $res, "Multivalued attribute" );
count(4);
count(2);
# Session key
ok( $res = $issuer->_get("/sessions/global/$spId/[_session_id,uid,cn]", query => 'hash=1'),
'Some session keys' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{_session_id} eq $spId, ' Good ID' )
or explain( $res, "_session_id => $spId" );
$res = getSession($spId)->data;
ok(
$res->{_session_id} eq
( $ENV{LLNG_HASHED_SESSION_STORE} ? id2storage($spId) : $spId ),
' Good ID'
) or explain( $res, "_session_id => $spId" );
ok( $res->{uid} eq 'french', ' Uid is french' )
or explain( $res, 'uid => french' );
#ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
# or explain( $res->{cn}, 'Frédéric Accents' );
count(4);
count(2);
# Logout
ok(
@ -146,8 +147,7 @@ clean_sessions();
done_testing( count() );
sub issuer {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
domain => 'idp.com',
portal => 'http://auth.idp.com',
@ -160,8 +160,7 @@ sub issuer {
}
sub sp {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
domain => 'sp.com',
portal => 'http://auth.sp.com',

@ -6,7 +6,7 @@ use IO::String;
require 't/test-lib.pm';
my $res;
my $maintests = 3;
my $maintests = 1;
my $client;
my $userdb = tempdb();
@ -36,11 +36,8 @@ SKIP: {
$client = iniCmb(
'if($env->{HTTP_X} eq "rtyler") then [Dm] and [DB] else if($env->{HTTP_X} eq "dvador") then [DB] else [DB]'
);
my $id = expectCookie( try('rtyler') );
my $res;
ok( $res = $client->_get("/sessions/global/$id", query => 'hash=1'), 'Get session content' );
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
my $id = expectCookie( try('rtyler') );
my $res = getSession($id)->data;
ok(
( $res->{demo} eq 'rtyler' and $res->{dbi} eq 'rtyler' ),
' Demo and DBI exported variables exist in session'
@ -81,8 +78,7 @@ sub iniCmb {
my $expr = shift;
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
if (
my $res = LLNG::Manager::Test->new(
{
my $res = LLNG::Manager::Test->new( {
ini => {
logLevel => 'error',
useSafeJail => 1,

@ -6,7 +6,7 @@ use IO::String;
require 't/test-lib.pm';
my $res;
my $maintests = 3;
my $maintests = 1;
my $client;
my $userdb = tempdb();
@ -36,11 +36,8 @@ SKIP: {
$client = iniCmb(
'if($env->{HTTP_X} eq "rtyler") then [Dm] and [DB] else if($env->{HTTP_X} eq "dvador") then [DB] else [DB]'
);
my $id = expectCookie( try('rtyler') );
my $res;
ok( $res = $client->_get("/sessions/global/$id", query => 'hash=1'), 'Get session content' );
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
my $id = expectCookie( try('rtyler') );
my $res = getSession($id)->data;
ok(
( $res->{demo} eq 'rtyler' and $res->{dbi} eq 'rtyler' ),
' Demo and DBI exported variables exist in session'
@ -81,8 +78,7 @@ sub iniCmb {
my $expr = shift;
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
if (
my $res = LLNG::Manager::Test->new(
{
my $res = LLNG::Manager::Test->new( {
ini => {
logLevel => 'error',
useSafeJail => 1,

@ -11,7 +11,7 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 13;
my $maintests = 11;
my $debug = 'error';
my ( $issuer, $proxy, $sp, $res );
@ -181,11 +181,7 @@ qr'^http://auth.idp.com/cas/login\?(service=http%3A%2F%2Fauth.proxy.com%2F.*)$'
expectAuthenticatedAs( $res, 'fa@badwolf.org@proxy' );
# Verify UTF-8
ok( $res = $sp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
}
@ -195,8 +191,7 @@ clean_sessions();
done_testing( count() );
sub issuer {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
skipRenewConfirmation => 1,
logLevel => $debug,
@ -216,8 +211,7 @@ sub issuer {
}
sub proxy {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'proxy.com',
@ -281,8 +275,7 @@ sub proxy {
}
sub sp {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'sp.com',

@ -11,7 +11,7 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 11;
my $maintests = 9;
my $debug = 'error';
my ( $issuer, $proxy, $sp, $res );
@ -169,11 +169,7 @@ qr'^http://auth.idp.com/cas/login\?(service=http%3A%2F%2Fauth.proxy.com%2F.*)$'
expectAuthenticatedAs( $res, 'fa@badwolf.org@proxy' );
# Verify UTF-8
ok( $res = $sp->_get("/sessions/global/$spId", query => 'hash=1'), 'Get UTF-8' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
ok( $res->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
ok( getSession($spId)->data->{cn} eq 'Frédéric Accents', 'UTF-8 values' )
or explain( $res, 'cn => Frédéric Accents' );
}
@ -183,8 +179,7 @@ clean_sessions();
done_testing( count() );
sub issuer {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
skipRenewConfirmation => 1,
logLevel => $debug,
@ -204,8 +199,7 @@ sub issuer {
}
sub proxy {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'proxy.com',
@ -264,8 +258,7 @@ sub proxy {
}
sub sp {
return LLNG::Manager::Test->new(
{
return LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
domain => 'sp.com',

@ -44,7 +44,7 @@ $id = expectCookie($res);
ok(
$res = $client->_get(
'/session/my/global', cookie => "lemonldap=$id", query => 'hash=1'
'/session/my/global', cookie => "lemonldap=$id"
),
'Get session'
);
@ -53,7 +53,7 @@ $json = expectJSON($res);
ok( $json->{uid} eq 'dwho', 'uid found' ) or explain( $json, "uid='dwho'" );
ok( $json->{authenticationLevel} == 3, 'Authentication level upgraded' );
ok( scalar keys %$json == 10, 'Ten exported attributes found' )
ok( scalar keys %$json == 10, 'Ten exported attributes found' )
or explain( scalar keys %$json, Dumper $json );
count(3);
@ -74,7 +74,7 @@ $id = expectCookie($res);
ok(
$res = $client->_get(
'/session/my/global', cookie => "lemonldap=$id", query => 'hash=1'
'/session/my/global', cookie => "lemonldap=$id"
),
'Get session'
);

@ -9,8 +9,7 @@ BEGIN {
my $res;
my $client = LLNG::Manager::Test->new(
{
my $client = LLNG::Manager::Test->new( {
ini => {
logLevel => 'error',
authentication => 'Demo',
@ -52,8 +51,14 @@ ok( $res->[2]->[0] =~ /"updated":$c/, "Count is $c" );
count(1);
foreach (@ids) {
ok( $res = $client->_get("/sessions/global/$_", query => 'hash=1'), 'Get session content' );
ok( $res->[2]->[0] =~ /"uid":"Dr Who"/, ' Content is updated' );
ok(
$res = $client->_get(
"/sessions/global/"
. ( $ENV{LLNG_HASHED_SESSION_STORE} ? id2storage($_) : $_ )
),
'Get session content'
);
ok( $res->[2]->[0] =~ /"uid":"Dr Who"/, ' Content is updated' );
count(2);
}

@ -11,8 +11,7 @@ use_ok('Lemonldap::NG::Common::FormEncode');
count(1);
my $res;
my $client = LLNG::Manager::Test->new(
{
my $client = LLNG::Manager::Test->new( {
ini => {
logLevel => 'error',
localSessionStorage => "Cache::NullCache",
@ -173,12 +172,9 @@ $id = expectCookie($res);
expectSessionAttributes( $client, $id, _2f => "home" );
# Verify Authn Level
ok( $res = $client->_get("/sessions/global/$id", query => 'hash=1'), 'Get session' );
expectOK($res);
ok( $res = eval { JSON::from_json( $res->[2]->[0] ) }, ' GET JSON' )
or print STDERR $@;
is( $res->{authenticationLevel}, 5, "Correct authentication level" );
count(3);
is( getSession($id)->data->{authenticationLevel},
5, "Correct authentication level" );
count(1);
$client->logout($id);

Loading…
Cancel
Save