Lemonldap::Handlers::RewriteHTML - Plugin for Lemonldap sso system


Lemonldap-Handlers-Generic documentation Contained in the Lemonldap-Handlers-Generic distribution.

Index


Code Index:

NAME

Top

    Lemonldap::Handlers::RewriteHTML  - Plugin  for Lemonldap sso system

DESCRIPTION

Top

 RewriteHTML is the default rewriter manager  of lemonldap  websso framework .
 This module rewrite on fly html response

 see http://lemonldap.sf.net for more infos .

Overlay

 If you wat use your own rewriter  method you must use REWRITEHTMLPLUGIN parameter like this :
 in httpd.conf : perlsetvar lemonldappluginhtml MyModule 

 Your module must accept  4 parameters : host :(the virtual host actived) ,target (the host target) 
 https (true if https request )  and  html (the source page in html ) 
 Your module must provide the 'get' method  and return a html string. 

SEE ALSO

Top

Lemonldap(3), Lemonldap::Portal::Standard

http://lemonldap.sourceforge.net/

"Writing Apache Modules with Perl and C" by Lincoln Stein & Doug MacEachern - O'REILLY

Eric German, <germanlinux@yahoo.fr>
Isabelle Serre, <isabelle.serre@justice.gouv.fr>

COPYRIGHT AND LICENSE

Top


Lemonldap-Handlers-Generic documentation Contained in the Lemonldap-Handlers-Generic distribution.

package Lemonldap::Handlers::RewriteHTML;
use strict;
our ( @ISA, $VERSION, @EXPORTS );
$VERSION = '3.1.0';
our $VERSION_LEMONLDAP = "3.1.0";
our $VERSION_INTERNAL  = "3.1.0";
sub get               
{
    my $class =shift;
    my %_param= @_;
    my $html =$_param{'html'};
    my $https =$_param{'https'} ;
    my $host = $_param{'host'};
    my $target = $_param{'target'};

$html =~ s/http:\/\//http:\/\/$host\//gi;
   # href tag
$html=~ s/href="([^\/h])/href="\/$1/ig;
$html=~ s/(href="\/)/href="\/$target\//ig;
# src tag
$html=~ s/src="([^\/h])/src="\/$1/ig;
$html=~ s/(src="\/)/src="\/$target\//ig;
# action tag
$html=~ s/(action=\/)/action=\/$target\//ig;
# base tag
$html =~ s/(\<base\b(.+?))href[^\s]+/$1/i;  
# feuille de style 
$html =~ s/url\('/url\('\/$target\//gi;  
$html =~ s/url\(/url\(\/$target\//gi;  
$html=~ s/http:/https:/g if $https;
return $html;   
       }
	   1;