their password
package Lemonldap::NG::Portal::2F::Password;
use strict;
use Mouse;
use JSON qw(from_json to_json);
use Lemonldap::NG::Common::Crypto;
use Lemonldap::NG::Common::Util qw/display2F/;
us
package Lemonldap::NG::Portal::Issuer::OpenID;
use strict;
use JSON;
use Mouse;
use Lemonldap::NG::Common::Regexp;
use Lemonldap::NG::Portal::Main::Constants qw(
PE_OK
PE_ERROR
PE_CONFIRM
PE_
authenticators
package Lemonldap::NG::Portal::2F::WebAuthn;
use strict;
use Mouse;
use JSON qw(from_json to_json);
use MIME::Base64 qw(encode_base64url decode_base64url);
use Crypt::URandom;
use Lem
pt} .= <<"EOF";
<script type="text/javascript" src="$self->{p}->{staticPrefix}/common/js/webauthn-json.browser-global.min.js?v=$cacheTag"></script>
<script type="text/javascript" src="$self->{p}->{sta
ARGET => $self->p->relativeUrl( $req, 'webauthn2fcheck' ),
DATA =>
to_json( { request => $request, webauthn_autostart => \1 } ),
TOKEN => $token,
tered their U2F key
package Lemonldap::NG::Portal::2F::U2F;
use strict;
use Mouse;
use JSON qw(from_json to_json);
use MIME::Base64 qw(decode_base64url);
use Lemonldap::NG::Portal::Main::Constants qw
$res == 0;
# Get a challenge (from first key)
my $data = eval {
from_json( $req->data->{crypter}->[0]->authenticationChallenge );
};
if ($@) {
ebug( " -> send challenge: " . $data->{challenge} );
# Serialize data
$data = to_json( {
challenge => $data->{challenge},
appId => $data-
$self->conf->{$k} = $self->localConfig->{$k};
}
}
$self->trOver( JSON::to_json( $self->trOver ) );
# Purge loaded module list
$self->_resetPluginsAndServices;
er->debug('Initialize Kerberos dialog');
# Case 1.1: Ajax request
if ( $req->wantJSON ) {
$req->response( [
401,
[
'WWW-Authenticate' => 'Negotiate',
'Content-Type' => 'application/json',
'Content-Length' => 35
],
['{
[
'WWW-Authenticate' => 'Negotiate',
'Content-Type' => 'application/json',
'Content-Length' => 35
],
['{"error":"Authentication required"}']
SION = '2.22.0';
package Lemonldap::NG::Portal::Main;
use strict;
use URI::Escape;
use URI;
use JSON;
use Lemonldap::NG::Common::Util qw(getPSessionID getSameSite);
has trOverCache => ( is => 'rw',
) {
$sp = 1;
eval { $req->pdata( JSON::from_json( uri_unescape($v) ) ); };
if ($@) {
$self->logger->error("Bad JSON content in cookie pdata");
$req->pda
secure => $self->conf->{securedCookie},
value => uri_escape( JSON::to_json( $req->pdata ) ),
%pdata_options,
);
}
else {
package Lemonldap::NG::Portal::Auth::GitHub;
use strict;
use JSON;
use Mouse;
use MIME::Base64 qw/encode_base64 decode_base64/;
use Lemonldap::NG::Common::FormEncode;
use Lemonldap::NG::Common::UserA
"Content-Type" => 'application/x-www-form-urlencoded',
'Accept' => 'application/json'
);
if ( $response->is_error ) {
$self->logger->error(
tent;
my $json_hash;
eval { $json_hash = from_json( $content, { allow_nonref => 1 } ); };
if ($@) {
$self->logger->error("Unable to decode JSON $content");
package Lemonldap::NG::Portal::Auth::LinkedIn;
use strict;
use JSON;
use Mouse;
use MIME::Base64 qw/encode_base64 decode_base64/;
use Lemonldap::NG::Common::FormEncode;
use Lemonldap::NG::Common::Use
tent;
my $json_hash;
eval { $json_hash = from_json( $content, { allow_nonref => 1 } ); };
if ($@) {
$self->logger->error("Unable to decode JSON $content");
return PE_ERROR;
}
my $access_token = $json_hash->{access_token};
$self->logger->debug("Get access token $access_token from LinkedIn");
# Call People EndPoint
REST requests directly by using '/' path : the portal recognize REST
# calls and generate JSON response instead of web page.
#
# - Configuration (if restConfigServer is on)
# * GET /config/l
T /error/<lang>/<errNum> : get <errNum> message reference and errors file <lang>.json
# Return 'en' error file if no <lang> specified
#
# - Endpoints for proxy auth/userdb/password
gether
package Lemonldap::NG::Portal::Plugins::RESTServer;
use strict;
use Mouse;
use JSON qw(from_json to_json);
use MIME::Base64;
use Lemonldap::NG::Common::Languages;
use Lemonldap::NG::Common::S
rtal::Plugins::MailPasswordReset;
use strict;
use Encode;
use Mouse;
use POSIX qw(strftime);
use JSON;
use Lemonldap::NG::Common::FormEncode;
use Lemonldap::NG::Portal::Main::Constants qw(
PE_OK
istration
package Lemonldap::NG::Portal::2F::Register::U2F;
use strict;
use Mouse;
use JSON qw(from_json to_json);
use MIME::Base64 qw(encode_base64url decode_base64url);
our $VERSION = '2.0.16';
e
return [
200,
[
'Content-Type' => 'application/json',
'Content-Length' => length($challenge),
],
[$challenge]
egistration data ($resp)\nget challenge ($challenge)"
);
eval { $challenge = from_json($challenge)->{challenge} };
if ($@) {
$self->userLogger->error(
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::
}
else {
$class->logger->error(
'Malformed message: ' . JSON::to_json($msg) );
}
}
$class->lastCheckMsg(time);
return $ret;
}
# Method to pus
lass->tsv->{portal}->($req);
if ( !$class->tsv->{useRedirectAjaxOnUnauthorized} and $req->wantJSON ) {
$class->set_header_out( $req, 'WWW-Authenticate' => "SSO $portal" );
return $
=> {
'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'
package Lemonldap::NG::Handler::Lib::Status;
use strict;
use POSIX qw(setuid setgid);
use JSON qw(to_json);
use IO::Select;
use IO::Socket::INET;
use Lemonldap::NG::Handler::Lib::StatusConstants q
%$args = split( /[=&]/, $tmp ) if ($tmp);
&head($out) unless ( $args->{json} );
my ( $c, $m, $u );
foreach my $user ( keys %{ $status->{user
99 );
}
# JSON values
if ( $args->{json} ) {
$out->print(
to_json( { average => $m, total => $c } ) . "\nEN
'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
=> 'application/x-www-form-urlencoded' );
$get->header( Accept => 'application/json' );
$get->content(
build_urlencoded(
user => $user,
passw
use Lemonldap::NG::Common::UserAgent;
use Lemonldap::NG::Common::Util qw(isHiddenAttr);
use JSON qw(from_json);
our $VERSION = '2.19.0';
our $_ua;
sub ua {
my ($class) = @_;
return $_ua if $
kMaintenanceMode($req);
}
sub _loadVhostConfig {
my ( $class, $req, $vhost ) = @_;
my ( $json, $rUrl, $rVhost );
if ( $class->tsv->{useSafeJail} ) {
if ( $req->env->{RULES_URL} ||
}
|| "http://127.0.0.1:" . $req->{env}->{SERVER_PORT} )
. '/rules.json';
$rVhost = $vhost;
}
$class->logger->debug("Try to retrieve rules f
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