Commit 261ba2a8 authored by Xavier Guimard's avatar Xavier Guimard

Merge branch 'master' of gitlab.ow2.org:lemonldap-ng/lemonldap-ng

parents 7e8a007b 6cca0738
......@@ -186,10 +186,10 @@ system.
The Perl part of Lemonldap::NG::Manager is the REST server. Web interface is
written in Javascript, using AngularJS framework and can be found in `site`
directory. The REST API is described in REST-API.md file given in source tree.
directory. The REST API is described in REST-API.md file provided in source tree.
Lemonldap::NG Manager uses L<Plack> to be compatible with CGI, FastCGI,... It
inherits of L<Lemonldap::NG::Handler::PSGI::Router>
Lemonldap::NG Manager uses L<Plack> to be CGI, FastCGI and so on compatible.
It inherits of L<Lemonldap::NG::Handler::PSGI::Router>
=head1 ORGANIZATION
......@@ -207,24 +207,24 @@ Lemonldap::NG Manager contains 6 parts:
=item Configuration builder (see L<Lemonldap::NG::Manager::Build>
=item Command line (see L<Lemonldap::NG::Manager::Cli>
=item Command line interface (see L<Lemonldap::NG::Manager::Cli>
=back
=head2 Generation of static files
=head2 Static files generation
The `scripts/jsongenerator.pl` file uses Lemonldap::NG::Manager::Build::Attributes,
`scripts/jsongenerator.pl` file uses Lemonldap::NG::Manager::Build::Attributes,
Lemonldap::NG::Manager::Build::Tree and Lemonldap::NG::Manager::Build::CTrees to generate
=over
=item `site/htdocs/static/struct.json`:
the main file that contains the tree view;
main file containing the tree view;
=item `site/htdocs/static/js/conftree.js`:
generates sub tree for virtualhosts and SAML and OpenID-Connect partners;
generates Virtualhosts, SAML and OpenID-Connect partners sub-trees;
=item `Lemonldap::NG::Common::Conf::ReConstants`:
......@@ -268,7 +268,7 @@ you can also fix them in $opts hash ref passed as argument to run() or new()).
;languages: Available interface languages
languages = en, fr
;templateDir: the path to the directory containing HTML templates
;templateDir: path to the directory containing HTML templates
; See Lemonldap::NG::Common::PSGI doc for more
templateDir = /usr/share/lemonldap-ng/manager/
......
......@@ -151,13 +151,9 @@ sub sfa {
$moduleOptions->{backend} = $mod->{module};
# Select 2FA sessions to display
if ( defined $params->{TOTPCheck}
or defined $params->{U2FCheck}
or defined $params->{UBKCheck} )
{
$self->{TOTPCheck} = delete $params->{TOTPCheck};
$self->{U2FCheck} = delete $params->{U2FCheck};
$self->{UBKCheck} = delete $params->{UBKCheck};
foreach (qw(TOTP U2F UBK)) {
$self->{ $_ . 'Check' } = delete $params->{ $_ . 'Check' }
if ( defined $params->{ $_ . 'Check' } );
}
my %filters = map {
......@@ -213,21 +209,12 @@ sub sfa {
( $filters{$firstFilter} ) );
foreach my $k ( keys %filters ) {
$self->logger->debug("Removing unless $k =~ /^$filters{$k}\$/");
if ( $filters{$k} =~ m#^([\w:]+)/(\d+)\*?$# ) {
my ( $net, $bits ) = ( $1, $2 );
foreach my $session ( keys %$res ) {
$filters{$k} =~ s/\./\\./g;
$filters{$k} =~ s/\*/\.\*/g;
foreach my $session ( keys %$res ) {
if ( $res->{$session}->{$k} ) {
delete $res->{$session}
unless ( net6( $res->{$session}->{$k}, $bits ) eq $net );
}
}
else {
$filters{$k} =~ s/\./\\./g;
$filters{$k} =~ s/\*/\.\*/g;
foreach my $session ( keys %$res ) {
if ( $res->{$session}->{$k} ) {
delete $res->{$session}
unless ( $res->{$session}->{$k} =~ /^$filters{$k}$/ );
}
unless ( $res->{$session}->{$k} =~ /^$filters{$k}$/ );
}
}
}
......@@ -245,30 +232,16 @@ sub sfa {
# Filter 2FA sessions if needed
$self->logger->debug("Filtering 2F sessions...");
my $all = ( keys %$res );
if ( $self->{U2FCheck} eq '2' ) {
foreach my $session ( keys %$res ) {
delete $res->{$session}
unless ( defined $res->{$session}->{_2fDevices}
and $res->{$session}->{_2fDevices} =~ /"type":\s*"U2F"/s );
}
$self->logger->debug("Removing sessions unless U2F key registered");
}
if ( $self->{TOTPCheck} eq '2' ) {
foreach my $session ( keys %$res ) {
delete $res->{$session}
unless ( defined $res->{$session}->{_2fDevices}
and $res->{$session}->{_2fDevices} =~ /"type":\s*"TOTP"/s );
}
$self->logger->debug("Removing sessions unless TOTP secret registered");
}
if ( $self->{UBKCheck} eq '2' ) {
foreach my $session ( keys %$res ) {
delete $res->{$session}
unless ( defined $res->{$session}->{_2fDevices}
and $res->{$session}->{_2fDevices} =~ /"type":\s*"UBK"/s );
foreach (qw(TOTP U2F UBK)) {
if ( $self->{ $_ . 'Check' } eq '2' ) {
foreach my $session ( keys %$res ) {
delete $res->{$session}
unless ( defined $res->{$session}->{_2fDevices}
and $res->{$session}->{_2fDevices} =~ /"type":\s*"$_"/s );
}
$self->logger->debug(
"Removing sessions unless a $_ device is registered");
}
$self->logger->debug("Removing sessions unless UBK device registered");
}
my $total = ( keys %$res );
......
......@@ -643,8 +643,8 @@ system.
=head1 DESCRIPTION
Lemonldap::NG::Manager::Build is used only to build javascript files and
Lemonldap::NG constants Perl files. It has to be launched after each change.
Lemonldap::NG::Manager::Build is only used to build javascript files and
Lemonldap::NG constants Perl files. It must be launched after each change.
=head2 DEVELOPER CORNER
......@@ -657,7 +657,7 @@ To add a new parameter, you have to:
=item declare its position in the tree in Manager/Build/Tree.pm (or
Manager/Build/CTrees.pm for complex nodes);
=item refresh files using this (or launch any build makefile target at the
=item refresh files by using this (or launch any build makefile target at the
root of the Lemonldap::NG project sources).
=back
......@@ -666,18 +666,18 @@ See below for details.
=head3 Files generated
The `scripts/jsongenerator.pl` file uses Lemonldap::NG::Manager::Build::Attributes,
`scripts/jsongenerator.pl` file uses Lemonldap::NG::Manager::Build::Attributes,
Lemonldap::NG::Manager::Build::Tree and Lemonldap::NG::Manager::Build::CTrees to generate
=over
=item `site/htdocs/static/struct.json`:
the main file that contains the tree view;
Main file containing the tree view;
=item `site/htdocs/static/js/conftree.js`:
generates sub tree for virtualhosts and SAML and OpenID-Connect partners;
generates Virtualhosts, SAML and OpenID-Connect partners sub-trees;
=item `site/htdocs/static/reverseTree.json`:
......@@ -703,30 +703,30 @@ first configuration in file format;
=head3 Attribute declaration
Set your new attribute as a key of attributes() function that points to a hash
set your new attribute as a key of attributes() function that points to a hash
ref containing:
=over
=item type (required):
the type of the content. It must be declared in sub
types() in the same file (except if attribute embeds its own tests) and must
correspond to a form stored in the static/forms/ directory;
content type must be declared in sub types() in the same file
(except if attribute embeds its own tests) and must match
to a form stored in static/forms/ directory;
=item help (optional):
the relative HTML path to the help page (relative to
Relative HTML path to help page (relative to
/doc/pages/documentation/<version>/);
=item default (recommended):
a default value to set if not defined;
default value to set if not defined;
=item select (optional):
required only if type is `select`. In this case, it
must contains an array of { k => <keyName>, v => <display name> } hashref
must contain an array of { k => <keyName>, v => <display name> } hashref
=item documentation (recommended):
......@@ -735,10 +735,10 @@ some words for other developpers
=item test (optional):
if test is not defined for this type or if test must
be more restrictive, set her a regular expression or a subroutine. Arguments
passed to subroutine are (keyValue, newConf, currentKey), it returns 2
arguments: a boolean result and a message (if non empty will be displayed as
warning or error depending of result);
be more restrictive, set here a regular expression or a subroutine. Arguments
passed to subroutine are (keyValue, newConf, currentKey). It returns 2
arguments: a boolean result and a message (if non empty message will be
displayed as warning or error depending of result);
=item msgFail (optional):
......@@ -747,30 +747,28 @@ error. Words to translate have to be written as so: __toTranslate__;
=item keyTest (optional):
for keys/values attributes, test to be applied on
key;
for keys/values attributes, test to be applied on key;
=item keyMsgFail (optional):
for regexp based key tests, same as msgFail for
keys test;
for regexp based key tests, same as msgFail for keys test;
=back
If you decide to declare a new type, you have to declare the following
If you want to declare a new type, you have to declare following
properties:
=over
=item test, msgFail, keyTest, keyMsgFail as shown above,
=item form: the form to use if it doesn't have the same name.
=item form: form to use if it doesn't have the same name.
=back
=head3 Tree positioning
=head3 Tree location
The tree is now very simple: it contains nodes and leaf. Leaf are designed only
The tree is now very simple: it contains nodes and leaves. Leaves are designed only
by their attribute name. All description must be done in the file described
above. Nodes are array member designed as this:
......@@ -806,13 +804,13 @@ array of sub nodes and leaf attached to this node
=item group:
must never be used in conjunction with nodes. Array of leafs only
must never be used in conjunction with nodes. Array of leaves only
to be displayed in the same form
=item nodes_cond:
array of sub nodes that will be displayed with a filter. Not
yet documented here, see the source code of site/htdocs/static/js/filterFunctions.js.
array of sub nodes that will be displayed with a filter. Not yet
documented here, see the source code of site/htdocs/static/js/filterFunctions.js.
=item nodes_filter:
......
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