Add "public pages" concept to 2.0 (#1120)
This commit is contained in:
parent
3dd8684829
commit
ca2c453e71
|
@ -1,7 +1,6 @@
|
|||
* securize SOAP session creation by cipher
|
||||
* write REST method to create session with an id
|
||||
* remove cache on handler init()
|
||||
* public\_page
|
||||
* Test ForceAuth
|
||||
* Calendar in notifications explorer
|
||||
* login history
|
||||
|
|
|
@ -249,12 +249,12 @@ sub sendHtml {
|
|||
$htpl->param(
|
||||
STATIC_PREFIX => $sp,
|
||||
SCRIPTNAME => $sc,
|
||||
( $self->can('tplParams') ? ( $self->tplParams ) : () ),
|
||||
(
|
||||
$args{params}
|
||||
? %{ $args{params} }
|
||||
: ()
|
||||
),
|
||||
( $self->can('tplParams') ? ( $self->tplParams ) : () ),
|
||||
);
|
||||
};
|
||||
if ($@) {
|
||||
|
|
|
@ -80,6 +80,7 @@ lib/Lemonldap/NG/Portal/Plugins/GrantSession.pm
|
|||
lib/Lemonldap/NG/Portal/Plugins/History.pm
|
||||
lib/Lemonldap/NG/Portal/Plugins/MailReset.pm
|
||||
lib/Lemonldap/NG/Portal/Plugins/Notifications.pm
|
||||
lib/Lemonldap/NG/Portal/Plugins/PublicPages.pm
|
||||
lib/Lemonldap/NG/Portal/Plugins/Register.pm
|
||||
lib/Lemonldap/NG/Portal/Plugins/RESTServer.pm
|
||||
lib/Lemonldap/NG/Portal/Plugins/SingleSession.pm
|
||||
|
@ -270,6 +271,7 @@ site/templates/bootstrap/notification.tpl
|
|||
site/templates/bootstrap/openid.tpl
|
||||
site/templates/bootstrap/openidform.tpl
|
||||
site/templates/bootstrap/password.tpl
|
||||
site/templates/bootstrap/public/test.tpl
|
||||
site/templates/bootstrap/redirect.tpl
|
||||
site/templates/bootstrap/register.tpl
|
||||
site/templates/bootstrap/standardform.tpl
|
||||
|
|
|
@ -45,7 +45,6 @@ sub display {
|
|||
$self->controlUrl($req);
|
||||
|
||||
%templateParams = (
|
||||
PORTAL_URL => $self->conf->{portal},
|
||||
LOGOUT_URL => $self->conf->{portal} . "?logout=1",
|
||||
URL => $req->{urldc},
|
||||
);
|
||||
|
@ -125,7 +124,6 @@ sub display {
|
|||
AUTH_ERROR => $self->error,
|
||||
AUTH_ERROR_TYPE => $req->error_type,
|
||||
PROVIDERURI => $p,
|
||||
PORTAL_URL => $self->conf->{portal},
|
||||
MSG => $req->info(),
|
||||
);
|
||||
$templateParams{ID} = $req->datas->{_openidPortal} . $id if ($id);
|
||||
|
@ -240,7 +238,6 @@ sub display {
|
|||
DISPLAY_OPENID_FORM => 0,
|
||||
DISPLAY_YUBIKEY_FORM => 0,
|
||||
AUTH_LOOP => [],
|
||||
PORTAL_URL => $self->conf->{portal},
|
||||
MSG => $req->info(),
|
||||
);
|
||||
|
||||
|
|
|
@ -708,7 +708,10 @@ sub rebuildCookies {
|
|||
}
|
||||
|
||||
sub tplParams {
|
||||
return ( SKIN => $_[0]->conf->{portalSkin} );
|
||||
return (
|
||||
SKIN => $_[0]->conf->{portalSkin},
|
||||
PORTAL_URL => $_[0]->conf->{portal},
|
||||
);
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -467,7 +467,6 @@ sub display {
|
|||
my ( $self, $req ) = @_;
|
||||
$self->logger->debug( 'Display called with code: ' . $req->error );
|
||||
my %tplPrm = (
|
||||
PORTAL_URL => $self->conf->{portal},
|
||||
SKIN_PATH => '/static',
|
||||
SKIN => $self->conf->{portalSkin},
|
||||
SKIN_BG => $self->conf->{portalSkinBackground},
|
||||
|
|
|
@ -0,0 +1,128 @@
|
|||
package Lemonldap::NG::Portal::Plugins::PublicPages;
|
||||
|
||||
use strict;
|
||||
use Mouse;
|
||||
|
||||
extends 'Lemonldap::NG::Portal::Main::Plugin';
|
||||
|
||||
our $VERSION = '2.0.0';
|
||||
|
||||
sub init {
|
||||
my ($self) = @_;
|
||||
$self->addAuthRoute( public => { ':tpl' => 'run' }, ['GET'] );
|
||||
$self->addUnauthRoute( public => { ':tpl' => 'run' }, ['GET'] );
|
||||
return 1;
|
||||
}
|
||||
|
||||
sub run {
|
||||
my ( $self, $req ) = @_;
|
||||
my $tpl = $req->param('tpl');
|
||||
unless ( $tpl =~ /^[\w\.\-]+$/ ) {
|
||||
$self->userLogger->error("Bad public path $tpl");
|
||||
return $self->p->sendError( $req, 'File not found', 404 );
|
||||
}
|
||||
$tpl = "public/$tpl";
|
||||
my $path =
|
||||
$self->conf->{templateDir} . '/'
|
||||
. $self->conf->{portalSkin}
|
||||
. "/$tpl.tpl";
|
||||
unless ( -e $path ) {
|
||||
$self->userLogger->warn("File not found: $path");
|
||||
return $self->p->sendError( $req, 'File not found', 404 );
|
||||
}
|
||||
return $self->p->sendHtml( $req, $tpl );
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding utf8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Lemonldap::NG::Portal::Plugins::PublicPages - LLNG portal plugin that allows
|
||||
one to publish HTML pages using LLNG framework
|
||||
system.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
=over
|
||||
|
||||
=item Add "C<customPlugins = ::Plugins::PublicPages>" in your lemonldap-ng.ini
|
||||
file
|
||||
|
||||
=item Create a "public" subdir in your template directory
|
||||
|
||||
=item Create your .tpl files inside
|
||||
|
||||
=item To access them, use "http://auth.your.domain/public/name" where "name" is
|
||||
the template name
|
||||
|
||||
=back
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Lemonldap::NG::Portal::Plugins::PublicPages is a simple LLNG portal plugin that
|
||||
allows one to publish HTML pages using LLNG portal framework. See SYNOPSIS for
|
||||
more.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
Most of the documentation is available on the website
|
||||
L<http://lemonldap-ng.org>
|
||||
|
||||
=head2 OTHER POD FILES
|
||||
|
||||
=over
|
||||
|
||||
=item Writing an authentication module: L<Lemonldap::NG::Portal::Auth::Base>
|
||||
|
||||
=item Writing an issuer module: L<Lemonldap::NG::Portal::Main::Issuer>
|
||||
|
||||
=item Writing another type of plugin: L<Lemonldap::NG::Portal::Main::Plugin>
|
||||
|
||||
=item Request object: L<Lemonldap::NG::Portal::Main::Request>
|
||||
|
||||
=item Adding parameters in the manager: L<Lemonldap::NG::Manager::Build>
|
||||
|
||||
=back
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
=over
|
||||
|
||||
=item LemonLDAP::NG team L<http://lemonldap-ng.org/team>
|
||||
|
||||
=back
|
||||
|
||||
=head1 BUG REPORT
|
||||
|
||||
Use OW2 system to report bug or ask for features:
|
||||
L<http://jira.ow2.org>
|
||||
|
||||
=head1 DOWNLOAD
|
||||
|
||||
Lemonldap::NG is available at
|
||||
L<http://forge.objectweb.org/project/showfiles.php?group_id=274>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
See COPYING file for details.
|
||||
|
||||
This library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see L<http://www.gnu.org/licenses/>.
|
||||
|
||||
=cut
|
|
@ -376,7 +376,6 @@ sub _register {
|
|||
sub display {
|
||||
my ( $self, $req ) = @_;
|
||||
my %templateParams = (
|
||||
PORTAL_URL => $self->conf->{portal},
|
||||
SKIN_PATH => '/static',
|
||||
SKIN => $self->conf->{portalSkin},
|
||||
SKIN_BG => $self->conf->{portalSkinBackground},
|
||||
|
|
|
@ -63,7 +63,6 @@ sub run {
|
|||
$req,
|
||||
'u2fcheck',
|
||||
params => {
|
||||
PORTAL_URL => $self->conf->{portal},
|
||||
SKIN => $self->conf->{portalSkin},
|
||||
CHALLENGE => $challenge,
|
||||
TOKEN => $token
|
||||
|
@ -129,7 +128,6 @@ sub fail {
|
|||
$req,
|
||||
'u2fcheck',
|
||||
params => {
|
||||
PORTAL_URL => $self->conf->{portal},
|
||||
AUTH_ERROR => $req->error,
|
||||
AUTH_ERROR_TYPE => $req->error_type,
|
||||
SKIN => $self->conf->{portalSkin},
|
||||
|
|
27
lemonldap-ng-portal/site/templates/bootstrap/public/test.tpl
Normal file
27
lemonldap-ng-portal/site/templates/bootstrap/public/test.tpl
Normal file
|
@ -0,0 +1,27 @@
|
|||
<TMPL_INCLUDE NAME="header.tpl">
|
||||
|
||||
<div class="container">
|
||||
|
||||
<div class="alert alert-success">Public page example</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<p>You can have some public pages using LLNG framework. To enable this:</p>
|
||||
<ul>
|
||||
<li>Add "<tt>customPlugins = ::Plugins::PublicPages</tt>" in your
|
||||
"lemonldap-ng.ini" file to enable this plugin;</li>
|
||||
<li>Create a "public" subdir in your template directory;</li>
|
||||
<li>Create your .tpl files inside;</li>
|
||||
<li>To access them, use "http://auth.your.domain/public/name" where "name"
|
||||
is the template name <i>(without .tpl).</i>
|
||||
</ul>
|
||||
<div class="buttons">
|
||||
<TMPL_IF NAME="MSG"><TMPL_VAR NAME="MSG"></TMPL_IF>
|
||||
<a href="<TMPL_VAR NAME="PORTAL_URL">" class="btn btn-primary" role="button">
|
||||
<span class="glyphicon glyphicon-home"></span>
|
||||
<span trspan="goToPortal">Go to portal</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<TMPL_INCLUDE NAME="footer.tpl">
|
Loading…
Reference in New Issue
Block a user