2008-11-17 17:59:56 +01:00
|
|
|
package Lemonldap::NG::Common::Conf::SOAP;
|
2007-02-24 21:23:17 +01:00
|
|
|
|
|
|
|
use strict;
|
2016-01-07 13:34:34 +01:00
|
|
|
use utf8;
|
2007-02-24 21:23:17 +01:00
|
|
|
use SOAP::Lite;
|
|
|
|
|
2016-03-17 23:19:44 +01:00
|
|
|
our $VERSION = '2.0.0';
|
2007-05-06 16:41:30 +02:00
|
|
|
|
2009-02-17 15:56:38 +01:00
|
|
|
#parameter proxy Url of SOAP service
|
|
|
|
#parameter proxyOptions SOAP::Lite parameters
|
|
|
|
|
2007-05-06 16:41:30 +02:00
|
|
|
BEGIN {
|
2008-11-17 17:59:56 +01:00
|
|
|
*Lemonldap::NG::Common::Conf::_soapCall = \&_soapCall;
|
2010-03-01 21:32:28 +01:00
|
|
|
*Lemonldap::NG::Common::Conf::_connect = \&_connect;
|
2009-06-23 22:36:44 +02:00
|
|
|
|
2007-05-06 16:41:30 +02:00
|
|
|
sub SOAP::Transport::HTTP::Client::get_basic_credentials {
|
2009-06-23 22:36:44 +02:00
|
|
|
return $Lemonldap::NG::Common::Conf::SOAP::username =>
|
|
|
|
$Lemonldap::NG::Common::Conf::SOAP::password;
|
2007-05-06 16:41:30 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
our ( $username, $password ) = ( '', '' );
|
2007-02-24 21:23:17 +01:00
|
|
|
|
|
|
|
sub prereq {
|
|
|
|
my $self = shift;
|
2007-02-28 13:56:35 +01:00
|
|
|
unless ( $self->{proxy} ) {
|
2011-07-07 17:08:45 +02:00
|
|
|
$Lemonldap::NG::Common::Conf::msg .=
|
|
|
|
"proxy parameter is required in SOAP configuration type \n";
|
2007-02-24 21:23:17 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
1;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub _connect {
|
2007-02-28 13:56:35 +01:00
|
|
|
my $self = shift;
|
|
|
|
return $self->{service} if ( $self->{service} );
|
|
|
|
my @args = ( $self->{proxy} );
|
|
|
|
if ( $self->{proxyOptions} ) {
|
|
|
|
push @args, %{ $self->{proxyOptions} };
|
|
|
|
}
|
2009-06-23 22:36:44 +02:00
|
|
|
$self->{ns} ||= 'urn:/Lemonldap/NG/Common/CGI/SOAPService';
|
2007-02-28 23:36:19 +01:00
|
|
|
return $self->{service} = SOAP::Lite->ns( $self->{ns} )->proxy(@args);
|
2007-02-24 21:23:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sub _soapCall {
|
|
|
|
my $self = shift;
|
|
|
|
my $func = shift;
|
2007-05-06 16:41:30 +02:00
|
|
|
$username = $self->{User};
|
|
|
|
$password = $self->{Password};
|
2009-06-23 22:36:44 +02:00
|
|
|
my $r = $self->_connect->$func(@_);
|
|
|
|
if ( $r->fault() ) {
|
|
|
|
print STDERR "SOAP error : " . $r->fault()->{faultstring};
|
|
|
|
return ();
|
|
|
|
}
|
|
|
|
return $r->result;
|
2007-02-24 21:23:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sub available {
|
|
|
|
my $self = shift;
|
2007-02-28 13:56:35 +01:00
|
|
|
return @{ $self->_soapCall( 'available', @_ ) };
|
2007-02-24 21:23:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sub lastCfg {
|
|
|
|
my $self = shift;
|
2007-02-28 13:56:35 +01:00
|
|
|
return $self->_soapCall( 'lastCfg', @_ );
|
2007-02-24 21:23:17 +01:00
|
|
|
}
|
|
|
|
|
2014-04-04 16:20:43 +02:00
|
|
|
# lock and unlock must not be requested by the SOAP client, since
|
|
|
|
# they will be done by the SOAP server when storing the config
|
2007-03-04 15:52:51 +01:00
|
|
|
sub lock {
|
2014-04-04 16:20:43 +02:00
|
|
|
return 1;
|
2007-03-04 15:52:51 +01:00
|
|
|
}
|
|
|
|
|
2014-04-04 16:20:43 +02:00
|
|
|
sub unlock {
|
|
|
|
return 1;
|
|
|
|
}
|
2007-03-04 15:52:51 +01:00
|
|
|
|
|
|
|
sub isLocked {
|
2014-04-04 16:20:43 +02:00
|
|
|
return 1;
|
2007-03-04 15:52:51 +01:00
|
|
|
}
|
|
|
|
|
2007-02-24 21:23:17 +01:00
|
|
|
sub store {
|
|
|
|
my $self = shift;
|
2007-02-28 13:56:35 +01:00
|
|
|
return $self->_soapCall( 'store', @_ );
|
2007-02-24 21:23:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sub load {
|
|
|
|
my $self = shift;
|
2009-06-24 17:07:36 +02:00
|
|
|
return $self->_soapCall( 'getConfig', @_ );
|
2007-02-24 21:23:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|
|
|
|
__END__
|
2007-02-28 13:56:35 +01:00
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
2010-01-03 09:09:59 +01:00
|
|
|
=encoding utf8
|
|
|
|
|
2008-11-17 17:59:56 +01:00
|
|
|
Lemonldap::NG::Common::Conf::SOAP - Perl extension written to access to
|
2007-02-28 13:56:35 +01:00
|
|
|
Lemonldap::NG Web-SSO configuration via SOAP.
|
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
|
|
|
|
=head2 Client side
|
|
|
|
|
|
|
|
=head3 Area protection (Apache handler)
|
|
|
|
|
|
|
|
package My::Package;
|
|
|
|
|
|
|
|
use base Lemonldap::NG::Handler::SharedConf;
|
|
|
|
|
|
|
|
__PACKAGE__->init ( {
|
|
|
|
localStorage => "Cache::FileCache",
|
|
|
|
localStorageOptions => {
|
2012-02-09 18:36:13 +01:00
|
|
|
'namespace' => 'lemonldap-ng',
|
2007-02-28 13:56:35 +01:00
|
|
|
'default_expires_in' => 600,
|
|
|
|
},
|
|
|
|
configStorage => {
|
2007-05-06 16:41:30 +02:00
|
|
|
type => 'SOAP',
|
2009-06-29 11:42:44 +02:00
|
|
|
proxy => 'http://auth.example.com/index.pl/config',
|
2007-05-06 16:41:30 +02:00
|
|
|
# If soapserver is protected by HTTP Basic:
|
|
|
|
User => 'http-user',
|
|
|
|
Password => 'pass',
|
2007-02-28 13:56:35 +01:00
|
|
|
},
|
|
|
|
https => 0,
|
|
|
|
} );
|
|
|
|
|
|
|
|
=head3 Authentication portal
|
|
|
|
|
|
|
|
use Lemonldap::NG::Portal::SharedConf;
|
|
|
|
|
|
|
|
my $portal = Lemonldap::NG::Portal::SharedConf->new ( {
|
|
|
|
configStorage => {
|
|
|
|
type => 'SOAP',
|
2009-06-29 11:42:44 +02:00
|
|
|
proxy => 'http://auth.example.com/index.pl/config',
|
2007-05-06 16:41:30 +02:00
|
|
|
# If soapserver is protected by HTTP Basic:
|
|
|
|
User => 'http-user',
|
|
|
|
Password => 'pass',
|
2007-02-28 13:56:35 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
# Next as usual... See Lemonldap::NG::Portal(3)
|
|
|
|
if($portal->process()) {
|
|
|
|
...
|
|
|
|
|
|
|
|
=head3 Manager
|
|
|
|
|
|
|
|
use Lemonldap::NG::Manager;
|
|
|
|
|
|
|
|
my $m=new Lemonldap::NG::Manager(
|
|
|
|
{
|
|
|
|
configStorage=>{
|
|
|
|
type => 'SOAP',
|
2009-06-29 11:42:44 +02:00
|
|
|
proxy => 'http://auth.example.com/index.pl/config',
|
2007-05-06 16:41:30 +02:00
|
|
|
# If soapserver is protected by HTTP Basic:
|
|
|
|
User => 'http-user',
|
|
|
|
Password => 'pass',
|
2007-02-28 13:56:35 +01:00
|
|
|
},
|
|
|
|
dhtmlXTreeImageLocation=> "/imgs/",
|
|
|
|
}
|
|
|
|
) or die "Unable to start manager";
|
|
|
|
|
|
|
|
$m->doall();
|
|
|
|
|
|
|
|
=head2 Server side
|
|
|
|
|
2009-06-29 11:42:44 +02:00
|
|
|
You just have to set "Soap => 1" in your portal. See HTML documentation for
|
|
|
|
more.
|
2007-02-28 13:56:35 +01:00
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
|
2008-11-17 17:59:56 +01:00
|
|
|
Lemonldap::NG::Common::Conf provides a simple interface to access to
|
2007-02-28 13:56:35 +01:00
|
|
|
Lemonldap::NG Web-SSO configuration. It is used by L<Lemonldap::NG::Handler>,
|
|
|
|
L<Lemonldap::NG::Portal> and L<Lemonldap::NG::Manager>.
|
|
|
|
|
2008-11-17 17:59:56 +01:00
|
|
|
Lemonldap::NG::Common::Conf::SOAP provides the "SOAP" target used to access
|
2007-02-28 13:56:35 +01:00
|
|
|
configuration via SOAP.
|
|
|
|
|
|
|
|
=head2 SECURITY
|
|
|
|
|
2008-11-17 17:59:56 +01:00
|
|
|
As Lemonldap::NG::Common::Conf::SOAP use SOAP::Lite, you have to see
|
2007-02-28 13:56:35 +01:00
|
|
|
L<SOAP::Transport> to know arguments that can be passed to C<proxyOptions>.
|
2007-05-06 16:41:30 +02:00
|
|
|
Lemonldap::NG provides a system for HTTP basic authentication.
|
2007-02-28 13:56:35 +01:00
|
|
|
|
2007-05-06 16:41:30 +02:00
|
|
|
Examples :
|
2007-02-28 13:56:35 +01:00
|
|
|
|
|
|
|
=over
|
|
|
|
|
|
|
|
=item * HTTP Basic authentication
|
|
|
|
|
|
|
|
package My::Package;
|
|
|
|
|
|
|
|
use base Lemonldap::NG::Handler::SharedConf;
|
|
|
|
|
|
|
|
__PACKAGE__->init ( {
|
|
|
|
localStorage => "Cache::FileCache",
|
|
|
|
localStorageOptions => {
|
2012-02-09 18:36:13 +01:00
|
|
|
'namespace' => 'lemonldap-ng',
|
2007-02-28 13:56:35 +01:00
|
|
|
'default_expires_in' => 600,
|
|
|
|
},
|
|
|
|
configStorage => {
|
|
|
|
type => 'SOAP',
|
2009-06-29 11:42:44 +02:00
|
|
|
proxy => 'http://auth.example.com/index.pl/config',
|
2007-05-06 16:41:30 +02:00
|
|
|
User => 'http-user',
|
|
|
|
Password => 'pass',
|
2007-02-28 13:56:35 +01:00
|
|
|
},
|
|
|
|
https => 1,
|
|
|
|
} );
|
|
|
|
|
|
|
|
=item * SSL Authentication
|
|
|
|
|
|
|
|
SOAP::transport provides a simple way to use SSL certificate: you've just to
|
|
|
|
set environment variables.
|
|
|
|
|
|
|
|
package My::Package;
|
|
|
|
|
|
|
|
use base Lemonldap::NG::Handler::SharedConf;
|
|
|
|
|
|
|
|
# AUTHENTICATION
|
|
|
|
$ENV{HTTPS_CERT_FILE} = 'client-cert.pem';
|
|
|
|
$ENV{HTTPS_KEY_FILE} = 'client-key.pem';
|
|
|
|
|
|
|
|
__PACKAGE__->init ( {
|
|
|
|
localStorage => "Cache::FileCache",
|
|
|
|
localStorageOptions => {
|
2012-02-09 18:36:13 +01:00
|
|
|
'namespace' => 'lemonldap-ng',
|
2007-02-28 13:56:35 +01:00
|
|
|
'default_expires_in' => 600,
|
|
|
|
},
|
|
|
|
configStorage => {
|
|
|
|
type => 'SOAP',
|
2009-06-29 11:42:44 +02:00
|
|
|
proxy => 'http://auth.example.com/index.pl/config',
|
2007-02-28 13:56:35 +01:00
|
|
|
},
|
|
|
|
https => 1,
|
|
|
|
} );
|
|
|
|
|
|
|
|
=back
|
|
|
|
|
|
|
|
=head1 SEE ALSO
|
|
|
|
|
2009-06-29 11:42:44 +02:00
|
|
|
L<Lemonldap::NG::Common::Conf::SOAP>,
|
2007-04-02 21:13:05 +02:00
|
|
|
L<Lemonldap::NG::Handler>, L<Lemonldap::NG::Portal>,
|
2010-10-26 08:08:16 +02:00
|
|
|
L<http://lemonldap-ng.org/>
|
2007-02-28 13:56:35 +01:00
|
|
|
|
|
|
|
=head1 AUTHOR
|
|
|
|
|
2013-01-31 06:33:10 +01:00
|
|
|
=over
|
|
|
|
|
|
|
|
=item Clement Oudot, E<lt>clem.oudot@gmail.comE<gt>
|
|
|
|
|
2013-10-19 18:34:20 +02:00
|
|
|
=item François-Xavier Deltombe, E<lt>fxdeltombe@gmail.com.E<gt>
|
2013-01-31 06:33:10 +01:00
|
|
|
|
|
|
|
=item Xavier Guimard, E<lt>x.guimard@free.frE<gt>
|
|
|
|
|
|
|
|
=back
|
2007-02-28 13:56:35 +01:00
|
|
|
|
2007-04-14 15:12:11 +02:00
|
|
|
=head1 BUG REPORT
|
|
|
|
|
|
|
|
Use OW2 system to report bug or ask for features:
|
2010-10-26 08:08:16 +02:00
|
|
|
L<http://jira.ow2.org>
|
2007-04-14 15:12:11 +02:00
|
|
|
|
|
|
|
=head1 DOWNLOAD
|
|
|
|
|
|
|
|
Lemonldap::NG is available at
|
|
|
|
L<http://forge.objectweb.org/project/showfiles.php?group_id=274>
|
|
|
|
|
2007-02-28 13:56:35 +01:00
|
|
|
=head1 COPYRIGHT AND LICENSE
|
|
|
|
|
2013-01-31 06:33:10 +01:00
|
|
|
=over
|
|
|
|
|
2016-01-21 22:15:19 +01:00
|
|
|
=item Copyright (C) 2008-2016 by Xavier Guimard, E<lt>x.guimard@free.frE<gt>
|
2013-01-31 06:33:10 +01:00
|
|
|
|
2016-01-21 22:15:19 +01:00
|
|
|
=item Copyright (C) 2012-2014 by François-Xavier Deltombe, E<lt>fxdeltombe@gmail.com.E<gt>
|
2013-01-31 06:33:10 +01:00
|
|
|
|
2016-01-21 22:15:19 +01:00
|
|
|
=item Copyright (C) 2010-2012 by Clement Oudot, E<lt>clem.oudot@gmail.comE<gt>
|
2013-01-31 06:33:10 +01:00
|
|
|
|
|
|
|
=back
|
2007-02-28 13:56:35 +01:00
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify
|
2013-01-31 06:33:10 +01:00
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see L<http://www.gnu.org/licenses/>.
|
2007-02-28 13:56:35 +01:00
|
|
|
|
|
|
|
=cut
|