SAML: use correct method to build artifact message (#32)

This commit is contained in:
Clément Oudot 2010-07-02 08:14:26 +00:00
parent 5754d86ff5
commit e359e1a7d1
2 changed files with 17 additions and 20 deletions

View File

@ -952,7 +952,9 @@ sub extractFormInfo {
# Send SSO request depending on request method
# 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
my $sso_url = $login->msg_url;
@ -968,14 +970,22 @@ sub extractFormInfo {
}
# HTTP-POST
elsif ( $method == Lasso::Constants::HTTP_METHOD_POST ) {
elsif ($method == $self->getHttpMethod('post')
or $method == $self->getHttpMethod('artifact-post') )
{
# Use autosubmit form
my $sso_url = $login->msg_url;
my $sso_body = $login->msg_body;
$self->{postUrl} = $sso_url;
if ( $method == $self->getHttpMethod("artifact-post") ) {
$self->{postFields} = { 'SAMLart' => $sso_body };
}
else {
$self->{postFields} = { 'SAMLRequest' => $sso_body };
}
# RelayState
$self->{postFields}->{'RelayState'} = $login->msg_relayState

View File

@ -888,36 +888,23 @@ sub createAuthnRequest {
}
# Build authentication request
unless ( $self->buildAuthnRequestMsg($login) ) {
$self->lmLog( "Could not build authentication request on $idp",
'error' );
return;
}
# Artifact
if ( $method == $self->getHttpMethod("artifact-get")
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
my $artifact_id = $login->get_artifact;
my $artifact_message = $login->get_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;
}