LEMONLDAP::NG : WSDL for portal + dependency of Crypt::Rijndael in Debian

This commit is contained in:
Xavier Guimard 2009-02-01 15:38:06 +00:00
parent 4a271a8225
commit 85d765a002
9 changed files with 142 additions and 8 deletions

View File

@ -199,6 +199,7 @@ install_bin: install_libs install_conf_dir
@install -v -d $(RBINDIR)
@cp --preserve=mode --remove-destination \
${SRCPORTALDIR}/example/scripts/purgeCentralCache \
${SRCPORTALDIR}/example/scripts/buildPortalWSDL \
${SRCCOMMONDIR}/scripts/lmConfig_File2MySQL \
${SRCMANAGERDIR}/example/scripts/lmConfigEditor \
$(RBINDIR)

View File

@ -4,7 +4,7 @@ Priority: extra
Maintainer: Xavier Guimard <x.guimard@free.fr>
DM-Upload-Allowed: yes
Build-Depends: debhelper (>= 4.1.16), po-debconf
Build-Depends-Indep:libapache-session-perl, libnet-ldap-perl, libdbi-perl, libwww-perl, libcache-cache-perl, libxml-simple-perl, libcgi-session-perl
Build-Depends-Indep:libapache-session-perl, libnet-ldap-perl, libdbi-perl, libwww-perl, libcache-cache-perl, libxml-simple-perl, libcgi-session-perl, libcrypt-rijndael-perl
Standards-Version: 3.8.0
Package: lemonldap-ng
@ -38,7 +38,7 @@ Description: Lemonldap::NG apache module part
Package: liblemonldap-ng-conf-perl
Architecture: all
Depends: ${misc:Depends}, libdbi-perl, debconf, libcache-cache-perl, libregexp-assemble-perl
Depends: ${misc:Depends}, libdbi-perl, debconf, libcache-cache-perl, libregexp-assemble-perl, libcrypt-rijndael-perl
Recommends: libsoap-lite-perl
Description: Lemonldap::NG apache administration interface part
Lemonldap::NG is a complete Web-SSO system that can run with reverse-proxies

View File

@ -4,6 +4,7 @@ debian/tmp/usr/share/lemonldap-ng/portal-skins
debian/tmp/usr/share/man/man3/Lemonldap::NG::Portal*
debian/tmp/usr/share/perl5/auto/Lemonldap/NG/Portal
debian/tmp/usr/share/perl5/Lemonldap/NG/Portal*
debian/tmp/usr/share/lemonldap-ng/bin/buildPortalWSDL
debian/tmp/var/lib/lemonldap-ng/liberty-alliance-sp-portal
debian/tmp/var/lib/lemonldap-ng/portal
debian/portal-apache*.conf /etc/lemonldap-ng

View File

@ -11,6 +11,9 @@ EXAMPLEPORTALFILE=/usr/share/doc/liblemonldap-ng-portal-perl/examples/index_skin
PORTALFILE=/var/lib/lemonldap-ng/portal/index.pl
SESSIONSDIR=/var/lib/lemonldap-ng/sessions
BUILDPORTALWSDL=/usr/share/lemonldap-ng/bin/buildPortalWSDL
WSDLFILE=/var/lib/lemonldap-ng/portal/portal.wsdl
if [ "$1" == "configure" ]
then
[ -e $LAPORTALFILE ] || cp $LAEXAMPLEPORTALFILE $LAPORTALFILE
@ -20,6 +23,7 @@ then
chmod 770 $SESSIONSDIR
chmod 770 $SESSIONSDIR/lock
chown -R www-data:www-data $SESSIONSDIR
$BUILDPORTALWSDL > $WSDLFILE || true
fi

View File

@ -2,6 +2,7 @@ Changes
lib/Lemonldap/NG/Common.pm
lib/Lemonldap/NG/Common/Apache/Session.pm
lib/Lemonldap/NG/Common/Apache/Session/SOAP.pm
lib/Lemonldap/NG/Common/BuildWSDL.pm
lib/Lemonldap/NG/Common/CGI.pm
lib/Lemonldap/NG/Common/CGI/SOAPServer.pm
lib/Lemonldap/NG/Common/Conf.pm

View File

@ -0,0 +1,25 @@
package Lemonldap::NG::Common::BuildWSDL;
use Lemonldap::NG::Common::Conf;
sub new {
my($class, $configStorage) = @_;
my $self = bless {}, $class;
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 {
my($self,$xml) = @_;
$xml =~ s/__PORTAL__/$self->{conf}->{portal}/gs;
$xml =~ s/__DOMAIN__/$self->{conf}->{domain}/gs;
my @cookies = split /\s+/, $self->{conf}->{cookieName};
s#(.*)#<element name="$1" type="xsd:string"></element># foreach(@cookies);
#s#(.*)#<element name="$1" nillable="true" type="xsd:string"></element># foreach(@cookies);
$xml =~ s/__XMLCOOKIELIST__/join("\n",@cookies)/ges;
return $xml;
}
1;

View File

@ -42,6 +42,7 @@ example/index.pl
example/index_simple.pl
example/index_skin.pl
example/PortalStatus.pl
example/scripts/buildPortalWSDL
example/scripts/purgeCentralCache
example/scripts/purgeCentralCache.cron.d
example/skins/default/hatch.gif

View File

@ -0,0 +1,76 @@
#!/usr/bin/perl
use Lemonldap::NG::Common::BuildWSDL;
print Lemonldap::NG::Common::BuildWSDL->new->buildWSDL(<<EOT);
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="__PORTAL__" xmlns:impl="__PORTAL__" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns1="__PORTAL__">
<wsdl:types>
<schema targetNamespace="__PORTAL__" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<complexType name="CookiesSequence">
<sequence>
__XMLCOOKIELIST__
</sequence>
</complexType>
<complexType name="GetCookieResponse">
<sequence>
<element name="errorCode" type="xsd:int"></element>
<element name="cookies" type="tns1:CookiesSequence"></element>
</sequence>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="errorRequest">
<wsdl:part name="lang" type="xsd:string" />
<wsdl:part name="code" type="xsd:int" />
</wsdl:message>
<wsdl:message name="errorResponse">
<wsdl:part name="errorReturn" type="xsd:string" />
</wsdl:message>
<wsdl:message name="getCookiesRequest">
<wsdl:part name="user" type="xsd:string" />
<wsdl:part name="password" type="xsd:string" />
</wsdl:message>
<wsdl:message name="getCookiesResponse">
<wsdl:part name="getCookiesReturn" type="tns1:GetCookieResponse" />
</wsdl:message>
<wsdl:portType name="myServiceHandler">
<wsdl:operation name="error" parameterOrder="lang code">
<wsdl:input message="impl:errorRequest" name="errorRequest" />
<wsdl:output message="impl:errorResponse" name="errorResponse" />
</wsdl:operation>
<wsdl:operation name="getCookies" parameterOrder="user password">
<wsdl:input message="impl:getCookiesRequest" name="getCookiesRequest" />
<wsdl:output message="impl:getCookiesResponse" name="getCookiesResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="myServiceSoapBinding" type="impl:myServiceHandler">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="error">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="errorRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="__PORTAL__" use="encoded" />
</wsdl:input>
<wsdl:output name="errorResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="__PORTAL__" use="encoded" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getCookies">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="getCookiesRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="__PORTAL__" use="encoded" />
</wsdl:input>
<wsdl:output name="getCookiesResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="__PORTAL__" use="encoded" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="myServiceHandlerService">
<wsdl:port binding="impl:myServiceSoapBinding" name="myService">
<wsdlsoap:address location="__PORTAL__" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
EOT

View File

@ -168,6 +168,16 @@ sub getConf {
1;
}
=begin WSDL
_IN lang $string Language
_IN code $int Error code
_RETURN $string Error string
=end WSDL
=cut
##@method string error(string lang)
# error calls Portal/_i18n.pm to display error in the wanted language.
#@param $lang optional (browser language is used instead)
@ -431,6 +441,16 @@ sub safe {
# SOAP subroutines #
####################
=begin WSDL
_IN user $string User name
_IN password $string Password
_RETURN $getCookieResponse Response
=end WSDL
=cut
##@method SOAP::Data getCookies(string user,string password)
# Called in SOAP context, returns cookies in an array.
# This subroutine works only for portals working with user and password
@ -452,14 +472,19 @@ sub getCookies {
}
my @tmp = ();
push @tmp, SOAP::Data->name( error => $self->{error} );
my @cookies = ();
unless ( $self->{error} ) {
push @tmp,
SOAP::Data->name(
cookies => \SOAP::Data->value(
SOAP::Data->name( $self->{cookieName} => $self->{id} ),
)
);
foreach ( @{ $self->{cookie} } ) {
push @cookies, SOAP::Data->name( $_->name, $_->value );
}
}
else {
my @cookieNames = split /\s+/, $self->{cookieName};
foreach (@cookieNames) {
push @cookies, SOAP::Data->name( $_, 0 );
}
}
push @tmp, SOAP::Data->name( cookies => \SOAP::Data->value(@cookies) );
my $res = SOAP::Data->name( session => \SOAP::Data->value(@tmp) );
$self->updateStatus;
return $res;