Commit b1c637cf authored by Christophe Maudoux's avatar Christophe Maudoux

Revert "Append a custom param to be logged (#1885)"

This reverts commit 1e838f04
parent 1e838f04
Pipeline #6162 passed with stage
in 13 minutes and 21 seconds
......@@ -50,7 +50,6 @@ sub defaultValues {
'cspImg' => '\'self\' data:',
'cspScript' => '\'self\'',
'cspStyle' => '\'self\'',
'customToTrace' => 'mail',
'dbiAuthnLevel' => 2,
'dbiExportedVars' => {},
'demoExportedVars' => {
......
......@@ -92,10 +92,6 @@ sub handler {
if ( $hdrs{'Lm-Remote-User'} ) {
$r->user( $hdrs{'Lm-Remote-User'} );
}
if ( $hdrs{'Lm-Remote-Custom'} ) {
$r->custom( $hdrs{'Lm-Remote-Custom'} );
}
my $i = 1;
while ( $hdrs{"Headername$i"} ) {
$r->headers_in->set( $hdrs{"Headername$i"} => $hdrs{"Headervalue$i"} )
......
......@@ -81,14 +81,6 @@ sub set_user {
$request->env->{'psgi.r'}->user($user);
}
## @method void set_user(string user)
# sets remote_user
# @param user string username
sub set_custom {
my ( $class, $request, $custom ) = @_;
$request->env->{'psgi.r'}->custom($custom);
}
## @method void set_header_in(hash headers)
# sets or modifies request headers
# @param headers hash containing header names => header value
......
......@@ -177,14 +177,6 @@ sub user {
|| _whatToTrace => 'anonymous' };
}
## @method hashRef custom()
# @return hash of custom data
sub custom {
my ( $self, $req ) = @_;
return { $Lemonldap::NG::Handler::Main::tsv->{customToTrace}
|| customToTrace => '-' };
}
## @method string userId()
# @return user identifier to log
sub userId {
......
......@@ -197,7 +197,7 @@ sub defaultValuesInit {
securedCookie timeout timeoutActivity
timeoutActivityInterval useRedirectOnError useRedirectOnForbidden
useSafeJail whatToTrace handlerInternalCache
handlerServiceTokenTTL customToTrace
handlerServiceTokenTTL
)
);
......
......@@ -147,7 +147,6 @@ sub run {
# ACCOUNTING (1. Inform web server)
$class->set_user( $req, $session->{ $class->tsv->{whatToTrace} } );
$class->set_custom( $req, $session->{ $class->tsv->{customToTrace} } );
# AUTHORIZATION
return ( $class->forbidden( $req, $session ), $session )
......
......@@ -41,14 +41,6 @@ sub set_user {
push @{ $req->{respHeaders} }, 'Lm-Remote-User' => $user;
}
## @method void set_custom(string custom)
# sets remote_custom in response headers
# @param custom string custom_value
sub set_custom {
my ( $class, $req, $custom ) = @_;
push @{ $req->{respHeaders} }, 'Lm-Remote-Custom' => $custom;
}
## @method void set_header_in(hash headers)
# sets or modifies request headers
# @param headers hash containing header names => header value
......
......@@ -39,7 +39,6 @@ sub unset_header_in {
*setServerSignature = *Lemonldap::NG::Handler::PSGI::Main::setServerSignature;
*thread_share = *Lemonldap::NG::Handler::PSGI::Main::thread_share;
*set_user = *Lemonldap::NG::Handler::PSGI::Main::set_user;
*set_custom = *Lemonldap::NG::Handler::PSGI::Main::set_custom;
*set_header_out = *Lemonldap::NG::Handler::PSGI::Main::set_header_out;
*is_initial_req = *Lemonldap::NG::Handler::PSGI::Main::is_initial_req;
*print = *Lemonldap::NG::Handler::PSGI::Main::print;
......
......@@ -72,7 +72,7 @@ sub handler {
my $i = 0;
while ( my $k = shift @$hdrs ) {
my $v = shift @$hdrs;
if ( $k =~ /^(?:Lm-Remote-(?:User|Custom)|Cookie)$/ ) {
if ( $k =~ /^(?:Lm-Remote-User|Cookie)$/ ) {
push @convertedHdrs, $k, $v;
}
else {
......
......@@ -1019,10 +1019,6 @@ qr/(?:(?:https?):\/\/(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.]
'customRegister' => {
'type' => 'text'
},
'customToTrace' => {
'default' => 'mail',
'type' => 'lmAttrOrMacro'
},
'customUserDB' => {
'type' => 'text'
},
......
......@@ -879,12 +879,6 @@ sub attributes {
documentation => 'Session parameter used to fill REMOTE_USER',
flags => 'hp',
},
customToTrace => {
type => 'lmAttrOrMacro',
default => 'mail',
documentation => 'Session parameter used to fill REMOTE_CUSTOM',
flags => 'hp',
},
lwpOpts => {
type => 'keyTextContainer',
documentation => 'Options given to LWP::UserAgent',
......
......@@ -499,7 +499,7 @@ sub tree {
title => 'logParams',
help => 'logs.html',
form => 'simpleInputContainer',
nodes => [ 'whatToTrace', 'customToTrace', 'hiddenAttributes' ]
nodes => [ 'whatToTrace', 'hiddenAttributes' ]
},
{
title => 'cookieParams',
......
......@@ -204,7 +204,6 @@
"customPassword":"وحدة كلمة المرورالمخصصة",
"customPortalSkin":"غلاف البوابة مخصص",
"customRegister":"وحدة تسجيل مخصص",
"customToTrace":"REMOTE_CUSTOM",
"customUserDB":"وحدة قاعدة البيانات المخصصة",
"date":"تاريخ",
"dbiAuthChain":"سلسلة",
......
......@@ -204,7 +204,6 @@
"customPassword":"Custom password module",
"customPortalSkin":"Custom portal skin",
"customRegister":"Custom register module",
"customToTrace":"REMOTE_CUSTOM",
"customUserDB":"Custom user DB module",
"date":"Datum",
"dbiAuthChain":"Chain",
......
......@@ -204,7 +204,6 @@
"customPassword":"Custom password module",
"customPortalSkin":"Custom portal skin",
"customRegister":"Custom register module",
"customToTrace":"REMOTE_CUSTOM",
"customUserDB":"Custom user DB module",
"date":"Date",
"dbiAuthChain":"Chain",
......
......@@ -204,7 +204,6 @@
"customPassword":"Module de mots-de-passe personnalisé",
"customPortalSkin":"Style personnalisé du portail",
"customRegister":"Module d'enregistrement personnalisé",
"customToTrace":"REMOTE_CUSTOM",
"customUserDB":"Module BD utilisateurs personnalisé",
"date":"Date",
"dbiAuthChain":"Chaîne",
......
......@@ -204,7 +204,6 @@
"customPassword":"Personalizza il modulo password",
"customPortalSkin":"Personalizza faccia del portale ",
"customRegister":"Personalizza modulo di registro",
"customToTrace":"REMOTE_CUSTOM",
"customUserDB":"Personalizza modulo utente DB",
"date":"Data",
"dbiAuthChain":"Catena",
......
......@@ -204,7 +204,6 @@
"customPassword":"Mô đun mật khẩu tùy chỉnh",
"customPortalSkin":"Tùy chỉnh giao diện cổng thông tin",
"customRegister":"Module đăng ký tùy chỉnh",
"customToTrace":"REMOTE_CUSTOM",
"customUserDB":"Mô đun DB người dùng tùy chỉnh",
"date":"Ngày",
"dbiAuthChain":"Chuỗi",
......
......@@ -204,7 +204,6 @@
"customPassword":"Custom password module",
"customPortalSkin":"Custom portal skin",
"customRegister":"Custom register module",
"customToTrace":"REMOTE_CUSTOM",
"customUserDB":"Custom user DB module",
"date":"日期",
"dbiAuthChain":"Chain",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -37,33 +37,44 @@ ok( $res->[2]->[0] =~ m%<span id="languages"></span>%, ' Language icons found' )
or print STDERR Dumper( $res->[2]->[0] );
count(2);
my %policy = @{ $res->[1] };
# CORS
ok( $policy{'Access-Control-Allow-Origin'} eq '', "CORS origin '' found" )
ok( $res->[1]->[12] eq 'Access-Control-Allow-Origin', ' CORS origin found' )
or print STDERR Dumper( $res->[1] );
ok( $res->[1]->[13] eq '', " CORS origin ''" )
or print STDERR Dumper( $res->[1] );
ok( $res->[1]->[14] eq 'Access-Control-Allow-Credentials',
' CORS credentials found' )
or print STDERR Dumper( $res->[1] );
ok( $res->[1]->[15] eq 'true', " CORS credentials 'true'" )
or print STDERR Dumper( $res->[1] );
ok( $res->[1]->[16] eq 'Access-Control-Allow-Headers', " CORS headers found" )
or print STDERR Dumper( $res->[1] );
ok( $policy{'Access-Control-Allow-Credentials'} eq 'true',
"CORS credentials 'true' found" )
ok( $res->[1]->[17] eq '*', " CORS headers '*'" )
or print STDERR Dumper( $res->[1] );
ok( $policy{'Access-Control-Allow-Headers'} eq '*', "CORS headers '*' found" )
ok( $res->[1]->[18] eq 'Access-Control-Allow-Methods', " CORS methods found" )
or print STDERR Dumper( $res->[1] );
ok( $policy{'Access-Control-Allow-Methods'} eq 'POST',
"CORS methods 'POST' found" )
ok( $res->[1]->[19] eq 'POST', " CORS methods 'POST'" )
or print STDERR Dumper( $res->[1] );
ok( $policy{'Access-Control-Expose-Headers'} eq '*',
"CORS expose-headers '*' found" )
ok( $res->[1]->[20] eq 'Access-Control-Expose-Headers',
" CORS expose-headers found" )
or print STDERR Dumper( $res->[1] );
ok( $policy{'Access-Control-Max-Age'} eq '86400', "CORS max-age '86400' found" )
ok( $res->[1]->[21] eq '*', " CORS expose-headers '*'" )
or print STDERR Dumper( $res->[1] );
count(6);
ok( $res->[1]->[22] eq 'Access-Control-Max-Age', ' CORS max-age found' )
or print STDERR Dumper( $res->[1] );
ok( $res->[1]->[23] == 86400, ' CORS max-age 86400' )
or print STDERR Dumper( $res->[1] );
count(12);
#CSP
ok( $res->[1]->[26] eq 'Content-Security-Policy', ' CSP found' )
or print STDERR Dumper( $res->[1] );
ok(
$policy{'Content-Security-Policy'} =~
$res->[1]->[27] =~
/default-src 'self';img-src 'self' data:;style-src 'self';font-src 'self';connect-src 'self';script-src 'self';form-action \*;frame-ancestors 'none'/,
'CSP header value found'
' CSP headers found'
) or print STDERR Dumper( $res->[1] );
count(1);
count(2);
# Try to authenticate with good password
# --------------------------------------
......@@ -104,27 +115,39 @@ ok(
);
count(1);
# CORS
%policy = @{ $res->[1] };
ok( $policy{'Access-Control-Allow-Origin'} eq '', "CORS origin '' found" )
ok( $res->[1]->[14] eq 'Access-Control-Allow-Origin', ' CORS origin found' )
or print STDERR Dumper( $res->[1] );
ok( $res->[1]->[15] eq '', " CORS origin ''" )
or print STDERR Dumper( $res->[1] );
ok( $res->[1]->[16] eq 'Access-Control-Allow-Credentials',
' CORS credentials found' )
or print STDERR Dumper( $res->[1] );
ok( $res->[1]->[17] eq 'true', " CORS credentials 'true'" )
or print STDERR Dumper( $res->[1] );
ok( $policy{'Access-Control-Allow-Credentials'} eq 'true',
"CORS credentials 'true' found" )
ok( $res->[1]->[18] eq 'Access-Control-Allow-Headers', " CORS headers found" )
or print STDERR Dumper( $res->[1] );
ok( $policy{'Access-Control-Allow-Headers'} eq '*', "CORS headers '*' found" )
ok( $res->[1]->[19] eq '*', " CORS headers '*'" )
or print STDERR Dumper( $res->[1] );
ok( $policy{'Access-Control-Allow-Methods'} eq 'POST',
"CORS methods 'POST' found" )
ok( $res->[1]->[20] eq 'Access-Control-Allow-Methods', " CORS methods found" )
or print STDERR Dumper( $res->[1] );
ok( $policy{'Access-Control-Expose-Headers'} eq '*',
"CORS expose-headers '*' found" )
ok( $res->[1]->[21] eq 'POST', " CORS methods 'POST'" )
or print STDERR Dumper( $res->[1] );
ok( $policy{'Access-Control-Max-Age'} eq '86400', "CORS max-age '86400' found" )
ok( $res->[1]->[22] eq 'Access-Control-Expose-Headers',
" CORS expose-headers found" )
or print STDERR Dumper( $res->[1] );
count(6);
ok( $res->[1]->[23] eq '*', " CORS expose-headers '*'" )
or print STDERR Dumper( $res->[1] );
ok( $res->[1]->[24] eq 'Access-Control-Max-Age', ' CORS max-age found' )
or print STDERR Dumper( $res->[1] );
ok( $res->[1]->[25] == 86400, ' CORS max-age 86400' )
or print STDERR Dumper( $res->[1] );
count(12);
# Test logout
$client->logout($id);
#print STDERR Dumper($res);
clean_sessions();
done_testing( count() );
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