First code for a floating menu for a protected application (#417)
This commit is contained in:
parent
f022261dbb
commit
9666a31ad9
|
@ -22,6 +22,9 @@ ErrorDocument 503 http://auth.__DNSDOMAIN__/?lmError=503
|
||||||
# SSO protection
|
# SSO protection
|
||||||
PerlHeaderParserHandler My::Package
|
PerlHeaderParserHandler My::Package
|
||||||
|
|
||||||
|
# Display Menu
|
||||||
|
PerlOutputFilterHandler Lemonldap::NG::Handler::Menu
|
||||||
|
|
||||||
# DocumentRoot
|
# DocumentRoot
|
||||||
DocumentRoot __TESTDIR__
|
DocumentRoot __TESTDIR__
|
||||||
<Directory __TESTDIR__>
|
<Directory __TESTDIR__>
|
||||||
|
|
|
@ -15,7 +15,6 @@ my $color = $cgi->param("color") || "#ddd";
|
||||||
|
|
||||||
# Local parameters
|
# Local parameters
|
||||||
my $manager_url = "http://manager.__DNSDOMAIN__";
|
my $manager_url = "http://manager.__DNSDOMAIN__";
|
||||||
my $portal_url = "http://auth.__DNSDOMAIN__";
|
|
||||||
|
|
||||||
# CSS
|
# CSS
|
||||||
my $css = <<EOT;
|
my $css = <<EOT;
|
||||||
|
@ -23,12 +22,13 @@ body{
|
||||||
background:$color;
|
background:$color;
|
||||||
font-family:sans-serif;
|
font-family:sans-serif;
|
||||||
font-size:11pt;
|
font-size:11pt;
|
||||||
padding:0 5%;
|
padding:0;
|
||||||
margin:0;
|
margin:0;
|
||||||
}
|
}
|
||||||
#content{
|
#content{
|
||||||
background:#fff;
|
background:#fff;
|
||||||
padding:10px;
|
padding:10px;
|
||||||
|
margin:0 5%;
|
||||||
}
|
}
|
||||||
#menu{
|
#menu{
|
||||||
text-align:center;
|
text-align:center;
|
||||||
|
@ -99,8 +99,6 @@ print "<div id=\"content\">\n";
|
||||||
|
|
||||||
print "<h1>$name</h1>\n";
|
print "<h1>$name</h1>\n";
|
||||||
|
|
||||||
print "<div id=\"menu\"><a href=\"$portal_url\">Portal</a> - <a href=\"/logout\">Logout</a></div>\n";
|
|
||||||
|
|
||||||
print "<h2>Main informations</h2>\n";
|
print "<h2>Main informations</h2>\n";
|
||||||
print "<ul>\n";
|
print "<ul>\n";
|
||||||
print "<li>Authentication status: SUCCESS</li>\n";
|
print "<li>Authentication status: SUCCESS</li>\n";
|
||||||
|
|
|
@ -13,6 +13,7 @@ lib/Lemonldap/NG/Handler.pm
|
||||||
lib/Lemonldap/NG/Handler/AuthBasic.pm
|
lib/Lemonldap/NG/Handler/AuthBasic.pm
|
||||||
lib/Lemonldap/NG/Handler/CDA.pm
|
lib/Lemonldap/NG/Handler/CDA.pm
|
||||||
lib/Lemonldap/NG/Handler/CGI.pm
|
lib/Lemonldap/NG/Handler/CGI.pm
|
||||||
|
lib/Lemonldap/NG/Handler/Menu.pm
|
||||||
lib/Lemonldap/NG/Handler/Proxy.pm
|
lib/Lemonldap/NG/Handler/Proxy.pm
|
||||||
lib/Lemonldap/NG/Handler/SecureToken.pm
|
lib/Lemonldap/NG/Handler/SecureToken.pm
|
||||||
lib/Lemonldap/NG/Handler/SharedConf.pm
|
lib/Lemonldap/NG/Handler/SharedConf.pm
|
||||||
|
|
75
lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Menu.pm
Normal file
75
lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Menu.pm
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
##@file
|
||||||
|
# Menu
|
||||||
|
|
||||||
|
##@class
|
||||||
|
# Menu
|
||||||
|
#
|
||||||
|
# Display a menu on protected applications
|
||||||
|
package Lemonldap::NG::Handler::Menu;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use Lemonldap::NG::Handler::SharedConf qw(:all);
|
||||||
|
use base qw(Lemonldap::NG::Handler::SharedConf);
|
||||||
|
use Apache2::Filter ();
|
||||||
|
use constant BUFF_LEN => 1024;
|
||||||
|
|
||||||
|
## @rmethod Apache2::Const run(Apache2::Filter f)
|
||||||
|
# Overload main run method
|
||||||
|
# @param f Apache2 Filter
|
||||||
|
# @return Apache2::Const::OK
|
||||||
|
sub run {
|
||||||
|
my $class = shift;
|
||||||
|
my $f = $_[0];
|
||||||
|
|
||||||
|
unless ( $f->ctx ) {
|
||||||
|
$f->r->headers_out->unset('Content-Length');
|
||||||
|
$f->ctx(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
# CSS parameters
|
||||||
|
my $background = "#ccc";
|
||||||
|
my $border = "#aaa";
|
||||||
|
my $width = "30%";
|
||||||
|
my $marginleft = "35%";
|
||||||
|
my $marginright = "35%";
|
||||||
|
my $height = "20px";
|
||||||
|
|
||||||
|
my $menudiv = "
|
||||||
|
<style>
|
||||||
|
#lemonldap-ng-menu {
|
||||||
|
background-color: $background;
|
||||||
|
border-color: $border;
|
||||||
|
border-width: 2px 2px 0 2px;
|
||||||
|
border-style: solid;
|
||||||
|
border-top-left-radius: 10px;
|
||||||
|
border-top-right-radius: 10px;
|
||||||
|
width: $width;
|
||||||
|
height: $height;
|
||||||
|
margin-right: $marginright;
|
||||||
|
margin-left: $marginleft;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0px;
|
||||||
|
text-align: center;
|
||||||
|
padding: 3px;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
html>body #lemonldap-ng-menu {
|
||||||
|
position: fixed;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div id=\"lemonldap-ng-menu\">
|
||||||
|
<a href=\"" . $class->portal() . "\">☖ Home</a>
|
||||||
|
<span> </span>
|
||||||
|
<a href=\"/logout\">☒ Logout</a>
|
||||||
|
</div>";
|
||||||
|
|
||||||
|
while ( $f->read( my $buffer, BUFF_LEN ) ) {
|
||||||
|
$buffer =~ s/<\/body>/$menudiv<\/body>/g;
|
||||||
|
$f->print($buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
Loading…
Reference in New Issue
Block a user