lemonldap-ng/modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/BuildWSDL.pm

42 lines
1.2 KiB
Perl
Raw Normal View History

package Lemonldap::NG::Common::BuildWSDL;
use Lemonldap::NG::Common::Conf;
our $VERSION = '0.1';
sub new {
2009-02-08 18:12:42 +01:00
my ( $class, $configStorage ) = @_;
my $self = bless {}, $class;
2009-02-08 18:12:42 +01:00
my $lmConf = Lemonldap::NG::Common::Conf->new($configStorage)
or die($Lemonldap::NG::Common::Conf::msg);
$self->{conf} = $lmConf->getConf() or die "Unable to load configuration";
return $self;
}
sub buildWSDL {
2009-02-08 18:12:42 +01:00
my ( $self, $xml ) = @_;
my $portal = $self->{conf}->{portal};
$portal .= "index.pl" if ( $portal =~ /\/$/ );
$xml =~ s/__PORTAL__/$portal/gs;
$xml =~ s/__DOMAIN__/$self->{conf}->{domain}/gs;
# Cookies
my @cookies = split /\s+/, $self->{conf}->{cookieName};
2009-02-08 18:12:42 +01:00
s#(.*)#<element name="$1" type="xsd:string"></element># foreach (@cookies);
$xml =~ s/__XMLCOOKIELIST__/join("\n",@cookies)/ges;
# Attributes
2010-01-15 17:36:02 +01:00
my @attr = (
keys %{ $self->{conf}->{exportedVars} },
2010-01-17 09:58:00 +01:00
keys %{ $self->{conf}->{macros} },
qw(_timezone ipAddr _password authenticationLevel _session_id xForwardedForAddr startTime _user _utime dn)
2010-01-15 17:36:02 +01:00
);
s#(.*)#<element name="$1" type="xsd:string" nillable="true"></element>#
foreach (@attr);
2010-01-17 09:58:00 +01:00
$xml =~ s/__ATTRLIST__/join("\n",@attr)/ges;
return $xml;
}
1;