Commit 9b0c8ef9 authored by Clément OUDOT's avatar Clément OUDOT
Browse files

SAML: use serviceToXML

parent 6f46631f
...@@ -732,7 +732,7 @@ sub defaultConf { ...@@ -732,7 +732,7 @@ sub defaultConf {
'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect;' 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect;'
.'http://auth.example.com/saml/singleSignOn;', .'http://auth.example.com/saml/singleSignOn;',
samlIDPSSODescriptorSingleSignOnServiceSOAP => samlIDPSSODescriptorSingleSignOnServiceSOAP =>
'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-SOAP;' 'urn:oasis:names:tc:SAML:2.0:bindings:SOAP;'
.'http://auth.example.com/saml/singleSignOnSOAP;', .'http://auth.example.com/saml/singleSignOnSOAP;',
samlIDPSSODescriptorSingleLogoutServiceHTTP => samlIDPSSODescriptorSingleLogoutServiceHTTP =>
'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect;' 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect;'
......
...@@ -24,33 +24,21 @@ sub authInit { ...@@ -24,33 +24,21 @@ sub authInit {
# Activate SOAP # Activate SOAP
$self->{Soap} = 1; $self->{Soap} = 1;
# Check presence of service metadata and private key in configuration # Check presence of private key in configuration
unless ($self->{samlServiceMetaData} unless ( $self->{samlServicePrivateKey} ) {
and $self->{samlServicePrivateKey} ) $self->lmLog( "SAML private key not found in configuration", 'error' );
{
$self->lmLog(
"SAML service metadata or private key not found in configuration",
'error' );
return PE_ERROR; return PE_ERROR;
} }
# Get metadata from configuration # Get metadata from configuration
$self->lmLog( "Get Metadata for this service", 'debug' ); $self->lmLog( "Get Metadata for this service", 'debug' );
my $service_metadata = Lemonldap::NG::Common::Conf::SAML::Metadata->new(); my $service_metadata = Lemonldap::NG::Common::Conf::SAML::Metadata->new();
unless (
$service_metadata->initializeFromConfHash(
$self->{samlServiceMetaData}
)
)
{
$self->lmLog( "Fail to read Service Metadata from configuration",
'error' );
return PE_ERROR;
}
# Create Lasso server with service metadata # Create Lasso server with service metadata
my $server = $self->createServer( my $server = $self->createServer(
$service_metadata->toXML(), $service_metadata->serviceToXML(
$ENV{DOCUMENT_ROOT} . "/skins/common/saml2-metadata.tpl", $self
),
$self->{samlServicePrivateKey}, $self->{samlServicePrivateKey},
); );
......
...@@ -117,7 +117,7 @@ sub createServer { ...@@ -117,7 +117,7 @@ sub createServer {
$private_key_password, $certificate ); $private_key_password, $certificate );
}; };
$self->checkLassoError($@); return unless $self->checkLassoError($@);
return $server; return $server;
} }
......
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