sions.pm to manage sessions
package Lemonldap::NG::Manager;
use strict;
use utf8;
use Mouse;
use JSON;
use Lemonldap::NG::Common::Conf::Constants;
use Lemonldap::NG::Common::PSGI::Constants;
our $VE
x';"
. ( $self->links ? 'var links=' . to_json( $self->links ) . ';' : '' )
. (
$self->menuLinks
? 'var menulinks=' . to_json( $self->menuLinks ) . ';'
: ''
)
ne interface (see L<Lemonldap::NG::Manager::Cli>
=back
=head2 Static files generation
`scripts/jsongenerator.pl` file uses Lemonldap::NG::Manager::Build::Attributes,
Lemonldap::NG::Manager::Build::
:NG::Manager::Attributes;
use Lemonldap::NG::Manager::Api::Common;
use Lemonldap::NG::Common;
use JSON;
my %TYPEMAP = (
"bool" => sub { { type => "boolean" } },
"text" => sub { { ty
uid',
'in' => 'path',
'required' => JSON::true,
'schema' => {
'type' => 'str
lt',
'in' => 'query',
'required' => JSON::false,
'schema' => {
'type' => 'st
andom;
use Mouse;
use Data::Dumper;
use JSON;
use Hash::Merge::Simple;
use Lemonldap::NG::Common::Conf::ReConstants;
use constant booleanOptions => qr/^(?:json)$/;
our $VERSION = '2.22.0';
$Data::Du
', lazy => 1, builder => sub { $_[0]->mgr } );
has json => ( is => 'rw' );
has jsonConverter => (
is => 'rw',
default => sub { JSON->new->allow_nonref->canonical->pretty },
);
has ke
ys);
L: foreach my $key (@keys) {
my $value = $self->_getKey($key);
if ( $self->json ) {
$res->{$key} = $value;
next;
}
if ( ref $value eq 'HA
----------------
##@method public PSGI-JSON-response newRSAKey($req)
# Return a hashref containing private and public keys
# The posted data must contain a JSON object containing
# {"password":"newpa
ssword"}
#
#@param $req Lemonldap::NG::Common::PSGI::Request object
#@return PSGI JSON response
sub newCertificate {
my ( $self, $req, @others ) = @_;
return $self->sendError( $req, 'There is
0 )
if (@others);
my $query = $req->jsonBodyToObj;
my $keys = $self->_generateX509( $query->{password}, "RSA" );
return $self->sendJSONresponse( $req, $keys );
}
sub newEcCertifica
package Lemonldap::NG::Manager::Notifications;
use strict;
use utf8;
use Mouse;
use JSON qw(from_json to_json);
use POSIX qw(strftime);
use MIME::Base64 qw(decode_base64);
use Lemonldap::NG::Common:
('XML');
}
else {
Lemonldap::NG::Common::Notifications->import('JSON');
$self->notifFormat('JSON');
}
unless ( $self->setNotifAccess($conf) ) {
$self->addRoute
value => $_, count => $r->{$_} } }
sort keys %$r
];
return $self->sendJSONresponse(
$req,
{
result => 1,
count => $
nldap::NG::Manager::Conf::Parser;
# This module is called either to parse a new configuration in JSON format (as
# posted by the web interface) and test a new configuration object.
#
# The new object
e new configuration in JSON format
# or
# - newConf: the configuration to test
#
# The main method is check() which calls:
# - scanTree() if configuration is not parsed (JSON string)
# - testNewC
is stored in
# `message` property.
use strict;
use utf8;
use Crypt::URandom;
use Mouse;
use JSON 'to_json';
use Lemonldap::NG::Common::Conf::ReConstants;
use Lemonldap::NG::Manager::Attributes;
our
'application/x-www-form-urlencoded',
Accept => 'application/json',
],
$s
);
}
}
Lemonldap::NG::Handler::PSGI::Main->localUnlog( $req, $id );
return $self->sendJSONresponse( $req, { result => 1, count => $count } );
}
#######################
# II. CONSENT METHO
( $moduleOptions,
$firstFilter, $filters{$firstFilter}, @fields );
return $self->sendJSONresponse(
$req,
{
result => 1,
count => 0,
to
p::NG::Manager::Conf::Zero;
use Data::Dumper;
use Regexp::Common 'URI';
use Regexp::Assemble;
use JSON;
use Getopt::Std;
use IO::String;
my %peOkValues = (
PE_2FWAIT => 'Wait for second fac
my $attributes = Lemonldap::NG::Manager::Build::Attributes::attributes();
my $jsonEnc = JSON->new()->allow_nonref;
$jsonEnc->canonical(1);
$Data::Dumper::Sortkeys = sub {
my ($hash) = @_;
eys = ();
my $jsonTree = [];
$self->scanTree( $mainTree->{$node}, $jsonTree, '__KEY__', '' );
$jsonEnc->pretty(1);
my $tmp = $jsonEnc->encode($jsonTree);
$tmp =
$VERSION = '2.21.0';
package Lemonldap::NG::Manager::Api;
use strict;
use utf8;
use Mouse;
use JSON;
use Lemonldap::NG::Common::Session;
use Lemonldap::NG::Common::Util qw/genId2F display2F filter
r( $req, $res->{msg}, $res->{code} )
unless ( $res->{res} eq 'ok' );
return $self->sendJSONresponse( $req, $res->{secondFactors} );
}
sub getSecondFactorsByType {
my ( $self, $req ) =
r( $req, $res->{msg}, $res->{code} )
unless ( $res->{res} eq 'ok' );
return $self->sendJSONresponse( $req, $res->{secondFactors} );
}
sub getSecondFactorsById {
my ( $self, $req ) = @_
#
# All other ideas have to be set in Manager/Build/Attributes.pm !
# DON'T FORGET TO RUN 'make json' AFTER EACH CHANGE
package Lemonldap::NG::Manager::Build::CTrees;
our $VERSION = '2.22.0';
sub
'samlSPMetaDataMacros',
],
oidcOPMetaDataNode => [
'oidcOPMetaDataJSON',
'oidcOPMetaDataJWKS',
'oidcOPMetaDataExportedVars',
{
#
# All other ideas have to be set in Manager/Build/Attributes.pm!
# DO NOT FORGET TO RUN "make json" AFTER EACH CHANGE
package Lemonldap::NG::Manager::Build::Tree;
our $VERSION = '2.22.0';
sub t
ortal and portal
# plugins, and displayed in the Handler Status page
# DON'T FORGET TO RUN "make json" AFTER EACH CHANGE
package Lemonldap::NG::Manager::Build::PortalConstants;
our $VERSION = '2.22
h files, never in portal or handler chain
# for performances reasons
# DON'T FORGET TO RUN "make json" AFTER EACH CHANGE
package Lemonldap::NG::Manager::Build::Attributes;
our $VERSION = '2.22.0';
},
oidcRPMetaDataNode => {
test => sub { 1 }
},
oidcmetadatajson => {
test => sub { 1 }
},
oidcmetadatajwks => {
test => s
Options => { type => 'subContainer', },
# OpenID Connect providers
oidcOPMetaDataJSON => {
type => 'file',
keyTest => sub { 1 }
},
oidcOPMet
"ARRAY" );
return join( ' ', @{$optionValue} );
}
# Translate JSON booleans to integers
elsif ( JSON::is_bool($optionValue) ) {
return $optionValue ? 1 : 0;
}
else
=> {
'test' => sub {
1;
}
},
'oidcmetadatajson' => {
'test' => sub {
1;
}
},
'oidcmetada
> 'sub'
},
'type' => 'keyTextContainer'
},
'oidcOPMetaDataJSON' => {
'keyTest' => sub {
1;
},
'type' => 'fil
t' => '',
'select' => [ {
'k' => '',
'v' => 'JSON'
},
{
'k' => 'none',
'v'