2014-03-13 16:07:36 +01:00
|
|
|
# Auth-basic authentication with Lemonldap::NG rights management
|
2014-03-20 19:40:26 +01:00
|
|
|
|
|
|
|
# This specific handler is intended to be called directly by Apache
|
|
|
|
|
2016-03-25 12:32:20 +01:00
|
|
|
package Lemonldap::NG::Handler::AuthBasic;
|
2014-03-13 16:07:36 +01:00
|
|
|
|
2016-10-13 21:42:34 +02:00
|
|
|
use strict;
|
2016-03-17 23:19:44 +01:00
|
|
|
use Lemonldap::NG::Handler::ApacheMP2;
|
2016-09-30 07:15:17 +02:00
|
|
|
use Lemonldap::NG::Handler::Lib::AuthBasic;
|
2014-03-13 16:07:36 +01:00
|
|
|
|
2016-10-13 21:42:34 +02:00
|
|
|
BEGIN {
|
|
|
|
our @ISA = ('Lemonldap::NG::Handler::Main');
|
|
|
|
}
|
2014-03-13 16:07:36 +01:00
|
|
|
|
2016-03-17 23:19:44 +01:00
|
|
|
our $VERSION = '2.0.0';
|
2016-02-26 18:39:06 +01:00
|
|
|
|
2016-09-30 07:15:17 +02:00
|
|
|
# PUBLIC METHODS
|
2014-03-13 16:07:36 +01:00
|
|
|
|
2016-09-30 07:15:17 +02:00
|
|
|
sub handler {
|
|
|
|
my $class;
|
|
|
|
$class = $#_ ? shift : __PACKAGE__;
|
|
|
|
my ($res) = $class->run(@_);
|
|
|
|
return $res;
|
2014-06-25 12:01:17 +02:00
|
|
|
}
|
2014-03-13 16:07:36 +01:00
|
|
|
|
2016-10-13 21:42:34 +02:00
|
|
|
# For an obscur reason, inheritance isn't possible with ApacheMP2.pm.
|
2014-03-13 16:07:36 +01:00
|
|
|
|
2016-10-13 21:42:34 +02:00
|
|
|
*FORBIDDEN = *Lemonldap::NG::Handler::ApacheMP2::FORBIDDEN;
|
|
|
|
*HTTP_UNAUTHORIZED = *Lemonldap::NG::Handler::ApacheMP2::HTTP_UNAUTHORIZED;
|
|
|
|
*REDIRECT = *Lemonldap::NG::Handler::ApacheMP2::REDIRECT;
|
|
|
|
*OK = *Lemonldap::NG::Handler::ApacheMP2::OK;
|
|
|
|
*DECLINED = *Lemonldap::NG::Handler::ApacheMP2::DECLINED;
|
|
|
|
*DONE = *Lemonldap::NG::Handler::ApacheMP2::DONE;
|
|
|
|
*SERVER_ERROR = *Lemonldap::NG::Handler::ApacheMP2::SERVER_ERROR;
|
|
|
|
*AUTH_REQUIRED = *Lemonldap::NG::Handler::ApacheMP2::AUTH_REQUIRED;
|
|
|
|
*MAINTENANCE = *Lemonldap::NG::Handler::ApacheMP2::MAINTENANCE;
|
2014-03-13 16:07:36 +01:00
|
|
|
|
2016-09-30 07:15:17 +02:00
|
|
|
*_lmLog = *Lemonldap::NG::Handler::ApacheMP2::_lmLog;
|
2016-10-13 21:42:34 +02:00
|
|
|
*addToHtmlHead = *Lemonldap::NG::Handler::ApacheMP2::addToHtmlHead;
|
2016-09-30 07:15:17 +02:00
|
|
|
*args = *Lemonldap::NG::Handler::ApacheMP2::args;
|
2016-10-13 21:42:34 +02:00
|
|
|
*flatten_bb = *Lemonldap::NG::Handler::ApacheMP2::flatten_bb;
|
2016-09-30 07:15:17 +02:00
|
|
|
*get_server_port = *Lemonldap::NG::Handler::ApacheMP2::get_server_port;
|
|
|
|
*header_in = *Lemonldap::NG::Handler::ApacheMP2::header_in;
|
|
|
|
*hostname = *Lemonldap::NG::Handler::ApacheMP2::hostname;
|
|
|
|
*is_initial_req = *Lemonldap::NG::Handler::ApacheMP2::is_initial_req;
|
|
|
|
*method = *Lemonldap::NG::Handler::ApacheMP2::method;
|
2016-10-13 21:42:34 +02:00
|
|
|
*newRequest = *Lemonldap::NG::Handler::ApacheMP2::newRequest;
|
2016-09-30 07:15:17 +02:00
|
|
|
*print = *Lemonldap::NG::Handler::ApacheMP2::print;
|
2016-10-13 21:42:34 +02:00
|
|
|
*redirectFilter = *Lemonldap::NG::Handler::ApacheMP2::redirectFilter;
|
2016-09-30 07:15:17 +02:00
|
|
|
*remote_ip = *Lemonldap::NG::Handler::ApacheMP2::remote_ip;
|
|
|
|
*set_header_in = *Lemonldap::NG::Handler::ApacheMP2::set_header_in;
|
|
|
|
*set_header_out = *Lemonldap::NG::Handler::ApacheMP2::set_header_out;
|
|
|
|
*set_user = *Lemonldap::NG::Handler::ApacheMP2::set_user;
|
2016-10-13 21:42:34 +02:00
|
|
|
*setPostParams = *Lemonldap::NG::Handler::ApacheMP2::setPostParams;
|
2016-09-30 07:15:17 +02:00
|
|
|
*setServerSignature = *Lemonldap::NG::Handler::ApacheMP2::setServerSignature;
|
2016-10-13 21:42:34 +02:00
|
|
|
*thread_share = *Lemonldap::NG::Handler::ApacheMP2::thread_share;
|
2016-09-30 07:15:17 +02:00
|
|
|
*unparsed_uri = *Lemonldap::NG::Handler::ApacheMP2::unparsed_uri;
|
|
|
|
*unset_header_in = *Lemonldap::NG::Handler::ApacheMP2::unset_header_in;
|
|
|
|
*uri = *Lemonldap::NG::Handler::ApacheMP2::uri;
|
|
|
|
*uri_with_args = *Lemonldap::NG::Handler::ApacheMP2::uri_with_args;
|
|
|
|
*unparsed_uri = *Lemonldap::NG::Handler::ApacheMP2::unparsed_uri;
|
|
|
|
|
2016-10-13 21:42:34 +02:00
|
|
|
__PACKAGE__->init();
|
|
|
|
|
2014-03-13 16:07:36 +01:00
|
|
|
1;
|
|
|
|
|
|
|
|
__END__
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
|
|
|
=encoding utf8
|
|
|
|
|
|
|
|
Lemonldap::NG::Handler::AuthBasic - Perl extension to be able to authenticate
|
|
|
|
users by basic web system but to use Lemonldap::NG to control authorizations.
|
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
|
|
|
|
Create your own package:
|
|
|
|
|
|
|
|
package My::Package;
|
|
|
|
use Lemonldap::NG::Handler::AuthBasic;
|
|
|
|
|
|
|
|
# IMPORTANT ORDER
|
|
|
|
our @ISA = qw (Lemonldap::NG::Handler::AuthBasic);
|
|
|
|
|
|
|
|
__PACKAGE__->init ( {
|
|
|
|
# Local storage used for sessions and configuration
|
|
|
|
localStorage => "Cache::DBFile",
|
|
|
|
localStorageOptions => {...},
|
|
|
|
# How to get my configuration
|
|
|
|
configStorage => {
|
|
|
|
type => "DBI",
|
|
|
|
dbiChain => "DBI:mysql:database=lemondb;host=$hostname",
|
|
|
|
dbiUser => "lemonldap",
|
|
|
|
dbiPassword => "password",
|
|
|
|
}
|
|
|
|
# Uncomment this to activate status module
|
|
|
|
# status => 1,
|
|
|
|
} );
|
|
|
|
|
|
|
|
Call your package in <apache-directory>/conf/httpd.conf
|
|
|
|
|
|
|
|
PerlRequire MyFile
|
|
|
|
PerlHeaderParserHandler My::Package
|
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
|
|
|
|
This library provides a way to use Lemonldap::NG to manage authorizations
|
|
|
|
without using Lemonldap::NG for authentications. This can be used in conjunction
|
|
|
|
with a normal Lemonldap::NG installation but to manage non-browser clients.
|
|
|
|
|
|
|
|
=head1 SEE ALSO
|
|
|
|
|
|
|
|
L<Lemonldap::NG::Handler(3)>,
|
|
|
|
L<http://lemonldap-ng.org/>
|
|
|
|
|
|
|
|
=head1 AUTHOR
|
|
|
|
|
|
|
|
=over
|
|
|
|
|
|
|
|
=item Clement Oudot, E<lt>clem.oudot@gmail.comE<gt>
|
|
|
|
|
|
|
|
=item François-Xavier Deltombe, E<lt>fxdeltombe@gmail.com.E<gt>
|
|
|
|
|
|
|
|
=item Xavier Guimard, E<lt>x.guimard@free.frE<gt>
|
|
|
|
|
|
|
|
=back
|
|
|
|
|
|
|
|
=head1 BUG REPORT
|
|
|
|
|
|
|
|
Use OW2 system to report bug or ask for features:
|
|
|
|
L<http://jira.ow2.org>
|
|
|
|
|
|
|
|
=head1 DOWNLOAD
|
|
|
|
|
|
|
|
Lemonldap::NG is available at
|
|
|
|
L<http://forge.objectweb.org/project/showfiles.php?group_id=274>
|
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE
|
|
|
|
|
|
|
|
=over
|
|
|
|
|
2016-01-21 22:15:19 +01:00
|
|
|
=item Copyright (C) 2008-2010 by Xavier Guimard, E<lt>x.guimard@free.frE<gt>
|
2014-03-13 16:07:36 +01:00
|
|
|
|
2016-01-21 22:15:19 +01:00
|
|
|
=item Copyright (C) 2012-2013 by François-Xavier Deltombe, E<lt>fxdeltombe@gmail.com.E<gt>
|
2014-03-13 16:07:36 +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>
|
2014-03-13 16:07:36 +01:00
|
|
|
|
|
|
|
=back
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify
|
|
|
|
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/>.
|
|
|
|
|
|
|
|
=cut
|