package Lemonldap::NG::Common::AuditLogger::UserLoggerJSON;
use strict;
use JSON;
use Scalar::Util qw(weaken);
our $VERSION = '2.21.0';
sub new {
my ( $class, $psgi_or_handler ) = @_;
my $s
or die 'Missing userLogger';
weaken $self->{userLogger};
my $json = JSON->new->canonical;
$self->{encode} = sub { $json->encode(@_) };
return $self;
}
sub log {
my ( $self, $req,
Common::CrowdSec;
use strict;
use Date::Parse;
use Digest::SHA qw(sha256_hex);
use JSON qw(from_json to_json);
use Mouse::Role;
use POSIX qw(strftime);
use Lemonldap::NG::Common::UserAgent;
us
ario_version => $VERSION,
leakspeed => '1s',
remediation => JSON::true,
simulated => JSON::false,
capacity => 1,
};
has ua => (
is => 'rw',
laz
a->default_headers->header( 'Accept' => 'application/json' );
$ua->default_headers->header( 'Content-Type' => 'application/json' );
return $ua;
}
);
has token => ( is =>
$channel, $msg ) = @_;
die 'Not a hash msg' unless ref $msg eq 'HASH';
my $j = eval { JSON::to_json($msg) };
die "MessageBroker publish only hashes! $@" if $@;
$self->{mqtt}->publish(
return unless $_[1];
$_[0] =~ s#llng/##;
my $tmp = eval { JSON::from_json( $_[1] ) };
if ($@) {
$self->{logger}->error("Bad message from
use IO::Select;
use Lemonldap::NG::Common::FormEncode;
use Lemonldap::NG::Common::UserAgent;
use JSON;
use Protocol::WebSocket::Client;
our $VERSION = '2.22.0';
use constant DEFAULTWS => 'localhost
Not a hash msg' unless ref $msg eq 'HASH';
$msg->{channel} = $channel;
my $j = eval { JSON::to_json($msg) };
if ($@) {
$self->logger->error("$pr message error: $@");
return
if ( $buf =~ /^{.*}$/ ) {
eval {
my $data = JSON::decode_json($buf);
if ( $data->{channel}
&& defined $self-
package Lemonldap::NG::Common::MessageBroker::Pg;
use strict;
use JSON;
use POSIX qw(:signal_h);
our $VERSION = '2.21.0';
sub new {
my ( $class, $conf, $logger ) = @_;
require DBI;
my $
$channel, $msg ) = @_;
die 'Not a hash msg' unless ref $msg eq 'HASH';
my $j = eval { JSON::to_json($msg) };
die "MessageBroker publish only hashes! $@" if $@;
$self->_dbh->do( "NOTIFY
->pg_notifies ) {
my ( $name, $pid, $payload ) = @$notify;
$payload = eval { JSON::from_json($payload) };
if ($@) {
$self->{logger}->error("Bad message from Pg: $@"
package Lemonldap::NG::Common::MessageBroker::Redis;
use strict;
use JSON;
our $VERSION = '2.21.0';
our $REDISCLASS = 'Redis::Fast';
sub new {
my ( $class, $conf, $logger ) = @_;
my $self =
$channel, $msg ) = @_;
die 'Not a hash msg' unless ref $msg eq 'HASH';
my $j = eval { JSON::to_json($msg) };
die "MessageBroker publish only hashes! $@" if $@;
$self->{redis}->publish(
$self->{redis}->subscribe(
$channel,
sub {
my $tmp = eval { JSON::from_json( $_[0] ) };
if ($@) {
$self->{logger}->error("Bad message from
package Lemonldap::NG::Common::PSGI::Cli::Lib;
use strict;
use JSON;
use Mouse;
use Lemonldap::NG::Common::PSGI;
our $VERSION = '2.0.10';
has iniFile => ( is => 'ro', isa => 'Str' );
has app => (
$query //= '';
return $self->app->( {
'HTTP_ACCEPT' => 'application/json, text/plain, */*',
'SCRIPT_NAME' => '',
'HTTP_ACCEPT_ENCODING' =
ody->can('read') );
return $self->app->( {
'HTTP_ACCEPT' => 'application/json, text/plain, */*',
'SCRIPT_NAME' => '',
'HTTP_ACCEPT_ENCODING' =
FromCache($id) ) {
$session->{serialized} = $self->getFromCache($id);
eval { JSON::from_json( $session->{serialized} ); };
if ($@) {
print STDERR "Local data corrup
G::Common::UserAgent;
use Lemonldap::NG::Common::Apache::Session::Generate::SHA256;
use JSON qw(from_json to_json);
our $VERSION = '2.21.0';
our @ISA = qw(Lemonldap::NG::Common::Apache::Session::Gen
m},
$self->{user}, $self->{password} );
}
return $self->{ua} = $ua;
}
sub getJson {
my $self = shift;
my $id = shift;
my $resp = $self->ua->get(
$self->base
' ),
@_
);
if ( $resp->is_success ) {
my $res;
eval { $res = from_json( $resp->content, { allow_nonref => 1 } ) };
if ($@) {
print STDERR "Unable to
package Lemonldap::NG::Common::Apache::Session::SOAP;
use strict;
use SOAP::Lite;
use JSON qw(from_json to_json);
our $VERSION = '2.21.0';
#parameter proxy Url of SOAP service
#parameter proxyOpti
if ( $self->{localStorage} and my $res = $self->cache->get($id) ) {
$res = eval { from_json($res) };
return $self->{data} = $res if $res;
}
# No cache, use SOAP and set cac
less ( $r or $r->{error} );
$self->{data} = $r->{attributes};
$self->cache->set( $id, to_json( $self->{data} ) ) if $self->{localStorage};
return $self->{data};
}
## @method hashRef new
n::Conf::Backends::Overlay;
use Lemonldap::NG::Common::Conf::Constants qw($hashParameters );
use JSON;
our $VERSION = '2.19.0';
sub load {
my ( $self, $cfgNum, $fields ) = @_;
my @files = e
close $f;
if ( $file =~ $hashParameters ) {
eval { $content = JSON::from_json($content) };
if ($@) {
push @errors, "Bad over file $fi
rectory}/$file" ) {
print $f (
$file =~ $hashParameters ? JSON::to_json($data) : $data );
close $f;
}
else {
n::OpenIDConnect::Metadata;
use strict;
use Lemonldap::NG::Common::OpenIDConnect::Constants;
use JSON;
use Mouse::Role;
our $VERSION = '2.22.0';
sub metadataDoc {
my ( $self, $issuer, $conf, $p
request_parameter_supported => JSON::true,
request_uri_parameter_supported => JSON::true,
require_request_uri_registration => JSON::true,
# Algorithms
id_t
=> JSON::true,
frontchannel_logout_session_supported => JSON::true,
backchannel_logout_supported => JSON::true,
backchannel_logout_session_supported => JSON::true
sub beforeRetry {
my ($self) = @_;
require Lemonldap::NG::Common::UserAgent;
require JSON;
my $ua = Lemonldap::NG::Common::UserAgent->new($self);
$ua->timeout(3);
my $res = 0;
$resp = $ua->get($patroniUrl);
if ( $resp->is_success ) {
my $c = eval { JSON::from_json( $resp->decoded_content ) };
if ( $@ or !$c->{members} or ref( $c->{members} )