post confirm to issuer url after restoring (#2142)

This commit is contained in:
Maxime Besson 2020-04-14 21:05:26 +02:00
parent 8afbd2214d
commit 755a5c3a6b
6 changed files with 24 additions and 7 deletions

View File

@ -76,6 +76,7 @@ sub display {
MSG => $req->info,
HIDDEN_INPUTS => $self->buildHiddenForm($req),
ACTIVE_TIMER => $req->data->{activeTimer},
FORM_ACTION => $req->data->{confirmFormAction} || "#",
FORM_METHOD => $self->conf->{confirmFormMethod},
CHOICE_PARAM => $self->conf->{authChoiceParam},
CHOICE_VALUE => $req->data->{_authChoice},

View File

@ -12,6 +12,7 @@ use Mouse;
use MIME::Base64;
use IO::String;
use URI::Escape;
use URI;
use Lemonldap::NG::Common::FormEncode;
use Lemonldap::NG::Portal::Main::Constants qw(
PE_OK
@ -137,6 +138,10 @@ sub _forAuthUser {
$self->restoreRequest( $req, $r );
@path = @{ $req->pdata->{ $self->ipath . 'Path' } }
if ( $req->pdata->{ $self->ipath . 'Path' } );
# In case a confirm form is shown, we need it to POST on the
# current Path
$req->data->{confirmFormAction} = URI->new($req->uri)->path;
}
# Clean pdata: keepPdata has been set, so pdata must be cleaned here

View File

@ -2,7 +2,7 @@
<div id="logincontent" class="container">
<form id="form" action="#" method="<TMPL_VAR NAME="FORM_METHOD">" class="confirm" role="form">
<form id="form" action="<TMPL_VAR NAME="FORM_ACTION">" method="<TMPL_VAR NAME="FORM_METHOD">" class="confirm" role="form">
<TMPL_VAR NAME="HIDDEN_INPUTS">
<TMPL_IF NAME="AUTH_URL">

View File

@ -193,10 +193,14 @@ SKIP: {
),
'Follow internal redirection from SAML-SP to OIDC-OP'
);
( $host, $tmp, $query ) = expectForm( $res, '#', undef, 'confirm' );
$spPdata = expectCookie( $res, 'lemonldappdata' );
( $host, $tmp, $query ) =
expectForm( $res, undef, qr#^/oauth2/authorize#, 'confirm' );
ok(
$res = $sp->_get(
$url,
'/oauth2/authorize',
query => $query,
accept => 'text/html',
cookie => "lemonldap=$spId;$spPdata"

View File

@ -176,10 +176,14 @@ SKIP: {
),
'Follow internal redirection from SAML-SP to OIDC-OP'
);
( $host, $tmp, $query ) = expectForm( $res, '#', undef, 'confirm' );
( $host, $url, $query ) =
expectForm( $res, undef, qr#/oauth2/authorize#, 'confirm' );
$spPdata = 'lemonldappdata=' . expectCookie( $res, 'lemonldappdata' );
ok(
$res = $sp->_get(
$url,
'/oauth2/authorize',
query => $query,
accept => 'text/html',
cookie => "lemonldap=$spId;$spPdata"

View File

@ -179,10 +179,13 @@ SKIP: {
),
'Follow internal redirection from SAML-SP to OIDC-OP'
);
( $host, $tmp, $query ) = expectForm( $res, '#', undef, 'confirm' );
$spPdata = 'lemonldappdata=' . expectCookie( $res, 'lemonldappdata' );
( $host, $tmp, $query ) =
expectForm( $res, undef, qr#^/oauth2/authorize#, 'confirm' );
ok(
$res = $sp->_get(
$url,
'/oauth2/authorize',
query => $query,
accept => 'text/html',
cookie => "lemonldap=$spId;$spPdata"