Commit bf51bd86 authored by Christophe Maudoux's avatar Christophe Maudoux 🐛

Improve unit tests (store & bypass oidcConsent (#1533)

parent 61a12a14
......@@ -114,8 +114,11 @@ ok(
);
count(1);
my $idpId = expectCookie($res);
my ( $host, $tmp );
( $host, $tmp, $query ) = expectForm( $res, '#', undef, 'confirm' );
#my ( $host, $tmp );
#( $host, $tmp, $query ) = expectForm( $res, '#', undef, 'confirm' );
expectRedirection( $res,
qr#^http://auth.rp.com/?\?openidconnectcallback=1\#(.*)$# );
ok(
$res = $op->_post(
......@@ -198,7 +201,7 @@ sub op {
oidcRPMetaDataOptionsIDTokenExpiration => 3600,
oidcRPMetaDataOptionsClientID => "rpid",
oidcRPMetaDataOptionsIDTokenSignAlg => "HS512",
oidcRPMetaDataOptionsBypassConsent => 0,
oidcRPMetaDataOptionsBypassConsent => 1,
oidcRPMetaDataOptionsClientSecret => "rpsecret",
oidcRPMetaDataOptionsUserIDAttr => "",
oidcRPMetaDataOptionsAccessTokenExpiration => 3600
......
......@@ -114,6 +114,7 @@ ok(
);
count(1);
my $idpId = expectCookie($res);
my ( $host, $tmp );
( $host, $tmp, $query ) = expectForm( $res, '#', undef, 'confirm' );
......@@ -140,6 +141,51 @@ ok( $prms{access_token}, ' access_token found' );
ok( $prms{state}, ' state found' );
count(5);
$op->logout($idpId);
# Query RP for auth
ok( $res = $rp->_get( '/', accept => 'text/html' ), 'Unauth SP request' );
count(1);
my ( $url, $query ) =
expectRedirection( $res, qr#http://auth.op.com(/oauth2/authorize)\?(.*)$# );
# Rewrite response_type to use implicit
$query =~ s/response_type=code/response_type=id_token%20token/;
# Push request to OP
ok( $res = $op->_get( $url, query => $query, accept => 'text/html' ),
"Push request to OP, endpoint $url" );
count(1);
expectOK($res);
# Try to authenticate to IdP
$query = "user=dwho&password=dwho&$query&nonce=qwerty";
ok(
$res = $op->_post(
$url,
IO::String->new($query),
accept => 'text/html',
length => length($query),
),
"Post authentication, endpoint $url"
);
count(1);
expectRedirection( $res,
qr#^http://auth.rp.com/?\?openidconnectcallback=1\#(.*)$# );
ok(
$res = $op->_post(
$url,
IO::String->new($query),
accept => 'text/html',
cookie => "lemonldap=$idpId",
length => length($query),
),
"Post confirmation, endpoint $url"
);
count(1);
#print STDERR Dumper($query);
clean_sessions();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment