Commit 4f8830fd authored by Yadd's avatar Yadd
Browse files

Macros are working now (#595)

parent 3290e2bd
......@@ -117,6 +117,12 @@ sub reloadConf {
return 0;
}
# Initialize persistent session DB
unless ( $self->conf->{persistentStorage} ) {
$self->conf->{persistentStorage} = $self->conf->{globalStorage};
$self->conf->{persistentStorageOptions} = $self->conf->{globalStorageOptions};
}
# Initialize cookie domain
unless ( $self->conf->{domain} ) {
$self->error('Configuration error: no domain');
......@@ -193,8 +199,10 @@ sub reloadConf {
$self->{"_$type"} = {};
if ( $self->conf->{$type} ) {
for my $name ( sort keys %{ $self->conf->{$type} } ) {
my $sub = HANDLER->tsv->{jail}->jail_reval(
"sub{return(" . $self->conf->{$type}->{$name} . ")}" );
my $sub =
HANDLER->tsv->{jail}->jail_reval( "sub{return("
. HANDLER->substitute( $self->conf->{$type}->{$name} )
. ")}" );
if ($sub) {
$self->{"_$type"}->{$name} = $sub;
}
......
......@@ -143,6 +143,9 @@ sub authenticate {
sub setSessionInfo {
my ( $self, $req ) = @_;
# Set _user
$req->{sessionInfo}->{_user} = $req->{user};
# Get the current user module
$req->{sessionInfo}->{_auth} = $self->getModule( $req, "auth" );
$req->{sessionInfo}->{_userDB} = $self->getModule( $req, "user" );
......
......@@ -227,10 +227,10 @@ sub getPersistentSession {
my $ps = Lemonldap::NG::Common::Session->new(
{
storageModule => $self->{persistentStorage},
storageModuleOptions => $self->{persistentStorageOptions},
cacheModule => $self->{localSessionStorage},
cacheModuleOptions => $self->{localSessionStorageOptions},
storageModule => $self->conf->{persistentStorage},
storageModuleOptions => $self->conf->{persistentStorageOptions},
cacheModule => $self->conf->{localSessionStorage},
cacheModuleOptions => $self->conf->{localSessionStorageOptions},
id => $pid,
force => 1,
kind => "Persistent",
......
......@@ -6,7 +6,7 @@ require 't/test-lib.pm';
my $res;
init( { logLevel => 'debug' } );
init( { logLevel => 'debug', useSafeJail => 1 } );
ok( $res = &client->_get('/'), 'Unauth JSON request' );
ok( $res->[0] == 401, 'Response is 401' ) or explain( $res, 401 );
......@@ -40,9 +40,18 @@ ok(
),
'Auth ajax request with good url'
);
count(1);
print STDERR Dumper($res);
ok( $res->[0] == 302, 'Get redirection' ) or explain( $res, 302 );
my %hdrs = @{ $res->[1] };
ok(
$hdrs{Location} eq 'http://test1.example.com/',
'Location is http://test1.example.com/'
) or explain( \%hdrs, 'Location => "http://test1.example.com/"' );
ok( $hdrs{'Lm-Remote-User'} eq 'dwho', 'User is set' )
or explain( \%hdrs, 'Lm-Remote-User => "dwho"' );
count(4);
#print STDERR Dumper($res);
#clean_sessions();
clean_sessions();
done_testing( count() );
......@@ -80,7 +80,6 @@ has app => (
sub _get {
my ( $self, $path, %args ) = @_;
print STDERR Data::Dumper::Dumper( \%args );
return $self->app->(
{
'HTTP_ACCEPT' => $args{accept}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment