|
|
|
@ -43,16 +43,12 @@ sub newSession { |
|
|
|
|
my @ids; |
|
|
|
|
my $sfaDevices = []; |
|
|
|
|
my $epoch = time; |
|
|
|
|
my $res; |
|
|
|
|
|
|
|
|
|
# Single session access |
|
|
|
|
## Sessions creation |
|
|
|
|
# SSO session |
|
|
|
|
$ids[0] = newSession( 'dwho', '127.10.0.1', 'SSO', $sfaDevices ); |
|
|
|
|
my $res = &client->jsonResponse("/sessions/global/$ids[0]"); |
|
|
|
|
ok( ( $res->{uid} and $res->{uid} eq 'dwho' ), 'UID found' ); |
|
|
|
|
ok( ( $res->{ipAddr} and $res->{ipAddr} eq '127.10.0.1' ), 'IP found' ); |
|
|
|
|
count(2); |
|
|
|
|
|
|
|
|
|
# Peristent sesssions creation |
|
|
|
|
$sfaDevices = []; |
|
|
|
|
# Peristent sesssions |
|
|
|
|
$ids[1] = newSession( 'msmith', '127.10.0.1', 'Persistent', $sfaDevices ); |
|
|
|
|
$sfaDevices = [ |
|
|
|
|
{ |
|
|
|
@ -119,6 +115,15 @@ $sfaDevices = [ |
|
|
|
|
]; |
|
|
|
|
$ids[5] = newSession( 'tof', '127.10.0.1', 'Persistent', $sfaDevices ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Verify sessions creation |
|
|
|
|
# Single SSO session access |
|
|
|
|
$res = &client->jsonResponse("/sessions/global/$ids[0]"); |
|
|
|
|
ok( ( $res->{uid} and $res->{uid} eq 'dwho' ), 'UID found' ); |
|
|
|
|
ok( ( $res->{ipAddr} and $res->{ipAddr} eq '127.10.0.1' ), 'IP found' ); |
|
|
|
|
count(2); |
|
|
|
|
# Single Persistent sessions access |
|
|
|
|
for ( my $i = 1 ; $i < 6 ; $i++ ) { |
|
|
|
|
$res = &client->jsonResponse("/sessions/persistent/$ids[$i]"); |
|
|
|
|
ok( |
|
|
|
@ -131,6 +136,15 @@ for ( my $i = 1 ; $i < 6 ; $i++ ) { |
|
|
|
|
} |
|
|
|
|
count(5); |
|
|
|
|
|
|
|
|
|
## Single Persistent sfa access |
|
|
|
|
$res = &client->jsonResponse("/sfa/persistent/$ids[3]"); |
|
|
|
|
ok( ( $res->{uid} and $res->{uid} eq 'dwho' ), 'UID found' ) or print STDERR Dumper($res); |
|
|
|
|
ok( ( $res->{ipAddr} and $res->{ipAddr} eq '127.10.0.1' ), 'IP found' ) or print STDERR Dumper($res); |
|
|
|
|
ok( ( $res->{_2fDevices} and $res->{_2fDevices} =~ /"type":\s*"U2F"/s ), 'U2F found' ) or print STDERR Dumper($res); |
|
|
|
|
ok( ( $res->{_2fDevices} and $res->{_2fDevices} =~ /"type":\s*"TOTP"/s ), 'TOTP found' ) or print STDERR Dumper($res); |
|
|
|
|
ok( ( $res->{_2fDevices} and $res->{_2fDevices} =~ /"type":\s*"UBK"/s ), 'UBK found' ) or print STDERR Dumper($res); |
|
|
|
|
count(5); |
|
|
|
|
|
|
|
|
|
## "All" query |
|
|
|
|
$res = &client->jsonResponse( '/sfa/persistent', |
|
|
|
|
'groupBy=substr(uid,1)&U2FCheck=1&TOTPCheck=1&UBKCheck=1' ); |
|
|
|
@ -294,7 +308,7 @@ count(7); |
|
|
|
|
foreach ( 1 .. 5 ) { |
|
|
|
|
ok( |
|
|
|
|
$res = |
|
|
|
|
&client->_del( "sfa/persistent/$ids[$_]", "type=U2F&epoch=$epoch" ), |
|
|
|
|
&client->_del( "/sfa/persistent/$ids[$_]", "type=U2F&epoch=$epoch" ), |
|
|
|
|
"Delete U2F from $_" |
|
|
|
|
); |
|
|
|
|
ok( $res->[0] == 200, 'Result code is 200' ); |
|
|
|
@ -307,7 +321,7 @@ foreach ( 1 .. 5 ) { |
|
|
|
|
foreach ( 3 .. 4 ) { |
|
|
|
|
ok( |
|
|
|
|
$res = |
|
|
|
|
&client->_del( "sfa/persistent/$ids[$_]", "type=TOTP&epoch=$epoch" ), |
|
|
|
|
&client->_del( "/sfa/persistent/$ids[$_]", "type=TOTP&epoch=$epoch" ), |
|
|
|
|
"Delete TOTP from $_" |
|
|
|
|
); |
|
|
|
|
ok( $res->[0] == 200, 'Result code is 200' ); |
|
|
|
@ -320,7 +334,7 @@ foreach ( 3 .. 4 ) { |
|
|
|
|
foreach ( 2 .. 3 ) { |
|
|
|
|
ok( |
|
|
|
|
$res = |
|
|
|
|
&client->_del( "sfa/persistent/$ids[$_]", "type=UBK&epoch=$epoch" ), |
|
|
|
|
&client->_del( "/sfa/persistent/$ids[$_]", "type=UBK&epoch=$epoch" ), |
|
|
|
|
"Delete UBK from $_" |
|
|
|
|
); |
|
|
|
|
ok( $res->[0] == 200, 'Result code is 200' ); |
|
|
|
|