#!/usr/bin/perl #================================================ # LemonLDAP::NG default test page # Display headers and environment #================================================ # Init CGI use CGI; my $cgi = CGI->new; # GET parameters my $name = $cgi->param("name") || "LemonLDAP::NG sample protected application"; my $color = $cgi->param("color") || "#ddd"; # Local parameters my $portal_url = "http://auth.__DNSDOMAIN__"; my $manager_url = "http://manager.__DNSDOMAIN__"; # CSS my $css = <{$a} = $_; } } # Display page print $cgi->header( -charset => 'utf-8' ); print "\n"; print qq{\n}; print "\n"; print qq{\n}; print "$name\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print "
\n"; print "
\n"; print "

$name

\n"; print "
\n"; print "
\n"; print "
\n"; print "

Main information

\n"; print "
\n"; print "
\n"; print "
    \n"; print "
  • Authentication status: Success
  • \n"; print "
  • Connected user:
      \n"; print "
    • \$ENV{HTTP_AUTH_USER}: $ENV{HTTP_AUTH_USER}
    • \n"; print "
    • \$ENV{REMOTE_USER}: $ENV{REMOTE_USER}
    • \n"; print "
  • \n"; print "
\n"; print "
Be carefull, the \$ENV{REMOTE_USER} is set only if your script is in the same server than LemonLDAP::NG Handler (\$whatToTrace parameter). If you use it behind a reverse-proxy or in another server than Apache, REMOTE_USER is not set. See this documentation page to know how to convert an HTTP header into an environment variable.
\n"; print "
\n"; print "
\n"; print "
\n"; print "
\n"; print "

HTTP headers

\n"; print "
\n"; print "
\n"; print "

To know who is connected in your applications, you can read HTTP headers:

\n"; print "
\n"; print "\n"; print "\n"; foreach ( sort keys %$headers ) { next if $_ =~ /(Accept|Cache|User-Agent|Connection|Keep-Alive)/i; print qq{\n"; } print "
HeaderCGI environment variablePHP scriptValue
$_ $headers->{$_} \$_SERVER{$headers->{$_}} }; my @tmp; if ( $ENV{ $headers->{$_} } and @tmp = grep /\S/, split( /;/, $ENV{ $headers->{$_} } ) ) { if ($#tmp) { print '
    '; foreach (@tmp) { print "
  • $_
  • "; } print '
'; } else { print $ENV{ $headers->{$_} }; } } else { print "☒",; } print "
\n"; print "

\n"; print "
Note that LemonLDAP::NG cookie is hidden. So that application developpers can not spoof sessions.
\n"; print "
You can access to any information (IP address or LDAP attribute) by customizing exported headers with the LemonLDAP::NG Management interface.
\n"; print "
\n"; print "
\n"; print "
\n"; print "
\n"; print "

Scripts parameters

\n"; print "
\n"; print "
\n"; print "

Find here all GET or POST parameters sent to this page:

\n"; print "
\n"; print "\n"; print "\n"; foreach ( sort $cgi->param() ) { my $tmp = $cgi->param($_); print qq{\n}; } print "
ParameterValue
$_ $tmp
\n"; print "
\n"; print "
POST parameters can be forged by LemonLDAP::NG to autosubmit forms.
\n"; print "
\n"; print "
\n"; print "
\n"; print "
\n"; print "

Environment for Perl CGI

\n"; print "
\n"; print "
\n"; print "
\n"; print "\n"; print "\n"; foreach ( sort keys %ENV ) { my $tmp = $ENV{$_}; $tmp =~ s/&/&/g; $tmp =~ s/>/>/g; $tmp =~ s/\n"; } print "
Environment variableValue
$_ $tmp
\n"; print "
\n"; print "
\n"; print "
\n"; print "
\n"; print "
\n"; print $cgi->end_html;