Finish Apache2 AuthBasic (#595)
This commit is contained in:
parent
8740fdf54b
commit
4bd223eab3
|
@ -4,10 +4,13 @@
|
|||
|
||||
package Lemonldap::NG::Handler::AuthBasic;
|
||||
|
||||
use strict;
|
||||
use Lemonldap::NG::Handler::ApacheMP2;
|
||||
use Lemonldap::NG::Handler::Lib::AuthBasic;
|
||||
|
||||
@ISA = ('Lemonldap::NG::Handler::ApacheMP2');
|
||||
BEGIN {
|
||||
our @ISA = ('Lemonldap::NG::Handler::Main');
|
||||
}
|
||||
|
||||
our $VERSION = '2.0.0';
|
||||
|
||||
|
@ -20,29 +23,45 @@ sub handler {
|
|||
return $res;
|
||||
}
|
||||
|
||||
die unless __PACKAGE__->can('retrieveSession');
|
||||
# For an obscur reason, inheritance isn't possible with ApacheMP2.pm.
|
||||
|
||||
__PACKAGE__->init();
|
||||
*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;
|
||||
|
||||
*_lmLog = *Lemonldap::NG::Handler::ApacheMP2::_lmLog;
|
||||
*addToHtmlHead = *Lemonldap::NG::Handler::ApacheMP2::addToHtmlHead;
|
||||
*args = *Lemonldap::NG::Handler::ApacheMP2::args;
|
||||
*flatten_bb = *Lemonldap::NG::Handler::ApacheMP2::flatten_bb;
|
||||
*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;
|
||||
*newRequest = *Lemonldap::NG::Handler::ApacheMP2::newRequest;
|
||||
*print = *Lemonldap::NG::Handler::ApacheMP2::print;
|
||||
*redirectFilter = *Lemonldap::NG::Handler::ApacheMP2::redirectFilter;
|
||||
*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;
|
||||
*setPostParams = *Lemonldap::NG::Handler::ApacheMP2::setPostParams;
|
||||
*setServerSignature = *Lemonldap::NG::Handler::ApacheMP2::setServerSignature;
|
||||
*thread_share = *Lemonldap::NG::Handler::ApacheMP2::thread_share;
|
||||
*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;
|
||||
|
||||
__PACKAGE__->init();
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
|
|
@ -41,11 +41,11 @@ sub retrieveSession {
|
|||
my ( $class, $id ) = @_;
|
||||
|
||||
# First check if session already exists
|
||||
return 1 if ( $class->SUPER::retrieveSession($id) );
|
||||
return 1 if ( $class->Lemonldap::NG::Handler::Main::Run::retrieveSession($id) );
|
||||
|
||||
# Then ask portal to create it
|
||||
if ( $class->createSession($id) ) {
|
||||
return $class->SUPER::retrieveSession($id);
|
||||
return $class->Lemonldap::NG::Handler::Main::Run::retrieveSession($id);
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
|
@ -72,6 +72,7 @@ sub createSession {
|
|||
$creds =~ s/^Basic\s+//;
|
||||
my ( $user, $pwd ) = ( decode_base64($creds) =~ /^(.*?):(.*)$/ );
|
||||
$class->lmLog( "AuthBasic authentication for user: $user", 'debug' );
|
||||
die 'Replace this by REST call';
|
||||
my $soapRequest = $soapClient->getCookies( $user, $pwd, $id );
|
||||
|
||||
# Catch SOAP errors
|
||||
|
@ -114,7 +115,7 @@ sub hideCookie {
|
|||
sub goToPortal {
|
||||
my ( $class, $url, $arg ) = @_;
|
||||
if ($arg) {
|
||||
return $class->SUPER::goToPortal( $url, $arg );
|
||||
return $class->Lemonldap::NG::Handler::Main::Run::goToPortal( $url, $arg );
|
||||
}
|
||||
else {
|
||||
$class->set_header_out(
|
||||
|
|
|
@ -343,7 +343,7 @@ sub goToPortal {
|
|||
$class->lmLog(
|
||||
"Redirect " . $class->remote_ip . " to portal (url was $url)",
|
||||
'debug' );
|
||||
$class->set_header_out( 'Location' => &{ $class->tsv->{portal} }()
|
||||
$class->set_header_out( 'Location' => $class->tsv->{portal}->()
|
||||
. "?url=$urlc_init"
|
||||
. ( $arg ? "&$arg" : "" ) );
|
||||
return $class->REDIRECT;
|
||||
|
|
Loading…
Reference in New Issue
Block a user