SAML: use correct method to build artifact message (#32)
This commit is contained in:
parent
5754d86ff5
commit
e359e1a7d1
@ -952,7 +952,9 @@ sub extractFormInfo {
|
|||||||
|
|
||||||
# Send SSO request depending on request method
|
# Send SSO request depending on request method
|
||||||
# HTTP-REDIRECT
|
# HTTP-REDIRECT
|
||||||
if ( $method == Lasso::Constants::HTTP_METHOD_REDIRECT ) {
|
if ( $method == $self->getHttpMethod('redirect')
|
||||||
|
or $method == $self->getHttpMethod('artifact-get') )
|
||||||
|
{
|
||||||
|
|
||||||
# Redirect user to response URL
|
# Redirect user to response URL
|
||||||
my $sso_url = $login->msg_url;
|
my $sso_url = $login->msg_url;
|
||||||
@ -968,14 +970,22 @@ sub extractFormInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# HTTP-POST
|
# HTTP-POST
|
||||||
elsif ( $method == Lasso::Constants::HTTP_METHOD_POST ) {
|
elsif ($method == $self->getHttpMethod('post')
|
||||||
|
or $method == $self->getHttpMethod('artifact-post') )
|
||||||
|
{
|
||||||
|
|
||||||
# Use autosubmit form
|
# Use autosubmit form
|
||||||
my $sso_url = $login->msg_url;
|
my $sso_url = $login->msg_url;
|
||||||
my $sso_body = $login->msg_body;
|
my $sso_body = $login->msg_body;
|
||||||
|
|
||||||
$self->{postUrl} = $sso_url;
|
$self->{postUrl} = $sso_url;
|
||||||
|
|
||||||
|
if ( $method == $self->getHttpMethod("artifact-post") ) {
|
||||||
|
$self->{postFields} = { 'SAMLart' => $sso_body };
|
||||||
|
}
|
||||||
|
else {
|
||||||
$self->{postFields} = { 'SAMLRequest' => $sso_body };
|
$self->{postFields} = { 'SAMLRequest' => $sso_body };
|
||||||
|
}
|
||||||
|
|
||||||
# RelayState
|
# RelayState
|
||||||
$self->{postFields}->{'RelayState'} = $login->msg_relayState
|
$self->{postFields}->{'RelayState'} = $login->msg_relayState
|
||||||
|
@ -888,36 +888,23 @@ sub createAuthnRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Build authentication request
|
# Build authentication request
|
||||||
|
unless ( $self->buildAuthnRequestMsg($login) ) {
|
||||||
|
$self->lmLog( "Could not build authentication request on $idp",
|
||||||
|
'error' );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
# Artifact
|
# Artifact
|
||||||
if ( $method == $self->getHttpMethod("artifact-get")
|
if ( $method == $self->getHttpMethod("artifact-get")
|
||||||
or $method == $self->getHttpMethod("artifact-post") )
|
or $method == $self->getHttpMethod("artifact-post") )
|
||||||
{
|
{
|
||||||
|
|
||||||
# Build artifact message
|
|
||||||
unless ( $self->buildArtifactMsg( $login, $method ) ) {
|
|
||||||
$self->lmLog( "Unable to build SSO artifact response message",
|
|
||||||
'error' );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$self->lmLog( "SSO: artifact response is built", 'debug' );
|
|
||||||
|
|
||||||
# Get artifact ID and Content, and store them
|
# Get artifact ID and Content, and store them
|
||||||
my $artifact_id = $login->get_artifact;
|
my $artifact_id = $login->get_artifact;
|
||||||
my $artifact_message = $login->get_artifact_message;
|
my $artifact_message = $login->get_artifact_message;
|
||||||
|
|
||||||
$self->storeArtifact( $artifact_id, $artifact_message );
|
$self->storeArtifact( $artifact_id, $artifact_message );
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
|
||||||
unless ( $self->buildAuthnRequestMsg($login) ) {
|
|
||||||
$self->lmLog( "Could not build authentication request on $idp",
|
|
||||||
'error' );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $login;
|
return $login;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user