Replace 'splice' by copy (Closes: #534)

environments/ppa-mbqj77/deployments/1
Xavier Guimard 10 years ago
parent 979b52fdff
commit e8dac0fe6b
  1. 4
      lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/File.pm
  2. 6
      lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/SAML/Metadata.pm
  3. 8
      lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Serializer.pm
  4. 12
      lemonldap-ng-common/lib/Lemonldap/NG/Common/Notification.pm
  5. 16
      lemonldap-ng-common/lib/Lemonldap/NG/Common/PSGI.pm
  6. 4
      lemonldap-ng-common/lib/Lemonldap/NG/Common/PSGI/Request.pm
  7. 18
      lemonldap-ng-common/lib/Lemonldap/NG/Common/PSGI/Router.pm
  8. 6
      lemonldap-ng-common/lib/Lemonldap/NG/Common/Safe.pm
  9. 10
      lemonldap-ng-common/lib/Lemonldap/NG/Common/Safelib.pm
  10. 2
      lemonldap-ng-handler/lib/Lemonldap/NG/Handler/API/ApacheMP2.pm
  11. 2
      lemonldap-ng-handler/lib/Lemonldap/NG/Handler/API/PSGI.pm
  12. 2
      lemonldap-ng-handler/lib/Lemonldap/NG/Handler/CGI.pm
  13. 6
      lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Main.pm
  14. 10
      lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Main/Jail.pm
  15. 14
      lemonldap-ng-handler/lib/Lemonldap/NG/Handler/PSGI.pm
  16. 2
      lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Proxy.pm
  17. 10
      lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Specific/SecureToken.pm
  18. 2
      lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Specific/SympaAutoLogin.pm
  19. 4
      lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Specific/ZimbraPreAuth.pm
  20. 2
      lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Status.pm
  21. 2
      lemonldap-ng-manager/lib/Lemonldap/NG/Manager.pm
  22. 4
      lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Build.pm
  23. 14
      lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Cli/Lib.pm
  24. 6
      lemonldap-ng-manager/lib/Lemonldap/NG/Manager/ConfParser.pm
  25. 16
      lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Notifications.pm
  26. 8
      lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Sessions.pm
  27. 2
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/IssuerDBOpenID.pm
  28. 16
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/MailReset.pm
  29. 10
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Menu.pm
  30. 4
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/OpenID/SREG.pm
  31. 2
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/OpenID/Server.pm
  32. 16
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Register.pm
  33. 4
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/RegisterDBAD.pm
  34. 6
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/RegisterDBDemo.pm
  35. 6
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/RegisterDBLDAP.pm
  36. 2
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/RegisterDBNull.pm
  37. 34
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Simple.pm
  38. 2
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDBDBI.pm
  39. 2
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDBLDAP.pm
  40. 20
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_CAS.pm
  41. 4
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_Choice.pm
  42. 8
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_LDAP.pm
  43. 6
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_LibAccess.pm
  44. 8
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_Multi.pm
  45. 74
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_OpenIDConnect.pm
  46. 166
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_SAML.pm
  47. 6
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_SMTP.pm
  48. 12
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_SOAP.pm
  49. 4
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_i18n.pm

@ -8,12 +8,12 @@ our $VERSION = '1.4.0';
our $initDone;
sub Lemonldap::NG::Common::Conf::_lock {
my ( $self, $cfgNum ) = splice @_;
my ( $self, $cfgNum ) = @_;
return "$self->{dirName}/lmConf.lock";
}
sub Lemonldap::NG::Common::Conf::_file {
my ( $self, $cfgNum ) = splice @_;
my ( $self, $cfgNum ) = @_;
return "$self->{dirName}/lmConf-$cfgNum.js";
}

@ -111,7 +111,7 @@ sub initializeFromXML {
# SAML 2 description.
# @return string
sub serviceToXML {
my ( $self, $file, $conf ) = splice @_;
my ( $self, $file, $conf ) = @_;
my $template = HTML::Template->new(
filename => "$file",
@ -375,7 +375,7 @@ sub _toStruct {
# @param @files Array of filenames
# @return array of Metadata objects
sub load {
my @files = splice @_;
my @files = @_;
my @metadatas = ();
foreach (@files) {
my $metadata = new Lemonldap::NG::Common::Conf::SAML::Metadata();
@ -408,7 +408,7 @@ sub _loadFile {
# @param conf Configuration hash ref
# @return value
sub getValue {
my ( $self, $key, $conf ) = splice @_;
my ( $self, $key, $conf ) = @_;
# Get portal value
my $portal = $conf->{portal} || "http://auth.example.com/";

@ -16,7 +16,7 @@ BEGIN {
# @param value Input value
# @return normalized string
sub normalize {
my ( $self, $value ) = splice @_;
my ( $self, $value ) = @_;
# trim white spaces
$value =~ s/^\s*(.*?)\s*$/$1/;
@ -39,7 +39,7 @@ sub normalize {
# @param value Input value
# @return unnormalized string
sub unnormalize {
my ( $self, $value ) = splice @_;
my ( $self, $value ) = @_;
# Convert simple quotes
$value =~ s/&#?39;/'/g;
@ -59,7 +59,7 @@ sub unnormalize {
# @param conf Configuration
# @return fields
sub serialize {
my ( $self, $conf ) = splice @_;
my ( $self, $conf ) = @_;
my $fields;
# Data::Dumper options
@ -93,7 +93,7 @@ sub serialize {
# @param fields Fields
# @return configuration
sub unserialize {
my ( $self, $fields ) = splice @_;
my ( $self, $fields ) = @_;
my $conf;
# Parse fields

@ -23,7 +23,7 @@ our ( $msg, $parser );
# @param $storage same syntax as Lemonldap::NG::Common::Conf object
# @return Lemonldap::NG::Common::Notification object
sub new {
my ( $class, $storage ) = splice @_;
my ( $class, $storage ) = @_;
my $self = bless {}, $class;
(%$self) = (%$storage);
unless ( $self->{p} ) {
@ -54,7 +54,7 @@ sub new {
# @param $mess Text to log
# @param $level Level (debug|info|notice|error)
sub lmLog {
my ( $self, $mess, $level ) = splice @_;
my ( $self, $mess, $level ) = @_;
$self->{p}->lmLog( "[Notification] $mess", $level );
}
@ -64,7 +64,7 @@ sub lmLog {
# @param $portal Lemonldap::NG::Portal object that call
# @return HTML fragment containing form content
sub getNotification {
my ( $self, $portal ) = splice @_;
my ( $self, $portal ) = @_;
my ( @files, $form );
# Get user datas,
@ -196,7 +196,7 @@ sub getNotification {
# @param $portal Lemonldap::NG::Portal object that call
# @return true if all checkboxes have been checked
sub checkNotification {
my ( $self, $portal ) = splice @_, 0, 2;
my ( $self, $portal ) = @_, 0, 2;
my ( $refs, $checks );
# First, rebuild environment (cookies,...)
@ -340,7 +340,7 @@ sub checkNotification {
# @param $xml XML string containing notification
# @return number of notifications done
sub newNotification {
my ( $self, $xml ) = splice @_;
my ( $self, $xml ) = @_;
eval { $xml = $parser->parse_string($xml); };
if ($@) {
$self->lmLog( "Unable to read XML file : $@", 'error' );
@ -394,7 +394,7 @@ sub newNotification {
## @param $myref notification's reference
## @return number of deleted notifications
sub deleteNotification {
my ( $self, $uid, $myref ) = splice @_;
my ( $self, $uid, $myref ) = @_;
my @data;
# Check input parameters

@ -38,7 +38,7 @@ has syslog => (
# @param $mess Text to log
# @param $level Level (debug|info|notice|warn|error)
sub lmLog {
my ( $self, $msg, $level ) = splice @_;
my ( $self, $msg, $level ) = @_;
my $levels = {
error => 4,
warn => 3,
@ -95,7 +95,7 @@ sub userError {
# Responses methods
sub sendJSONresponse {
my ( $self, $req, $j, %args ) = splice @_;
my ( $self, $req, $j, %args ) = @_;
$args{code} ||= 200;
my $type = 'text/json';
if ( ref $j ) {
@ -105,7 +105,7 @@ sub sendJSONresponse {
}
sub sendError {
my ( $self, $req, $err, $code ) = splice @_;
my ( $self, $req, $err, $code ) = @_;
$err ||= $req->error;
$code ||= 500;
$self->lmLog( "Error $code: $err", $code > 499 ? 'error' : 'notice' );
@ -113,7 +113,7 @@ sub sendError {
}
sub abort {
my ( $self, $err ) = splice @_;
my ( $self, $err ) = @_;
$self->lmLog( $err, 'error' );
return sub {
$self->sendError( Lemonldap::NG::Common::PSGI::Request->new( $_[0] ),
@ -134,7 +134,7 @@ sub init { 1 }
sub router { _mustBeDefined(@_) }
sub sendHtml {
my ( $self, $req, $template ) = splice @_;
my ( $self, $req, $template ) = @_;
my $htpl;
$template = $self->templateDir . "/$template.tpl";
return $self->sendError( $req, "Unable to read $template", 500 )
@ -185,7 +185,7 @@ sub sendHtml {
###############
sub run {
my ( $self, $args ) = splice @_;
my ( $self, $args ) = @_;
unless ( ref $self ) {
$self = $self->new($args);
return $self->abort( $self->error ) unless ( $self->init($args) );
@ -217,7 +217,7 @@ Use Lemonldap::NG::Common::PSGI::Router for REST API.
use base Lemonldap::NG::Common::PSGI;
sub init {
my ($self,$args) = splice @_;
my ($self,$args) = @_;
# Will be called 1 time during startup
# Store debug level
@ -231,7 +231,7 @@ Use Lemonldap::NG::Common::PSGI::Router for REST API.
}
sub router {
my ( $self, $req ) = splice @_;
my ( $self, $req ) = @_;
# Do something and return a PSGI response
# NB: $req is a Lemonldap::NG::Common::PSGI::Request object

@ -75,7 +75,7 @@ has QUERY_STRING => (
);
sub params {
my ( $self, $key, $value ) = splice @_;
my ( $self, $key, $value ) = @_;
return $self->_params unless ($key);
$self->_params->{$key} = $value if ($value);
return $self->_params->{$key};
@ -158,7 +158,7 @@ PSGIs
...
sub router {
my ( $self, $req ) = splice @_;
my ( $self, $req ) = @_;
# Do something and return a PSGI response
# NB: $req is a Lemonldap::NG::Common::PSGI::Request object
if ( $req->accept eq 'text/plain' ) { ... }

@ -19,7 +19,7 @@ has 'defaultRoute' => ( is => 'rw', default => 'index.html' );
# Routes initialization
sub addRoute {
my ( $self, $word, $dest, $methods ) = splice(@_);
my ( $self, $word, $dest, $methods ) = (@_);
$methods ||= [qw(GET POST PUT DELETE)];
foreach my $method (@$methods) {
$self->genRoute( $self->routes->{$method}, $word, $dest );
@ -28,7 +28,7 @@ sub addRoute {
}
sub genRoute {
my ( $self, $routes, $word, $dest ) = splice @_;
my ( $self, $routes, $word, $dest ) = @_;
if ( ref $word eq 'ARRAY' ) {
foreach my $w (@$word) {
$self->genRoute( $routes, $w, $dest );
@ -78,11 +78,11 @@ sub genRoute {
}
sub routerAbort {
my ( $self, $path, $msg ) = splice @_;
my ( $self, $path, $msg ) = @_;
delete $self->routes->{$path};
$self->addRoute(
$path => sub {
my ( $self, $req ) = splice @_;
my ( $self, $req ) = @_;
return $self->sendError( $req, $msg, 500 );
}
);
@ -91,7 +91,7 @@ sub routerAbort {
# Methods that dispatch requests
sub router {
my ( $self, $req ) = splice @_;
my ( $self, $req ) = @_;
#print STDERR Dumper($self->routes);use Data::Dumper;
@ -124,7 +124,7 @@ sub router {
}
sub followPath {
my ( $self, $req, $routes, $path ) = splice @_;
my ( $self, $req, $routes, $path ) = @_;
if ( $path->[0] and defined $routes->{ $path->[0] } ) {
my $w = shift @$path;
if ( ref( $routes->{$w} ) eq 'CODE' ) {
@ -165,7 +165,7 @@ Lemonldap::NG::Common::PSGI::Router - Base library for REST APIs of Lemonldap::N
use base Lemonldap::NG::Common::PSGI::Router;
sub init {
my ($self,$args) = splice @_;
my ($self,$args) = @_;
# Will be called 1 time during startup
# Declare REST routes (could be HTML templates or methods)
@ -184,7 +184,7 @@ Lemonldap::NG::Common::PSGI::Router - Base library for REST APIs of Lemonldap::N
}
sub booksMethod {
my ( $self, $req, @otherPathInfo ) = splice @_;
my ( $self, $req, @otherPathInfo ) = @_;
my $book = $req->params('book');
my $method = $req->method;
...
@ -192,7 +192,7 @@ Lemonldap::NG::Common::PSGI::Router - Base library for REST APIs of Lemonldap::N
}
sub propertiesMethod {
my ( $self, $property, @otherPathInfo ) = splice @_;
my ( $self, $property, @otherPathInfo ) = @_;
my $method = $req->method;
...
$self->sendJSONresponse(...);

@ -19,7 +19,7 @@ our $self; # Safe cannot share a variable declared with my
# @param portal Lemonldap::NG::Portal::Simple object
# @return Lemonldap::NG::Common::Safe object
sub new {
my ( $class, $portal ) = splice @_;
my ( $class, $portal ) = @_;
my $self = {};
unless ( $portal->{useSafeJail} ) {
@ -47,7 +47,7 @@ sub new {
# @param e Expression to evaluate
sub reval {
local $self = shift;
my ($e) = splice @_;
my ($e) = @_;
my $result;
# Replace $date
@ -100,7 +100,7 @@ sub reval {
# @param vars Varibales
sub share_from {
local $self = shift;
my ( $pkg, $vars ) = splice(@_);
my ( $pkg, $vars ) = (@_);
# If Safe jail, call parent
if ( $self->{p}->{useSafeJail} ) {

@ -28,7 +28,7 @@ our $functions =
# @param $default_access optional what result to return for users without logons hours
# @return 1 if access allowed, 0 else
sub checkLogonHours {
my ( $logon_hours, $syntax, $time_correction, $default_access ) = splice @_;
my ( $logon_hours, $syntax, $time_correction, $default_access ) = @_;
# Active Directory - logonHours: $attr_src_syntax = octetstring
# Samba - sambaLogonHours: ???
@ -97,7 +97,7 @@ sub date {
# @param $default_access optional what result to return for users without start or end start
# @return 1 if access allowed, 0 else
sub checkDate {
my ( $start, $end, $default_access ) = splice @_;
my ( $start, $end, $default_access ) = @_;
# Get date in string
$start = substr( $start, 0, 14 );
@ -126,7 +126,7 @@ sub checkDate {
# @param password User password
# @return Authorization header content
sub basic {
my ( $login, $password ) = splice @_;
my ( $login, $password ) = @_;
# UTF-8 strings should be ISO encoded
$login = &unicode2iso($login);
@ -140,7 +140,7 @@ sub basic {
# @param string UTF-8 string
# @return ISO string
sub unicode2iso {
my ($string) = splice @_;
my ($string) = @_;
return encode( "iso-8859-1", decode( "utf-8", $string ) );
}
@ -150,7 +150,7 @@ sub unicode2iso {
# @param string ISO string
# @return UTF-8 string
sub iso2unicode {
my ($string) = splice @_;
my ($string) = @_;
return encode( "utf-8", decode( "iso-8859-1", $string ) );
}

@ -46,7 +46,7 @@ sub setServerSignature {
my ( $class, $sign ) = @_;
Apache2::ServerUtil->server->push_handlers(
PerlPostConfigHandler => sub {
my ( $c, $l, $t, $s ) = splice @_;
my ( $c, $l, $t, $s ) = @_;
$s->add_version_component($sign);
}
);

@ -39,7 +39,7 @@ sub newRequest {
# sets remote_user
# @param user string username
sub set_user {
my ( $class, $user ) = splice @_;
my ( $class, $user ) = @_;
# TODO
}

@ -52,7 +52,7 @@ sub user {
# @param $group name of the Lemonldap::NG group to test
# @return boolean : true if user is in this group
sub group {
my ( $self, $group ) = splice @_;
my ( $self, $group ) = @_;
return ( $datas->{groups} =~ /\b$group\b/ );
}

@ -122,7 +122,7 @@ sub hideCookie {
# Encode URl in the format used by Lemonldap::NG::Portal for redirections.
# @return Base64 encoded string
sub encodeUrl {
my ( $class, $url ) = splice @_;
my ( $class, $url ) = @_;
$url = $class->_buildUrl($url) if ( $url !~ m#^https?://# );
return encode_base64( $url, '' );
}
@ -133,7 +133,7 @@ sub encodeUrl {
# @param $arg optionnal GET parameters
# @return Apache2::Const::REDIRECT
sub goToPortal {
my ( $class, $url, $arg ) = splice @_;
my ( $class, $url, $arg ) = @_;
Lemonldap::NG::Handler::Main::Logger->lmLog(
"Redirect "
. Lemonldap::NG::Handler::API->remote_ip
@ -464,7 +464,7 @@ sub grant {
# @param $s path
# @return URL
sub _buildUrl {
my ( $class, $s ) = splice @_;
my ( $class, $s ) = @_;
my $vhost = Lemonldap::NG::Handler::API->hostname;
my $portString =
$tsv->{port}->{$vhost}

@ -82,28 +82,28 @@ sub build_jail {
## @method reval
# Fake reval method if useSafeJail is off
sub reval {
my ( $self, $e ) = splice @_;
my ( $self, $e ) = @_;
return eval $e;
}
## @method wrap_code_ref
# Fake wrap_code_ref method if useSafeJail is off
sub wrap_code_ref {
my ( $self, $e ) = splice @_;
my ( $self, $e ) = @_;
return $e;
}
## @method share
# Fake share method if useSafeJail is off
sub share {
my ( $self, @vars ) = splice @_;
my ( $self, @vars ) = @_;
$self->share_from( scalar(caller), \@vars );
}
## @method share_from
# Fake share_from method if useSafeJail is off
sub share_from {
my ( $self, $pkg, $vars ) = splice @_;
my ( $self, $pkg, $vars ) = @_;
no strict 'refs';
foreach my $arg (@$vars) {
@ -126,7 +126,7 @@ sub share_from {
# Build and return restricted eval command with SAFEWRAP, if activated
# @return evaluation of $reval or $reval2
sub jail_reval {
my ( $self, $reval ) = splice @_;
my ( $self, $reval ) = @_;
# if nothing is returned by reval, add the return statement to
# the "no safe wrap" reval

@ -10,7 +10,7 @@ our $VERSION = '1.9.0';
has protection => ( is => 'rw', isa => 'Str' );
around init => sub {
my ( $method, $self, $args ) = splice @_;
my ( $method, $self, $args ) = @_;
Lemonldap::NG::Handler::SharedConf->init($self);
Lemonldap::NG::Handler::SharedConf->checkConf($self);
return $self->$method($args);
@ -94,14 +94,14 @@ sub _run {
## @method hashRef user()
# @return hash of user datas
sub user {
my ( $self, $req ) = splice @_;
my ( $self, $req ) = @_;
return $req->userData || { _whatToTrace => 'anonymous' };
}
## @method string userId()
# @return user identifier to log
sub userId {
my ( $self, $req ) = splice @_;
my ( $self, $req ) = @_;
return $req->userData->{_whatToTrace} || 'anonymous';
}
@ -109,7 +109,7 @@ sub userId {
# @param $group name of the Lemonldap::NG group to test
# @return boolean : true if user is in this group
sub group {
my ( $self, $req, $group ) = splice @_;
my ( $self, $req, $group ) = @_;
return () unless ( $req->userData->{groups} );
return ( $req->userData->{groups} =~ /\b$group\b/ );
}
@ -120,7 +120,7 @@ sub group {
# @param $err String to push
# @code int HTTP error code (default to 500)
sub sendError {
my ( $self, $req, $err, $code ) = splice @_;
my ( $self, $req, $err, $code ) = @_;
$err ||= $req->error;
$err = '[' . $self->userId($req) . "] $err";
return $self->SUPER::sendError( $req, $err, $code );
@ -143,7 +143,7 @@ Lemonldap::NG.
use base Lemonldap::NG::Handler;
sub init {
my ($self,$args) = splice @_;
my ($self,$args) = @_;
$self->protection('manager');
# See Lemonldap::NG::Common::PSGI for more
@ -160,7 +160,7 @@ Lemonldap::NG.
}
sub booksMethod {
my ( $self, $req, @otherPathInfo ) = splice @_;
my ( $self, $req, @otherPathInfo ) = @_;
# Will be called only if authorisated
my $userId = $self->userId;

@ -60,7 +60,7 @@ $UA->requests_redirectable( [] );
# Called for Apache response (PerlResponseHandler).
# @return Apache constant
sub run($$) {
( $class, $r ) = splice @_;
( $class, $r ) = @_;
my $url = Lemonldap::NG::Handler::API->uri_with_args($r);
# Uncomment this if you have lost of session problem with SAP.

@ -48,7 +48,7 @@ sub globalInit {
# Overload defaultValuesInit
# @param $args reference to the configuration hash
sub defaultValuesInit {
my ( $class, $args ) = splice @_;
my ( $class, $args ) = @_;
# Catch Secure Token parameters
$secureTokenMemcachedServers =
@ -182,7 +182,7 @@ sub run {
# Create Memcached connexion
# @return Cache::Memcached object
sub _createMemcachedConnection {
my ($class) = splice @_;
my ($class) = @_;
# Open memcached connexion
my $memd = new Cache::Memcached {
@ -201,7 +201,7 @@ sub _createMemcachedConnection {
# @param value Value
# @return Token key
sub _setToken {
my ( $class, $value ) = splice @_;
my ( $class, $value ) = @_;
my $key = Apache::Session::Generate::MD5::generate();
@ -226,7 +226,7 @@ sub _setToken {
# @param key Key
# @return result
sub _deleteToken {
my ( $class, $key ) = splice @_;
my ( $class, $key ) = @_;
my $res = $secureTokenMemcachedConnection->delete($key);
@ -247,7 +247,7 @@ sub _deleteToken {
# @param connection Cache::Memcached object
# @return result
sub _isAlive {
my ($class) = splice @_;
my ($class) = @_;
return 0 unless defined $secureTokenMemcachedConnection;

@ -35,7 +35,7 @@ sub globalInit {
# Overload defaultValuesInit
# @param $args reference to the configuration hash
sub defaultValuesInit {
my ( $class, $args ) = splice @_;
my ( $class, $args ) = @_;
# Sympa secret should be in configuration
$sympaSecret = $args->{'sympaSecret'} || $sympaSecret;

@ -36,7 +36,7 @@ sub globalInit {
# Overload defaultValuesInit
# @param $args reference to the configuration hash
sub defaultValuesInit {
my ( $class, $args ) = splice @_;
my ( $class, $args ) = @_;
# Catch Zimbra parameters
$zimbraPreAuthKey = $args->{'zimbraPreAuthKey'} || $zimbraPreAuthKey;
@ -118,7 +118,7 @@ sub run {
# @param by Account type
# @return Zimbra PreAuth URL
sub _buildZimbraPreAuthUrl {
my ( $class, $key, $url, $account, $by ) = splice @_;
my ( $class, $key, $url, $account, $by ) = @_;
# Expiration time is calculated with _utime and timeout
my $expires = $timeout ? ( $datas->{_utime} + $timeout ) * 1000 : $timeout;

@ -300,7 +300,7 @@ sub timeUp {
# @param $cat Category to display
# @param $max Number of lines to display
sub topByCat {
my ( $cat, $max ) = splice @_;
my ( $cat, $max ) = @_;
my $i = 0;
print "<pre>\n";
foreach (

@ -24,7 +24,7 @@ extends 'Lemonldap::NG::Handler::PSGI', 'Lemonldap::NG::Manager::Lib';
# @param $args hashref to merge with object
# @return 0 in case of error, 1 else
sub init {
my ( $self, $args ) = splice @_;
my ( $self, $args ) = @_;
$args ||= {};
foreach my $k ( keys %$args ) {

@ -252,7 +252,7 @@ $managerAttr}
}
sub mydump {
my ($obj, $subname) = splice @_;
my ($obj, $subname) = @_;
my $t = Dumper($obj);
$t =~ s/^\s*(?:use strict;|package .*?;|)\n//gm;
$t =~ s/^\$VAR1\s*=/sub $subname {\n return/;
@ -260,7 +260,7 @@ sub mydump {
}
sub scanTree {
my ( $self, $tree, $json, $prefix, $path ) = splice @_;
my ( $self, $tree, $json, $prefix, $path ) = @_;
unless ( ref($tree) eq 'ARRAY' ) {
die 'Not an array';
}

@ -22,7 +22,7 @@ has app => (
);
sub _get {
my ( $self, $path, $query ) = splice @_;
my ( $self, $path, $query ) = @_;
$query //= '';
return $self->app->(
{
@ -47,7 +47,7 @@ sub _get {
}
sub _post {
my ( $self, $path, $query, $body, $type, $len ) = splice @_;
my ( $self, $path, $query, $body, $type, $len ) = @_;
die "$body must be a IO::Handle"
unless ( ref($body) and $body->can('read') );
return $self->app->(
@ -77,7 +77,7 @@ sub _post {
}
sub _put {
my ( $self, $path, $query, $body, $type, $len ) = splice @_;
my ( $self, $path, $query, $body, $type, $len ) = @_;
die "$body must be a IO::Handle"
unless ( ref($body) and $body->can('read') );
return $self->app->(
@ -107,7 +107,7 @@ sub _put {
}
sub _del {
my ( $self, $path, $query ) = splice @_;
my ( $self, $path, $query ) = @_;
return $self->app->(
{
'HTTP_ACCEPT' => 'application/json, text/plain, */*',
@ -131,7 +131,7 @@ sub _del {
}
sub jsonResponse {
my ( $self, $path, $query ) = splice @_;
my ( $self, $path, $query ) = @_;
my $res = $self->_get( $path, $query )
or die "Manager lib has refused my get, aborting";
die "Manager lib does not return a 200 code, aborting"
@ -141,7 +141,7 @@ sub jsonResponse {
}
sub jsonPostResponse {
my ( $self, $path, $query, $body, $type, $len ) = splice @_;
my ( $self, $path, $query, $body, $type, $len ) = @_;
my $res = $self->_post( $path, $query, $body, $type, $len )
or die "Manager lib has refused my post, aborting";
die "Manager lib does not return a 200 code, aborting"
@ -151,7 +151,7 @@ sub jsonPostResponse {
}
sub jsonPutResponse {
my ( $self, $path, $query, $body, $type, $len ) = splice @_;
my ( $self, $path, $query, $body, $type, $len ) = @_;
my $res = $self->_put( $path, $query, $body, $type, $len )
or die "Manager lib has refused my put, aborting";
die "Manager lib does not return a 200 code, aborting"

@ -99,7 +99,7 @@ use feature 'state';
# Recursive JSON parser
sub _scanNodes {
my ( $self, $tree, ) = splice @_;
my ( $self, $tree, ) = @_;
hdebug("# _scanNodes()");
state( $knownCat, %newNames );
unless ( ref($tree) eq 'ARRAY' ) {
@ -632,7 +632,7 @@ sub set {
}
sub defaultValue {
my ( $self, $target ) = splice @_;
my ( $self, $target ) = @_;
hdebug("# defautValue($target)");
die unless ($target);
my $res = eval {
@ -649,7 +649,7 @@ sub testNewConf {
}
sub _unitTest {
my ( $self, $conf ) = splice @_;
my ( $self, $conf ) = @_;
hdebug('# _unitTest()');
my $types = &Lemonldap::NG::Manager::Attributes::types();
my $attrs = &Lemonldap::NG::Manager::Attributes::attributes();

@ -118,23 +118,23 @@ sub notifAccess {
#######################
sub notEnabled {
my ( $self, $req ) = splice @_;
my ( $self, $req ) = @_;
return $self->sendError( $req,
'Notifications are not enabled in your configuration', 400 );
}
sub activeNotifications {
my ( $self, $req, $notif ) = splice @_;
my ( $self, $req, $notif ) = @_;
return $self->notifications( $req, $notif, 'actives' );
}
sub doneNotifications {
my ( $self, $req, $notif ) = splice @_;
my ( $self, $req, $notif ) = @_;
return $self->notifications( $req, $notif, 'done' );
}
sub notifications {
my ( $self, $req, $notif, $type ) = splice @_;
my ( $self, $req, $notif, $type ) = @_;
my $sub = { actives => 'getAll', done => 'getDone' }->{$type}
or die "Unknown type $type";
@ -214,7 +214,7 @@ sub notifications {
}
sub notification {
my ( $self, $req, $id, $type ) = splice @_;
my ( $self, $req, $id, $type ) = @_;
if ( $type eq 'actives' ) {
my ( $uid, $ref ) = ( $id =~ /([^_]+?)_(.+)/ );
@ -240,7 +240,7 @@ sub notification {
}
sub newNotification {
my ( $self, $req, @other ) = splice @_;
my ( $self, $req, @other ) = @_;
return $self->sendError( $req,
'There is no subkey for "newNotification"', 400 )
if (@other);
@ -281,7 +281,7 @@ sub newNotification {
}
sub updateNotification {
my ( $self, $req ) = splice @_;
my ( $self, $req ) = @_;
my $json = $req->jsonBodyToObj;
unless ( defined($json) ) {
@ -321,7 +321,7 @@ sub updateNotification {
}
sub deleteDoneNotification {
my ( $self, $req ) = splice @_;
my ( $self, $req ) = @_;
my $res;
# Purge notification

@ -70,7 +70,7 @@ sub addRoutes {
#######################
sub sessions {
my ( $self, $req, $session, $skey ) = splice @_;
my ( $self, $req, $session, $skey ) = @_;
# Case 1: only one session is required
if ($session) {
@ -302,7 +302,7 @@ sub sessions {
}
sub delSession {
my ( $self, $req ) = splice @_;
my ( $self, $req ) = @_;
return $self->sendJSONresponse( $req, { result => 1 } )
if ( $self->{demoMode} );
my $mod = $self->getMod($req)
@ -318,7 +318,7 @@ sub delSession {
}
sub session {
my ( $self, $req, $id, $skey ) = splice @_;
my ( $self, $req, $id, $skey ) = @_;
my ( %h, $res );
my $mod = $self->getMod($req)
or return $self->sendError( $req, undef, 400 );
@ -347,7 +347,7 @@ sub session {
}
sub getApacheSession {
my ( $self, $mod, $id ) = splice @_;
my ( $self, $mod, $id ) = @_;
my $apacheSession = Lemonldap::NG::Common::Session->new(
{
storageModule => $mod->{module},

@ -225,7 +225,7 @@ sub openIDServer {
# Manage Lemonldap::NG::Portal::OpenID::Server responses
# @return Lemonldap::NG::Portal error code
sub _openIDResponse {
my ( $self, $type, $data ) = splice @_;
my ( $self, $type, $data ) = @_;
# Redirect
if ( $type eq 'redirect' ) {

@ -48,7 +48,7 @@ use POSIX qw(strftime);
# - passwordDBFinish
# @return 1 if all is OK
sub process {
my ($self) = splice @_;
my ($self) = @_;
# Process subroutines
$self->{error} = PE_OK;
@ -76,7 +76,7 @@ sub process {
# Load SMTP methods
# @return Lemonldap::NG::Portal constant
sub smtpInit {
my ($self) = splice @_;
my ($self) = @_;
eval { use base qw(Lemonldap::NG::Portal::_SMTP) };
@ -92,7 +92,7 @@ sub smtpInit {
# Get mail from form or from mail_token
# @return Lemonldap::NG::Portal constant
sub extractMailInfo {
my ($self) = splice @_;
my ($self) = @_;
if ( $self->{captcha_mail_enabled} ) {
eval { $self->initCaptcha(); };
@ -192,7 +192,7 @@ sub extractMailInfo {
# Search for user using UserDB module
# @return Lemonldap::NG::Portal constant
sub getMailUser {
my ($self) = splice @_;
my ($self) = @_;
my $error = $self->getUser();
@ -208,7 +208,7 @@ sub getMailUser {
# Create mail session and store token
# @return Lemonldap::NG::Portal constant
sub storeMailSession {
my ($self) = splice @_;
my ($self) = @_;
# Skip this step if confirmation was already sent
return PE_OK
@ -254,7 +254,7 @@ sub storeMailSession {
# Send confirmation mail
# @return Lemonldap::NG::Portal constant
sub sendConfirmationMail {
my ($self) = splice @_;
my ($self) = @_;
# Skip this step if user clicked on the confirmation link
return PE_OK if $self->{mail_token};
@ -349,7 +349,7 @@ sub sendConfirmationMail {
# Change the password or generate a new password
# @return Lemonldap::NG::Portal constant
sub changePassword {
my ($self) = splice @_;
my ($self) = @_;
# Check if user wants to generate the new password
if ( $self->param('reset') ) {
@ -408,7 +408,7 @@ sub changePassword {
# Send mail containing the new password
# @return Lemonldap::NG::Portal constant
sub sendPasswordMail {
my ($self) = splice @_;
my ($self) = @_;
# Get mail address
unless ( $self->{mailAddress} ) {

@ -126,7 +126,7 @@ sub displayModules {
# Returns categories and applications list as HTML::Template loop
# @return categories and applications list
sub appslist {
my ($self) = splice @_;
my ($self) = @_;
my $appslist = [];
return $appslist unless defined $self->{applicationList};
@ -151,7 +151,7 @@ sub appslist {
# @param catlevel Category level
# @return Category Hash
sub _buildCategoryHash {
my ( $self, $catid, $cathash, $catlevel ) = splice @_;
my ( $self, $catid, $cathash, $catlevel ) = @_;
my $catname = $cathash->{catname} || $catid;
my $applications;
my $categories;
@ -200,7 +200,7 @@ sub _buildCategoryHash {
# @param $apphash Hash of application elements
# @return Application Hash
sub _buildApplicationHash {
my ( $self, $appid, $apphash ) = splice @_;
my ( $self, $appid, $apphash ) = @_;
my $applications;
# Get application items
@ -286,7 +286,7 @@ sub appslistDescription {
# @param catlevel Category level
# @return HTML string
sub _displayConfCategory {
my ( $self, $catname, $cathash, $catlevel ) = splice @_;
my ( $self, $catname, $cathash, $catlevel ) = @_;
my $html;
my $key;
@ -427,7 +427,7 @@ sub _displayConfDescription {
# @param $apphash Menu elements
# @return filtered hash
sub _filter {
my ( $self, $apphash ) = splice @_;
my ( $self, $apphash ) = @_;
my $filteredHash;
my $key;

@ -15,7 +15,7 @@ use utf8;
# Hook called to add SREG parameters to the OpenID response
# @return Hash containing wanted parameters
sub sregHook {
my ( $self, $u, $trust_root, $is_id, $is_trusted, $prm ) = splice @_;
my ( $self, $u, $trust_root, $is_id, $is_trusted, $prm ) = @_;
my ( @req, @opt );
# Refuse federation if rejected by user
@ -217,7 +217,7 @@ sub sregHook {
# SREG.
# @return fitered datas
sub sregfilter {
my ( $self, @attr ) = splice @_;
my ( $self, @attr ) = @_;
my ( @ret, @rej );
# Browse attributes

@ -30,7 +30,7 @@ my $OPENID2_ID_SELECT = qq!http://specs.openid.net/auth/2.0/identifier_select!;
sub new {
my $class = shift;
my $self = fields::new($class);
my %opts = splice @_;
my %opts = @_;
$self->$_( delete $opts{$_} ) foreach (qw(extensions));
$self->SUPER::new(%opts);

@ -44,7 +44,7 @@ use POSIX qw(strftime);
# - registerDBFinish
# @return 1 if all is OK
sub process {
my ($self) = splice @_;
my ($self) = @_;
# Process subroutines
$self->{error} = PE_OK;
@ -70,7 +70,7 @@ sub process {
# Load SMTP methods
# @return Lemonldap::NG::Portal constant
sub smtpInit {
my ($self) = splice @_;
my ($self) = @_;
eval { use base qw(Lemonldap::NG::Portal::_SMTP) };
@ -86,7 +86,7 @@ sub smtpInit {
# Get info from form or from register_token
# @return Lemonldap::NG::Portal constant
sub extractRegisterInfo {
my ($self) = splice @_;
my ($self) = @_;
if ( $self->{captcha_register_enabled} ) {
eval { $self->initCaptcha(); };
@ -194,7 +194,7 @@ sub extractRegisterInfo {
# If the user already exists, register is forbidden
# @return Lemonldap::NG::Portal constant
sub getRegisterUser {
my ($self) = splice @_;
my ($self) = @_;
$self->{mail} = $self->{registerInfo}->{mail};
@ -215,7 +215,7 @@ sub getRegisterUser {
# Create register session and store token
# @return Lemonldap::NG::Portal constant
sub storeRegisterSession {
my ($self) = splice @_;
my ($self) = @_;
# Skip this step if confirmation was already sent
return PE_OK
@ -262,7 +262,7 @@ sub storeRegisterSession {
# Send confirmation mail
# @return Lemonldap::NG::Portal constant
sub sendConfirmationMail {
my ($self) = splice @_;
my ($self) = @_;
# Skip this step if user clicked on the confirmation link
return PE_OK if $self->{register_token};
@ -345,7 +345,7 @@ sub sendConfirmationMail {
# Create the account
# @return Lemonldap::NG::Portal constant
sub registerUser {
my ($self) = splice @_;
my ($self) = @_;
my $result;
# Check mail is still unused
@ -409,7 +409,7 @@ sub registerUser {
# Send mail containing a temporary password
# @return Lemonldap::NG::Portal constant
sub sendRegisterMail {
my ($self) = splice @_;
my ($self) = @_;
# Build mail content
my $subject = $self->{registerDoneSubject};

@ -14,7 +14,7 @@ use Unicode::String qw(utf8);
# Insert new user
# @result Lemonldap::NG::Portal constant
sub createUser {
my ($self) = splice @_;
my ($self) = @_;
my $name =
ucfirst $self->{registerInfo}->{firstname} . " "
@ -50,7 +50,7 @@ sub createUser {
# Search if login is already in use
# @result 0 if login is used, 1 else
sub isLoginUsed {
my ( $self, $login ) = splice @_;
my ( $self, $login ) = @_;
my $mesg = $self->ldap->search(
base => $self->{ldapBase},

@ -14,7 +14,7 @@ our $VERSION = '1.4.0';
# Compute a login from register infos
# @result Lemonldap::NG::Portal constant
sub computeLogin {
my ($self) = splice @_;
my ($self) = @_;
# Get first letter of firstname and lastname
my $login =
@ -30,7 +30,7 @@ sub computeLogin {
# Do nothing
# @result Lemonldap::NG::Portal constant
sub createUser {
my ($self) = splice @_;
my ($self) = @_;
return PE_OK;
}
@ -39,7 +39,7 @@ sub createUser {
# Do nothing
# @result Lemonldap::NG::Portal constant
sub registerDBFinish {
my ($self) = splice @_;
my ($self) = @_;
return PE_OK;
}

@ -12,7 +12,7 @@ use Lemonldap::NG::Portal::Simple;
# Compute a login from register infos
# @result Lemonldap::NG::Portal constant
sub computeLogin {
my ($self) = splice @_;
my ($self) = @_;
# Get first letter of firstname and lastname
my $login =
@ -37,7 +37,7 @@ sub computeLogin {
# Insert new user
# @result Lemonldap::NG::Portal constant
sub createUser {
my ($self) = splice @_;
my ($self) = @_;
my $mesg = $self->ldap->add(
"uid=" . $self->{registerInfo}->{login} . "," . $self->{ldapBase},
@ -72,7 +72,7 @@ sub createUser {
# Search if login is already in use
# @result 0 if login is used, 1 else
sub isLoginUsed {
my ( $self, $login ) = splice @_;
my ( $self, $login ) = @_;
my $mesg = $self->ldap->search(
base => $self->{ldapBase},

@ -11,7 +11,7 @@ use Lemonldap::NG::Portal::Simple;
our $VERSION = '1.4.0';
sub getLogin {
my $self = splice @_;
my $self = @_;
$self->{registerInfo}->{login} = "";
return PE_OK;
}

@ -502,7 +502,7 @@ sub new {
# @param ignoreError set to 1 if error should not appear in logs
# @return boolean
sub loadModule {
my ( $self, $module, $ignoreError ) = splice @_;
my ( $self, $module, $ignoreError ) = @_;
return 1 unless $module;
@ -547,7 +547,7 @@ sub getConf {
# @param base64 Encode value in base64
# @return nothing
sub setHiddenFormValue {
my ( $self, $key, $val, $prefix, $base64 ) = splice @_;
my ( $self, $key, $val, $prefix, $base64 ) = @_;
# Default values
$prefix = "lmhidden_" unless defined $prefix;
@ -569,7 +569,7 @@ sub setHiddenFormValue {
# @param base64 Decode value from base64
# @return string The associated value
sub getHiddenFormValue {
my ( $self, $key, $prefix, $base64 ) = splice @_;
my ( $self, $key, $prefix, $base64 ) = @_;
# Default values
$prefix = "lmhidden_" unless defined $prefix;
@ -594,7 +594,7 @@ sub getHiddenFormValue {
# @param keys Array reference of keys
# @return nothing
sub clearHiddenFormValue {
my ( $self, $keys ) = splice @_;
my ( $self, $keys ) = @_;
unless ( defined $keys ) {
delete $self->{portalHiddenFormValues};
@ -662,7 +662,7 @@ sub initCaptcha {
# @param captcha code generated by Authen::Captcha
# @return a constant
sub checkCaptcha {
my ( $self, $code, $ccode ) = splice @_;
my ( $self, $code, $ccode ) = @_;
# Get captcha object
my $captcha = Lemonldap::NG::Common::Captcha->new(
@ -692,7 +692,7 @@ sub checkCaptcha {
# @param captcha code generated by Authen::Captcha
# @return a constant
sub removeCaptcha {
my ( $self, $ccode ) = splice @_;
my ( $self, $ccode ) = @_;
# Get captcha object
my $captcha = Lemonldap::NG::Common::Captcha->new(
@ -721,7 +721,7 @@ sub removeCaptcha {
# @param value Parameter value
# @return 1 if url can be trusted, 0 else
sub isTrustedUrl {
my ( $self, $url ) = splice @_;
my ( $self, $url ) = @_;
return
$url =~ m#^https?://$self->{reVHosts}(:\d+)?/#o
|| $self->{trustedDomains} eq "*"
@ -735,7 +735,7 @@ sub isTrustedUrl {
# @param value Parameter value
# @return 1 if attack detected, 0 else
sub checkXSSAttack {
my ( $self, $name, $value ) = splice @_;
my ( $self, $name, $value ) = @_;
# Empty values are not bad
return 0 unless $value;
@ -921,7 +921,7 @@ sub getApacheSession {
# @param id session reference
# return Lemonldap::NG::Common::Session object
sub getPersistentSession {
my ( $self, $id ) = splice @_;
my ( $self, $id ) = @_;
my $persistentSession = Lemonldap::NG::Common::Session->new(
{
@ -947,7 +947,7 @@ sub getPersistentSession {
# @param $s String to hash
# @return hashed value
sub _md5hash {
my ( $self, $s ) = splice @_;
my ( $self, $s ) = @_;
return substr( Digest::MD5::md5_hex($s), 0, 32 );
}
@ -960,7 +960,7 @@ sub _md5hash {
# @param id optional SSO session ID
# @return nothing
sub updatePersistentSession {
my ( $self, $infos, $uid, $id ) = splice @_;
my ( $self, $infos, $uid, $id ) = @_;
# Return if no infos to update
return () unless ( ref $infos eq 'HASH' and %$infos );
@ -995,7 +995,7 @@ sub updatePersistentSession {
# @param id Session ID
# @return nothing
sub updateSession {
my ( $self, $infos, $id ) = splice @_;
my ( $self, $infos, $id ) = @_;
# Return if no infos to update
return () unless ( ref $infos eq 'HASH' and %$infos );
@ -1042,7 +1042,7 @@ sub updateSession {
# @param value Value to add
# @param id optional Session identifier
sub addSessionValue {
my ( $self, $key, $value, $id ) = splice @_;
my ( $self, $key, $value, $id ) = @_;
# Mandatory parameters
return () unless defined $key;
@ -1080,7 +1080,7 @@ sub addSessionValue {
# @param value the complete value
# @return first value
sub getFirstValue {
my ( $self, $value ) = splice @_;
my ( $self, $value ) = @_;
my @values = split /\Q$self->{multiValuesSeparator}\E/, $value;
@ -1157,7 +1157,7 @@ sub get_user {
# @param type auth/user/password/issuer
# @return module name
sub get_module {
my ( $self, $type ) = splice @_;
my ( $self, $type ) = @_;
if ( $type =~ /auth/i ) {
if ( defined $self->{_multi}->{stack}->[0] ) {
@ -1378,7 +1378,7 @@ sub stamp {
# @param $sec number of seconds
# @return a formated time
sub convertSec {
my ( $self, $sec ) = splice @_;
my ( $self, $sec ) = @_;
my ( $day, $hrs, $min ) = ( 0, 0, 0 );
# Calculate the minutes
@ -1407,7 +1407,7 @@ sub convertSec {
# Return skin name
# @return skin name
sub getSkin {
my ($self) = splice @_;
my ($self) = @_;
my $skin = $self->{portalSkin};

@ -124,7 +124,7 @@ sub setGroups {
# @param value Value to store
# @return result
sub setUserDBValue {
my ( $self, $key, $value ) = splice @_;
my ( $self, $key, $value ) = @_;
# Mandatory attributes
return 0 unless defined $key;

@ -191,7 +191,7 @@ sub setGroups {
# @param value Value to store
# @return result
sub setUserDBValue {
my ( $self, $key, $value ) = splice @_;
my ( $self, $key, $value ) = @_;
# Mandatory attributes
return 0 unless defined $key;

@ -18,7 +18,7 @@ our $VERSION = '1.9.0';
# @param id session reference
# @return CAS session object
sub getCasSession {
my ( $self, $id ) = splice @_;
my ( $self, $id ) = @_;
my $casSession = Lemonldap::NG::Common::Session->new(
{
@ -49,7 +49,7 @@ sub getCasSession {
# Return an error for CAS VALIDATE request
# @return nothing
sub returnCasValidateError {
my ($self) = splice @_;
my ($self) = @_;
$self->lmLog( "Return CAS validate error", 'debug' );
@ -64,7 +64,7 @@ sub returnCasValidateError {
# @param username User name
# @return nothing
sub returnCasValidateSuccess {
my ( $self, $username ) = splice @_;
my ( $self, $username ) = @_;
$self->lmLog( "Return CAS validate success with username $username",
'debug' );
@ -81,7 +81,7 @@ sub returnCasValidateSuccess {
# @param text Error text
# @return nothing
sub returnCasServiceValidateError {
my ( $self, $code, $text ) = splice @_;
my ( $self, $code, $text ) = @_;
$code ||= 'INTERNAL_ERROR';
$text ||= 'No description provided';
@ -106,7 +106,7 @@ sub returnCasServiceValidateError {
# @param attributes Attributes to return
# @return nothing
sub returnCasServiceValidateSuccess {
my ( $self, $username, $pgtIou, $proxies, $attributes ) = splice @_;
my ( $self, $username, $pgtIou, $proxies, $attributes ) = @_;
$self->lmLog( "Return CAS service validate success with username $username",
'debug' );
@ -155,7 +155,7 @@ sub returnCasServiceValidateSuccess {
# @param text Error text
# @return nothing
sub returnCasProxyError {
my ( $self, $code, $text ) = splice @_;
my ( $self, $code, $text ) = @_;
$code ||= 'INTERNAL_ERROR';
$text ||= 'No description provided';
@ -177,7 +177,7 @@ sub returnCasProxyError {
# @param ticket Proxy ticket
# @return nothing
sub returnCasProxySuccess {
my ( $self, $ticket ) = splice @_;
my ( $self, $ticket ) = @_;
$self->lmLog( "Return CAS proxy success with ticket $ticket", 'debug' );
@ -195,7 +195,7 @@ sub returnCasProxySuccess {
# @param session_id Primary session ID
# @return result
sub deleteCasSecondarySessions {
my ( $self, $session_id ) = splice @_;
my ( $self, $session_id ) = @_;
my $result = 1;
# Find CAS sessions
@ -233,7 +233,7 @@ sub deleteCasSecondarySessions {
# @param session object
# @return result
sub deleteCasSession {
my ( $self, $session ) = splice @_;
my ( $self, $session ) = @_;
# Check session object
unless ( $session && $session->data ) {
@ -262,7 +262,7 @@ sub deleteCasSession {
# @param pgtId Proxy granting ticket
# @return result
sub callPgtUrl {
my ( $self, $pgtUrl, $pgtIou, $pgtId ) = splice @_;
my ( $self, $pgtUrl, $pgtIou, $pgtId ) = @_;
# Build URL
my $url = $pgtUrl;

@ -16,7 +16,7 @@ our $VERSION = '1.4.0';
# @param $portal Lemonldap::NG::Portal::Simple object
# @return new Lemonldap::NG::Portal::_Choice object
sub new {
my ( $class, $portal ) = splice @_;
my ( $class, $portal ) = @_;
# Create object with portal parameter
my $self = bless { p => $portal }, $class;
@ -114,7 +114,7 @@ sub new {
# @param type 0 for authentication, 1 for userDB, 2 for passworDB
# @return Lemonldap::NG::Portal error code returned by method $sub
sub try {
my ( $self, $sub, $type ) = splice @_;
my ( $self, $sub, $type ) = @_;
# Default behavior in no choice
unless ( defined $self->{modules} ) {

@ -90,7 +90,7 @@ sub new {
sub bind {
my $self = shift;
my $mesg;
my ( $dn, %args ) = splice @_;
my ( $dn, %args ) = @_;
unless ($dn) {
$dn = $self->{portal}->{managerDn};
$args{password} = $self->{portal}->{managerPassword};
@ -230,7 +230,7 @@ sub userBind {
# @return Lemonldap::NG::Portal constant
sub userModifyPassword {
my ( $self, $dn, $newpassword, $confirmpassword, $oldpassword, $ad ) =
splice @_;
@_;
my $ppolicyControl = $self->{portal}->{ldapPpolicyControl};
my $setPassword = $self->{portal}->{ldapSetPassword};
my $asUser = $self->{portal}->{ldapChangePasswordAsUser};
@ -520,7 +520,7 @@ sub ldap {
# @param attributes to get from found groups (array ref)
# @return hashRef groups
sub searchGroups {
my ( $self, $base, $key, $value, $attributes ) = splice @_;
my ( $self, $base, $key, $value, $attributes ) = @_;
my $portal = $self->{portal};
my $groups = {};
@ -604,7 +604,7 @@ sub searchGroups {
# @param attribute Attribute name
# @return string value
sub getLdapValue {
my ( $self, $entry, $attribute ) = splice @_;
my ( $self, $entry, $attribute ) = @_;
return $entry->dn() if ( $attribute eq "dn" );

@ -28,7 +28,7 @@ BEGIN {
# @param $uri URL string
# @return True if granted
sub _grant {
my ( $self, $uri ) = splice @_;
my ( $self, $uri ) = @_;
$self->lmLog( "Evaluate access right on $uri", 'debug' );
$uri =~ m{(\w+)://([^/:]+)(:\d+)?(/.*)?$} or return 0;
my ( $protocol, $vhost, $port, $path );
@ -112,7 +112,7 @@ sub _compileRules {
# @param $cond boolean expression
# @return Compiled routine
sub _conditionSub {
my ( $self, $cond ) = splice @_;
my ( $self, $cond ) = @_;
return sub { 1 }
if ( $cond =~ /^(?:accept|unprotect|skip)$/i );
return sub { 0 }
@ -127,7 +127,7 @@ sub _conditionSub {
# @param options vhostOptions configuration item
# @return arrayref of vhost and aliases
sub _getAliases {
my ( $self, $vhost, $options ) = splice @_;
my ( $self, $vhost, $options ) = @_;
my $aliases = [$vhost];
if ( $options->{$vhost}->{vhostAliases} ) {

@ -20,7 +20,7 @@ our $VERSION = '1.4.6';
# @param $portal Lemonldap::NG::Portal::Simple object
# @return new Lemonldap::NG::Portal::_Multi object
sub new {
my ( $class, $portal ) = splice @_;
my ( $class, $portal ) = @_;
my $self = bless { p => $portal, res => PE_NOSCHEME }, $class;
weaken $self->{p};
@ -65,7 +65,7 @@ sub new {
# @param type 0 for authentication, 1 for userDB
# @return Lemonldap::NG::Portal error code returned by method $sub
sub try {
my ( $self, $sub, $type ) = splice @_;
my ( $self, $sub, $type ) = @_;
my $res;
my $s = $self->{stack}->[$type]->[0]->{m} . "::$sub";
my $old = $self->{stack}->[$type]->[0]->{n};
@ -110,7 +110,7 @@ sub try {
# @param type 0 for authentication, 1 for userDB
# return true if an other module is available
sub next {
my ( $self, $type ) = splice @_;
my ( $self, $type ) = @_;
if ( $self->{stack}->[$type]->[0]->{n} eq
$self->{stack}->[ 1 - $type ]->[0]->{n}
@ -135,7 +135,7 @@ sub next {
# @param $sub name of the method who has failed
# @return Lemonldap::NG::Portal error code
sub replay {
my ( $self, $sub ) = splice @_;
my ( $self, $sub ) = @_;
my @subs = ();
$self->{p}->lmLog( "Replay all methods until sub $sub", 'debug' );

@ -32,7 +32,7 @@ BEGIN {
# @param no_cache Disable cache use
# @return boolean result
sub loadOPs {
my ( $self, $no_cache ) = splice @_;
my ( $self, $no_cache ) = @_;
# Check cache
unless ($no_cache) {
@ -70,7 +70,7 @@ sub loadOPs {
# @param no_cache Disable cache use
# @return boolean result
sub loadRPs {
my ( $self, $no_cache ) = splice @_;
my ( $self, $no_cache ) = @_;
# Check cache
unless ($no_cache) {
@ -100,7 +100,7 @@ sub loadRPs {
# @param no_cache Disable cache update
# @return boolean result
sub refreshJWKSdata {
my ( $self, $no_cache ) = splice @_;
my ( $self, $no_cache ) = @_;
unless ( $self->{oidcOPMetaDataJSON}
and keys %{ $self->{oidcOPMetaDataJSON} } )
@ -171,7 +171,7 @@ sub refreshJWKSdata {
# @param client_id Client ID
# @return String result
sub getRP {
my ( $self, $client_id ) = splice @_;
my ( $self, $client_id ) = @_;
my $rp;
foreach ( keys %{ $self->{_oidcRPList} } ) {
@ -218,7 +218,7 @@ sub getCallbackUri {
# @param state State
# return String Authentication Request URI
sub buildAuthorizationCodeAuthnRequest {
my ( $self, $op, $state ) = splice @_;
my ( $self, $op, $state ) = @_;
my $authorize_uri =
$self->{_oidcOPList}->{$op}->{conf}->{authorization_endpoint};
@ -288,7 +288,7 @@ sub buildAuthorizationCodeAuthnRequest {
# @param session_state Session state
# return String Authentication Response URI
sub buildAuthorizationCodeAuthnResponse {
my ( $self, $redirect_uri, $code, $state, $session_state ) = splice @_;
my ( $self, $redirect_uri, $code, $state, $session_state ) = @_;
my $response_url = $redirect_uri;
@ -319,7 +319,7 @@ sub buildAuthorizationCodeAuthnResponse {
sub buildImplicitAuthnResponse {
my ( $self, $redirect_uri, $access_token, $id_token, $expires_in, $state,
$session_state )
= splice @_;
= @_;
my $response_url = $redirect_uri;
@ -359,7 +359,7 @@ sub buildHybridAuthnResponse {
my (
$self, $redirect_uri, $code, $access_token,
$id_token, $expires_in, $state, $session_state
) = splice @_;
) = @_;
my $response_url = $redirect_uri;
@ -396,7 +396,7 @@ sub buildHybridAuthnResponse {
# @param auth_method Authentication Method
# return String Token response decoded content
sub getAuthorizationCodeAccessToken {
my ( $self, $op, $code, $auth_method ) = splice @_;
my ( $self, $op, $code, $auth_method ) = @_;
my $client_id =
$self->{oidcOPMetaDataOptions}->{$op}->{oidcOPMetaDataOptionsClientID};
@ -454,7 +454,7 @@ sub getAuthorizationCodeAccessToken {
# @param json JSON HashRef
# return boolean 1 if the response is valid, 0 else
sub checkTokenResponseValidity {
my ( $self, $json ) = splice @_;
my ( $self, $json ) = @_;
# token_type MUST be Bearer
unless ( $json->{token_type} eq "Bearer" ) {
@ -479,7 +479,7 @@ sub checkTokenResponseValidity {
# @param id_token ID Token payload as HashRef
# return boolean 1 if the token is valid, 0 else
sub checkIDTokenValidity {
my ( $self, $op, $id_token ) = splice @_;
my ( $self, $op, $id_token ) = @_;
my $client_id =
$self->{oidcOPMetaDataOptions}->{$op}->{oidcOPMetaDataOptionsClientID};
@ -601,7 +601,7 @@ sub checkIDTokenValidity {
# @param access_token Access Token
# return String UserInfo response decoded content
sub getUserInfo {
my ( $self, $op, $access_token ) = splice @_;
my ( $self, $op, $access_token ) = @_;
my $userinfo_uri = $self->{_oidcOPList}->{$op}->{conf}->{userinfo_endpoint};
@ -640,7 +640,7 @@ sub getUserInfo {
# @param json JSON raw content
# @return HashRef JSON decoded content
sub decodeJSON {
my ( $self, $json ) = splice @_;
my ( $self, $json ) = @_;
my $json_hash;
eval { $json_hash = decode_json $json; };
@ -658,7 +658,7 @@ sub decodeJSON {
# @param id session reference
# @return Lemonldap::NG::Common::Session object
sub getOpenIDConnectSession {
my ( $self, $id ) = splice @_;
my ( $self, $id ) = @_;
my $oidcSession = Lemonldap::NG::Common::Session->new(
{
@ -693,7 +693,7 @@ sub getOpenIDConnectSession {
# @param data Array of information to store
# @return State Session ID
sub storeState {
my ( $self, @data ) = splice @_;
my ( $self, @data ) = @_;
# check if there are data to store
my $infos;
@ -730,7 +730,7 @@ sub storeState {
# @param state state value
# @return result
sub extractState {
my ( $self, $state ) = splice @_;
my ( $self, $state ) = @_;
return 0 unless $state;
@ -762,7 +762,7 @@ sub extractState {
# @param jwt JWT raw value
# @return arrayref JWT parts
sub extractJWT {
my ( $self, $jwt ) = splice @_;
my ( $self, $jwt ) = @_;
my @jwt_parts = split( /\./, $jwt );
@ -776,7 +776,7 @@ sub extractJWT {
# @param rp OpenIP Relying Party configuration key
# @return boolean 1 if signature is verified, 0 else
sub verifyJWTSignature {
my ( $self, $jwt, $op, $rp ) = splice @_;
my ( $self, $jwt, $op, $rp ) = @_;
$self->lmLog( "Verification of JWT signature: $jwt", 'debug' );
@ -938,7 +938,7 @@ sub verifyJWTSignature {
# @param id_token ID Token
# @return boolean 1 if hash is verified, 0 else
sub verifyHash {
my ( $self, $value, $hash, $id_token ) = splice @_;
my ( $self, $value, $hash, $id_token ) = @_;
$self->lmLog( "Verification of value $value with hash $hash", 'debug' );
@ -992,7 +992,7 @@ sub verifyHash {
# @param hash_level SHA Hash level
# @return String hash
sub createHash {
my ( $self, $value, $hash_level ) = splice @_;
my ( $self, $value, $hash_level ) = @_;
$self->lmLog( "Use SHA $hash_level to hash $value", 'debug' );
@ -1020,7 +1020,7 @@ sub createHash {
sub returnRedirectError {
my ( $self, $redirect_url, $error, $error_description, $error_uri, $state,
$fragment )
= splice @_;
= @_;
my $urldc = $redirect_url;
@ -1048,7 +1048,7 @@ sub returnRedirectError {
# @param error Error message
# @return void
sub returnJSONError {
my ( $self, $error ) = splice @_;
my ( $self, $error ) = @_;
my $content = { "error" => "$error" };
# We use to_json because values are already UTF-8 encoded
@ -1065,7 +1065,7 @@ sub returnJSONError {
# @param content Message
# @return void
sub returnJSON {
my ( $self, $content ) = splice @_;
my ( $self, $content ) = @_;
# We use to_json because values are already UTF-8 encoded
my $json = to_json( $content, { pretty => 1 } );
@ -1082,7 +1082,7 @@ sub returnJSON {
# @param error_message Error message
# @return void
sub returnBearerError {
my ( $self, $error_code, $error_message ) = splice @_;
my ( $self, $error_code, $error_message ) = @_;
my $content = "error=$error_code,error_description=$error_message";
@ -1136,7 +1136,7 @@ sub getEndPointAccessToken {
# @param claim Claim
# @return arrayref attributes list
sub getAttributesListFromClaim {
my ( $self, $rp, $claim ) = splice @_;
my ( $self, $rp, $claim ) = @_;
my $attributes = {};
# OpenID Connect standard claims
@ -1170,7 +1170,7 @@ sub getAttributesListFromClaim {
# @param user_session_id User session identifier
# @return hashref UserInfo data
sub buildUserInfoResponse {
my ( $self, $scope, $rp, $user_session_id ) = splice @_;
my ( $self, $scope, $rp, $user_session_id ) = @_;
my $userinfo_response = {};
# Get user identifier
@ -1225,7 +1225,7 @@ sub buildUserInfoResponse {
# @param rp Internal Relying Party identifier
# @return String jwt JWT
sub createJWT {
my ( $self, $payload, $alg, $rp ) = splice @_;
my ( $self, $payload, $alg, $rp ) = @_;
# Payload encoding
my $jwt_payload = encode_base64( encode_json($payload), "" );
@ -1307,7 +1307,7 @@ sub createJWT {
# @param rp Internal Relying Party identifier
# @return String id_token ID Token as JWT
sub createIDToken {
my ( $self, $payload, $rp ) = splice @_;
my ( $self, $payload, $rp ) = @_;
# Get signature algorithm
my $alg =
@ -1323,7 +1323,7 @@ sub createIDToken {
# @param response_type Response type
# @return String flow
sub getFlowType {
my ( $self, $response_type ) = splice @_;
my ( $self, $response_type ) = @_;
my $response_types = {
"code" => "authorizationcode",
@ -1342,7 +1342,7 @@ sub getFlowType {
# @param id_token ID Token
# @return String sub
sub getIDTokenSub {
my ( $self, $id_token ) = splice @_;
my ( $self, $id_token ) = @_;
my $payload = $self->getJWTJSONData($id_token);
@ -1354,7 +1354,7 @@ sub getIDTokenSub {
# @param jwt JWT
# @return HashRef payload
sub getJWTJSONData {
my ( $self, $jwt ) = splice @_;
my ( $self, $jwt ) = @_;
my $jwt_parts = $self->extractJWT($jwt);
return decode_json( decode_base64url( $jwt_parts->[1] ) );
@ -1365,7 +1365,7 @@ sub getJWTJSONData {
# @param key Raw key
# @return HashRef JWKS key
sub key2jwks {
my ( $self, $key ) = splice @_;
my ( $self, $key ) = @_;
my $hash = {};
my $rsa_pub = Crypt::OpenSSL::RSA->new_public_key($key);
@ -1386,7 +1386,7 @@ sub key2jwks {
sub buildLogoutRequest {
my ( $self, $redirect_uri, $id_token_hint, $post_logout_redirect_uri,
$state )
= splice @_;
= @_;
my $response_url = $redirect_uri;
@ -1415,7 +1415,7 @@ sub buildLogoutRequest {
# @param state State
# return String Logout URI
sub buildLogoutResponse {
my ( $self, $redirect_uri, $state ) = splice @_;
my ( $self, $redirect_uri, $state ) = @_;
my $response_url = $redirect_uri;
@ -1433,7 +1433,7 @@ sub buildLogoutResponse {
# @param client_id CLient ID
# return String Session state
sub createSessionState {
my ( $self, $session_id, $client_id ) = splice @_;
my ( $self, $session_id, $client_id ) = @_;
my $salt = encode_base64url( $self->{cipher}->encrypt($client_id) );
my $data = $client_id . " " . $session_id . " " . $salt;
@ -1453,7 +1453,7 @@ sub createSessionState {
# @param request_uri request uri
# return String request JWT
sub getRequestJWT {
my ( $self, $request_uri ) = splice @_;
my ( $self, $request_uri ) = @_;
my $response = $self->ua->get($request_uri);
@ -1469,7 +1469,7 @@ sub getRequestJWT {
# Create JS code needed on OP side to manage session
# return String JS code
sub getSessionManagementOPIFrameJS {
my ($self) = splice @_;
my ($self) = @_;
my $js;

@ -122,7 +122,7 @@ sub loadLasso {
# @param no_cache Disable cache use
# @return boolean result
sub loadService {
my ( $self, $no_cache ) = splice @_;
my ( $self, $no_cache ) = @_;
# Load Lasso
return 0 unless $self->loadLasso();
@ -200,7 +200,7 @@ sub loadService {
# @param no_cache Disable cache use
# @return boolean result
sub loadIDPs {
my ( $self, $no_cache ) = splice @_;
my ( $self, $no_cache ) = @_;
# Check if SAML service is loaded
return 0 unless $self->{_lassoServer};
@ -298,7 +298,7 @@ sub loadIDPs {
# @param no_cache Disable cache use
# @return boolean result
sub loadSPs {
my ( $self, $no_cache ) = splice @_;
my ( $self, $no_cache ) = @_;
# Check if SAML service is loaded
return 0 unless $self->{_lassoServer};
@ -399,7 +399,7 @@ sub loadSPs {
# @return ( $request, $response, $method, $relaystate, $artifact )
sub checkMessage {
my ( $self, $url, $request_method, $content_type, $profile_type ) =
splice @_;
@_;
$profile_type ||= "login";
my ( $request, $response, $message, $method, $relaystate, $artifact );
@ -561,7 +561,7 @@ sub checkMessage {
# @param level optional log level (debug by default)
# @return 1 if no error
sub checkLassoError {
my ( $self, $error, $level ) = splice @_;
my ( $self, $error, $level ) = @_;
$level ||= 'debug';
# If $error is not a Lasso::Error object, display error string
@ -594,7 +594,7 @@ sub checkLassoError {
sub createServer {
my ( $self, $metadata, $private_key, $private_key_password,
$private_key_enc, $private_key_enc_password, $certificate )
= splice @_;
= @_;
my $server;
eval {
@ -624,7 +624,7 @@ sub createServer {
# @param ca_cert_chain optional ca cert chain
# @return boolean result
sub addIDP {
my ( $self, $server, $metadata, $public_key, $ca_cert_chain ) = splice @_;
my ( $self, $server, $metadata, $public_key, $ca_cert_chain ) = @_;
return 0 unless ( $server->isa("Lasso::Server") and defined $metadata );
@ -640,7 +640,7 @@ sub addIDP {
# @param ca_cert_chain optional ca cert chain
# @return boolean result
sub addSP {
my ( $self, $server, $metadata, $public_key, $ca_cert_chain ) = splice @_;
my ( $self, $server, $metadata, $public_key, $ca_cert_chain ) = @_;
return 0 unless ( $server->isa("Lasso::Server") and defined $metadata );
@ -656,7 +656,7 @@ sub addSP {
# @param ca_cert_chain optional ca cert chain
# @return boolean result
sub addAA {
my ( $self, $server, $metadata, $public_key, $ca_cert_chain ) = splice @_;
my ( $self, $server, $metadata, $public_key, $ca_cert_chain ) = @_;
return 0 unless ( $server->isa("Lasso::Server") and defined $metadata );
@ -675,7 +675,7 @@ sub addAA {
# @return boolean result
sub addProvider {
my ( $self, $server, $role, $metadata, $public_key, $ca_cert_chain ) =
splice @_;
@_;
return 0
unless ( $server->isa("Lasso::Server")
@ -697,7 +697,7 @@ sub addProvider {
#@param idp entity ID
#@return string organization name
sub getOrganizationName {
my ( $self, $server, $idp ) = splice @_;
my ( $self, $server, $idp ) = @_;
my ( $provider, $node );
# Get provider from server
@ -774,7 +774,7 @@ sub createAuthnRequest {
$method, $forceAuthn, $isPassive,
$nameIDFormat, $allowProxiedAuthn, $signSSOMessage,
$requestedAuthnContext
) = splice @_;
) = @_;
my $proxyCount;
my $proxyRequestedAuthnContext;
@ -947,7 +947,7 @@ sub createAuthnRequest {
# @param dump optional XML dump
# @return Lasso::Login object
sub createLogin {
my ( $self, $server, $dump ) = splice @_;
my ( $self, $server, $dump ) = @_;
my $login;
if ($dump) {
@ -972,7 +972,7 @@ sub createLogin {
# @param method HTTP method
# @return boolean result
sub initAuthnRequest {
my ( $self, $login, $idp, $method ) = splice @_;
my ( $self, $login, $idp, $method ) = @_;
eval { Lasso::Login::init_authn_request( $login, $idp, $method ); };
@ -985,7 +985,7 @@ sub initAuthnRequest {
# @param idp entityID
# @return boolean result
sub initIdpInitiatedAuthnRequest {
my ( $self, $login, $idp ) = splice @_;
my ( $self, $login, $idp ) = @_;
eval { Lasso::Login::init_idp_initiated_authn_request( $login, $idp ); };
@ -997,7 +997,7 @@ sub initIdpInitiatedAuthnRequest {
# @param login Lasso::Login
# @return boolean result
sub buildAuthnRequestMsg {
my ( $self, $login ) = splice @_;
my ( $self, $login ) = @_;
eval { Lasso::Login::build_authn_request_msg($login); };
@ -1010,7 +1010,7 @@ sub buildAuthnRequestMsg {
# @param request SAML request
# @return result
sub processAuthnRequestMsg {
my ( $self, $login, $request ) = splice @_;
my ( $self, $login, $request ) = @_;
eval { Lasso::Login::process_authn_request_msg( $login, $request ); };
@ -1024,7 +1024,7 @@ sub processAuthnRequestMsg {
# @param consent is consent obtained?
# @return result
sub validateRequestMsg {
my ( $self, $login, $auth, $consent ) = splice @_;
my ( $self, $login, $auth, $consent ) = @_;
eval { Lasso::Login::validate_request_msg( $login, $auth, $consent ); };
@ -1036,7 +1036,7 @@ sub validateRequestMsg {
# @param login Lasso::Login object
# @return boolean result
sub buildAuthnResponseMsg {
my ( $self, $login ) = splice @_;
my ( $self, $login ) = @_;
eval { Lasso::Login::build_authn_response_msg($login); };
@ -1049,7 +1049,7 @@ sub buildAuthnResponseMsg {
# @param method HTTP method
# @return boolean result
sub buildArtifactMsg {
my ( $self, $login, $method ) = splice @_;
my ( $self, $login, $method ) = @_;
eval { Lasso::Login::build_artifact_msg( $login, $method ); };
@ -1063,7 +1063,7 @@ sub buildArtifactMsg {
# @param notOnOrAfterTimeout Timeout to apply to notOnOrAfter
# @return boolean result
sub buildAssertion {
my ( $self, $login, $authn_context, $notOnOrAfterTimeout ) = splice @_;
my ( $self, $login, $authn_context, $notOnOrAfterTimeout ) = @_;
$notOnOrAfterTimeout ||= $self->{timeout};
# Dates
@ -1091,7 +1091,7 @@ sub buildAssertion {
# @param response SAML response
# @return result
sub processAuthnResponseMsg {
my ( $self, $login, $response ) = splice @_;
my ( $self, $login, $response ) = @_;
eval { Lasso::Login::process_authn_response_msg( $login, $response ); };
@ -1103,7 +1103,7 @@ sub processAuthnResponseMsg {
# @param profile Lasso::Profile object
# @return result or NULL if error
sub getNameIdentifier {
my ( $self, $profile ) = splice @_;
my ( $self, $profile ) = @_;
my $nameid;
eval { $nameid = Lasso::Profile::get_nameIdentifier($profile); };
@ -1121,7 +1121,7 @@ sub getNameIdentifier {
# @param dump optional Identity dump
# @return Lasso::Identity object
sub createIdentity {
my ( $self, $dump ) = splice @_;
my ( $self, $dump ) = @_;
my $identity;
if ($dump) {
@ -1144,7 +1144,7 @@ sub createIdentity {
# @param dump optional Session dump
# @return Lasso::Session object
sub createSession {
my ( $self, $dump ) = splice @_;
my ( $self, $dump ) = @_;
my $session;
if ($dump) {
@ -1167,7 +1167,7 @@ sub createSession {
# @param login Lasso::Login object
# @return result
sub acceptSSO {
my ( $self, $login ) = splice @_;
my ( $self, $login ) = @_;
eval { Lasso::Login::accept_sso($login); };
@ -1179,7 +1179,7 @@ sub acceptSSO {
# corresponding session_id
# @param infos HASH reference of information
sub storeRelayState {
my ( $self, @data ) = splice @_;
my ( $self, @data ) = @_;
# check if there are data to store
my $infos;
@ -1219,7 +1219,7 @@ sub storeRelayState {
# @param relaystate Relay state value
# @return result
sub extractRelayState {
my ( $self, $relaystate ) = splice @_;
my ( $self, $relaystate ) = @_;
return 0 unless $relaystate;
@ -1251,7 +1251,7 @@ sub extractRelayState {
# @param login Lasso::Login object
# @return assertion Lasso::Node object
sub getAssertion {
my ( $self, $login ) = splice @_;
my ( $self, $login ) = @_;
my $assertion;
eval { $assertion = Lasso::Login::get_assertion($login); };
@ -1276,7 +1276,7 @@ sub getAssertion {
# @return attribute value
sub getAttributeValue {
my ( $self, $name, $format, $friendly_name, $attributes, $force_utf8 ) =
splice @_;
@_;
my $value;
# Loop on attributes
@ -1317,7 +1317,7 @@ sub getAttributeValue {
# @param entityID relying party entity ID
# @return result
sub validateConditions {
my ( $self, $assertion, $entityID ) = splice @_;
my ( $self, $assertion, $entityID ) = @_;
my $tolerance = 10;
my $status;
@ -1369,7 +1369,7 @@ sub validateConditions {
# @param signSLOMessage sign request
# @return Lasso::Login object
sub createLogoutRequest {
my ( $self, $server, $session_dump, $method, $signSLOMessage ) = splice @_;
my ( $self, $server, $session_dump, $method, $signSLOMessage ) = @_;
my $session;
# Create Lasso Logout
@ -1422,7 +1422,7 @@ sub createLogoutRequest {
# @param dump optional XML dump
# @return Lasso::Logout object
sub createLogout {
my ( $self, $server, $dump ) = splice @_;
my ( $self, $server, $dump ) = @_;
my $logout;
if ($dump) {
@ -1447,7 +1447,7 @@ sub createLogout {
# @param method HTTP method
# @return result
sub initLogoutRequest {
my ( $self, $logout, $entityID, $method ) = splice @_;
my ( $self, $logout, $entityID, $method ) = @_;
eval { Lasso::Logout::init_request( $logout, $entityID, $method ); };
@ -1459,7 +1459,7 @@ sub initLogoutRequest {
# @param logout Lasso::Logout object
# @return result
sub buildLogoutRequestMsg {
my ( $self, $logout ) = splice @_;
my ( $self, $logout ) = @_;
eval { Lasso::Logout::build_request_msg($logout); };
@ -1472,7 +1472,7 @@ sub buildLogoutRequestMsg {
# @param dump Lasso::Session XML dump
# @return result
sub setSessionFromDump {
my ( $self, $profile, $dump ) = splice @_;
my ( $self, $profile, $dump ) = @_;
$self->lmLog( "Loading Session dump: $dump", 'debug' );
@ -1487,7 +1487,7 @@ sub setSessionFromDump {
# @param dump Lasso::Identity XML dump
# @return result
sub setIdentityFromDump {
my ( $self, $profile, $dump ) = splice @_;
my ( $self, $profile, $dump ) = @_;
eval { Lasso::Profile::set_identity_from_dump( $profile, $dump ); };
@ -1502,7 +1502,7 @@ sub setIdentityFromDump {
# @param full Return full URL instead of path
# @return url
sub getMetaDataURL {
my ( $self, $key, $index, $full ) = splice @_;
my ( $self, $key, $index, $full ) = @_;
$index = 3 unless defined $index;
$full = 0 unless defined $full;
@ -1531,7 +1531,7 @@ sub getMetaDataURL {
# @param response SAML response
# @return result
sub processLogoutResponseMsg {
my ( $self, $logout, $response ) = splice @_;
my ( $self, $logout, $response ) = @_;
eval { Lasso::Logout::process_response_msg( $logout, $response ); };
@ -1544,7 +1544,7 @@ sub processLogoutResponseMsg {
# @param request SAML request
# @return result
sub processLogoutRequestMsg {
my ( $self, $logout, $request ) = splice @_;
my ( $self, $logout, $request ) = @_;
# Process the request
eval { Lasso::Logout::process_request_msg( $logout, $request ); };
@ -1571,7 +1571,7 @@ sub processLogoutRequestMsg {
# @param logout Lasso::Logout object
# @return result
sub validateLogoutRequest {
my ( $self, $logout ) = splice @_;
my ( $self, $logout ) = @_;
eval { Lasso::Logout::validate_request($logout); };
@ -1583,7 +1583,7 @@ sub validateLogoutRequest {
# @param logout Lasso::Logout object
# @return boolean result
sub buildLogoutResponseMsg {
my ( $self, $logout ) = splice @_;
my ( $self, $logout ) = @_;
eval { Lasso::Logout::build_response_msg($logout); };
@ -1596,7 +1596,7 @@ sub buildLogoutResponseMsg {
# @param samlData Optional data to store
# @return result
sub storeReplayProtection {
my ( $self, $samlID, $samlData ) = splice @_;
my ( $self, $samlID, $samlData ) = @_;
my $samlSessionInfo = $self->getSamlSession();
@ -1627,7 +1627,7 @@ sub storeReplayProtection {
# @param samlID ID of initial SAML message
# @return result
sub replayProtection {
my ( $self, $samlID ) = splice @_;
my ( $self, $samlID ) = @_;
unless ($samlID) {
$self->lmLog( "Cannot verify replay because no SAML ID given",
@ -1685,7 +1685,7 @@ sub replayProtection {
# @param method HTTP method
# @return SAML message
sub resolveArtifact {
my ( $self, $profile, $artifact, $method ) = splice @_;
my ( $self, $profile, $artifact, $method ) = @_;
my $message;
# Login profile
@ -1730,7 +1730,7 @@ sub resolveArtifact {
# @param session_id Session ID
# @return result
sub storeArtifact {
my ( $self, $id, $message, $session_id ) = splice @_;
my ( $self, $id, $message, $session_id ) = @_;
my $samlSessionInfo = $self->getSamlSession();
@ -1758,7 +1758,7 @@ sub storeArtifact {
# @param id Artifact ID
# @return Artifact session content
sub loadArtifact {
my ( $self, $id ) = splice @_;
my ( $self, $id ) = @_;
my $art_session;
unless ($id) {
@ -1817,7 +1817,7 @@ sub loadArtifact {
# @param login Lasso::Login object
# @return Artifact response
sub createArtifactResponse {
my ( $self, $login ) = splice @_;
my ( $self, $login ) = @_;
my $artifact_id = $login->assertionArtifact();
@ -1885,7 +1885,7 @@ sub createArtifactResponse {
# @param request SAML request
# @return result
sub processArtRequestMsg {
my ( $self, $profile, $request ) = splice @_;
my ( $self, $profile, $request ) = @_;
# Login profile
if ( $profile->isa("Lasso::Login") ) {
@ -1904,7 +1904,7 @@ sub processArtRequestMsg {
# @param response SAML response
# @return result
sub processArtResponseMsg {
my ( $self, $profile, $response ) = splice @_;
my ( $self, $profile, $response ) = @_;
# Login profile
if ( $profile->isa("Lasso::Login") ) {
@ -1923,7 +1923,7 @@ sub processArtResponseMsg {
# @param message SOAP message
# @return SOAP response
sub sendSOAPMessage {
my ( $self, $endpoint, $message ) = splice @_;
my ( $self, $endpoint, $message ) = @_;
my $response;
my $request = HTTP::Request->new( 'POST' => $endpoint );
@ -1951,7 +1951,7 @@ sub sendSOAPMessage {
# @param server Lasso::Server object
# @return assertion query
sub createAssertionQuery {
my ( $self, $server ) = splice @_;
my ( $self, $server ) = @_;
my $query;
# Create assertion query
@ -1972,7 +1972,7 @@ sub createAssertionQuery {
# @param nameid Subject NameID
# @return attribute request
sub createAttributeRequest {
my ( $self, $server, $idp, $attributes, $nameid ) = splice @_;
my ( $self, $server, $idp, $attributes, $nameid ) = @_;
my $query;
# Create assertion query
@ -2051,7 +2051,7 @@ sub createAttributeRequest {
# @param query Lasso::AssertionQuery object
# @return result
sub validateAttributeRequest {
my ( $self, $query ) = splice @_;
my ( $self, $query ) = @_;
eval { Lasso::AssertionQuery::validate_request($query); };
@ -2064,7 +2064,7 @@ sub validateAttributeRequest {
# @param request Request content
# @return assertion query
sub processAttributeRequest {
my ( $self, $server, $request ) = splice @_;
my ( $self, $server, $request ) = @_;
my $query;
# Create assertion query
@ -2089,7 +2089,7 @@ sub processAttributeRequest {
# @param query Lasso::AssertionQuery object
# @return attribute response
sub buildAttributeResponse {
my ( $self, $query ) = splice @_;
my ( $self, $query ) = @_;
eval { Lasso::AssertionQuery::build_response_msg($query); };
@ -2107,7 +2107,7 @@ sub buildAttributeResponse {
# @param response Response content
# @return assertion query
sub processAttributeResponse {
my ( $self, $server, $response ) = splice @_;
my ( $self, $server, $response ) = @_;
my $query;
# Create assertion query
@ -2132,7 +2132,7 @@ sub processAttributeResponse {
# @param format configuration string
# @return SAML2 NameIDFormat string
sub getNameIDFormat {
my ( $self, $format ) = splice @_;
my ( $self, $format ) = @_;
return Lasso::Constants::SAML2_NAME_IDENTIFIER_FORMAT_UNSPECIFIED
if ( $format =~ /unspecified/i );
@ -2161,7 +2161,7 @@ sub getNameIDFormat {
# @param method configuration string
# @return Lasso HTTP Method integer
sub getHttpMethod {
my ( $self, $method ) = splice @_;
my ( $self, $method ) = @_;
return Lasso::Constants::HTTP_METHOD_POST
if ( $method =~ /^(http)?[-_]?post$/i );
@ -2182,7 +2182,7 @@ sub getHttpMethod {
# @param method Lasso HTTP Method
# @return method string
sub getHttpMethodString {
my ( $self, $method ) = splice @_;
my ( $self, $method ) = @_;
return "POST" if ( $method == Lasso::Constants::HTTP_METHOD_POST );
return "REDIRECT"
@ -2202,7 +2202,7 @@ sub getHttpMethodString {
# @param protocolType Lasso protocol type
# @return Lasso HTTP Method
sub getFirstHttpMethod {
my ( $self, $server, $entityID, $protocolType ) = splice @_;
my ( $self, $server, $entityID, $protocolType ) = @_;
my $entity_provider;
my $method;
@ -2234,7 +2234,7 @@ sub getFirstHttpMethod {
# @param profile Lasso profile object
# @return result
sub disableSignature {
my ( $self, $profile ) = splice @_;
my ( $self, $profile ) = @_;
eval {
Lasso::Profile::set_signature_hint( $profile,
@ -2249,7 +2249,7 @@ sub disableSignature {
# @param profile Lasso profile object
# @return result
sub forceSignature {
my ( $self, $profile ) = splice @_;
my ( $self, $profile ) = @_;
eval {
Lasso::Profile::set_signature_hint( $profile,
@ -2264,7 +2264,7 @@ sub forceSignature {
# @param profile Lasso profile object
# @return result
sub disableSignatureVerification {
my ( $self, $profile ) = splice @_;
my ( $self, $profile ) = @_;
eval {
Lasso::Profile::set_signature_verify_hint( $profile,
@ -2279,7 +2279,7 @@ sub disableSignatureVerification {
# @param profile Lasso profile object
# @return result
sub forceSignatureVerification {
my ( $self, $profile ) = splice @_;
my ( $self, $profile ) = @_;
eval {
Lasso::Profile::set_signature_verify_hint( $profile,
@ -2294,7 +2294,7 @@ sub forceSignatureVerification {
# @param context configuration string
# @return SAML2 AuthnContextClassRef string
sub getAuthnContext {
my ( $self, $context ) = splice @_;
my ( $self, $context ) = @_;
return Lasso::Constants::SAML2_AUTHN_CONTEXT_KERBEROS
if ( $context =~ /^kerberos$/i );
@ -2317,7 +2317,7 @@ sub getAuthnContext {
# @param timestamp UNIX timestamp
# @return SAML2 date
sub timestamp2samldate {
my ( $self, $timestamp ) = splice @_;
my ( $self, $timestamp ) = @_;
my @t = gmtime($timestamp);
my $samldate = strftime( "%Y-%m-%dT%TZ", @t );
@ -2333,7 +2333,7 @@ sub timestamp2samldate {
# @param samldate SAML2 date format
# @return UNIX timestamp
sub samldate2timestamp {
my ( $self, $samldate ) = splice @_;
my ( $self, $samldate ) = @_;
my ( $year, $mon, $mday, $hour, $min, $sec, $msec, $ztime ) = ( $samldate =~
/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d+)?(Z)?/ );
@ -2353,7 +2353,7 @@ sub samldate2timestamp {
# @param $method Method to use
# @return boolean False if failed.
sub sendLogoutResponseToServiceProvider {
my ( $self, $logout, $method ) = splice @_;
my ( $self, $logout, $method ) = @_;
# Logout response
unless ( $self->buildLogoutResponseMsg($logout) ) {
@ -2426,7 +2426,7 @@ sub sendLogoutResponseToServiceProvider {
# @return int Number of concerned providers.
sub sendLogoutRequestToProvider {
my ( $self, $logout, $providerID, $method, $relay, $relayState ) =
splice @_;
@_;
my $server = $self->{_lassoServer};
my $info;
@ -2686,7 +2686,7 @@ sub sendLogoutRequestToProvider {
# @param relayState Relay State for SLO status
# @return int Number of concerned providers.
sub sendLogoutRequestToProviders {
my ( $self, $logout, $relayState ) = splice @_;
my ( $self, $logout, $relayState ) = @_;
my $server = $self->{_lassoServer};
my $providersCount = 0;
my $info = '';
@ -2734,7 +2734,7 @@ sub sendLogoutRequestToProviders {
# @param profile Lasso::Profile object
# @return result
sub checkSignatureStatus {
my ( $self, $profile ) = splice @_;
my ( $self, $profile ) = @_;
eval { Lasso::Profile::get_signature_status($profile); };
@ -2746,7 +2746,7 @@ sub checkSignatureStatus {
# @param authnContext SAML authentication context
# return authentication level
sub authnContext2authnLevel {
my ( $self, $authnContext ) = splice @_;
my ( $self, $authnContext ) = @_;
return $self->{samlAuthnContextMapPassword}
if ( $authnContext eq $self->getAuthnContext("password") );
@ -2767,7 +2767,7 @@ sub authnContext2authnLevel {
# @param authnLevel internal authentication level
# return SAML authentication context
sub authnLevel2authnContext {
my ( $self, $authnLevel ) = splice @_;
my ( $self, $authnLevel ) = @_;
return $self->getAuthnContext("password")
if ( $authnLevel == $self->{samlAuthnContextMapPassword} );
@ -2788,7 +2788,7 @@ sub authnLevel2authnContext {
# @param url Requested URL
# @return Result
sub checkDestination {
my ( $self, $message, $url ) = splice @_;
my ( $self, $message, $url ) = @_;
my $destination;
# Read Destination
@ -2823,7 +2823,7 @@ sub checkDestination {
# @param id session reference
# @return Lemonldap::NG::Common::Session object
sub getSamlSession {
my ( $self, $id ) = splice @_;
my ( $self, $id ) = @_;
my $samlSession = Lemonldap::NG::Common::Session->new(
{
@ -2857,7 +2857,7 @@ sub getSamlSession {
# @param friendly_name optional Attribute friendly name
# @return SAML attribute
sub createAttribute {
my ( $self, $name, $format, $friendly_name ) = splice @_;
my ( $self, $name, $format, $friendly_name ) = @_;
my $attribute;
# Name is required
@ -2887,7 +2887,7 @@ sub createAttribute {
# @param value Value to store
# @return SAML attribute value
sub createAttributeValue {
my ( $self, $value ) = splice @_;
my ( $self, $value ) = @_;
my $saml2value;
# Value is required
@ -2925,7 +2925,7 @@ sub createAttributeValue {
# @param encryption_mode Encryption mode string
# @return Lasso encryption mode
sub getEncryptionMode {
my ( $self, $encryption_mode ) = splice @_;
my ( $self, $encryption_mode ) = @_;
return Lasso::Constants::ENCRYPTION_MODE_NAMEID
if ( $encryption_mode =~ /^nameid$/i );
@ -2940,7 +2940,7 @@ sub getEncryptionMode {
# @param encryption_mode Lasso encryption mode
# @return result
sub setProviderEncryptionMode {
my ( $self, $provider, $encryption_mode ) = splice @_;
my ( $self, $provider, $encryption_mode ) = @_;
eval {
Lasso::Provider::set_encryption_mode( $provider, $encryption_mode );
@ -2955,7 +2955,7 @@ sub setProviderEncryptionMode {
# @param session_id Primary session ID
# @return result
sub deleteSAMLSecondarySessions {
my ( $self, $session_id ) = splice @_;
my ( $self, $session_id ) = @_;
my $result = 1;
# Find SAML sessions
@ -3001,7 +3001,7 @@ sub deleteSAMLSecondarySessions {
# @param method HTTP method
# @return nothing
sub sendSLOErrorResponse {
my ( $self, $logout, $method ) = splice @_;
my ( $self, $logout, $method ) = @_;
# Load empty session
my $session =
@ -3020,7 +3020,7 @@ sub sendSLOErrorResponse {
# Return query string with or without CGI query_string() method
# @return query string
sub getQueryString {
my ($self) = splice @_;
my ($self) = @_;
my $query_string;

@ -33,7 +33,7 @@ sub gen_password {
# @param html optional set content type to HTML
# @return boolean result
sub send_mail {
my ( $self, $mail, $subject, $body, $html ) = splice @_;
my ( $self, $mail, $subject, $body, $html ) = @_;
# Set charset
my $charset = $self->{mailCharset} ? $self->{mailCharset} : "utf-8";
@ -132,7 +132,7 @@ sub send_mail {
# @param user the value of the user key in session
# @return the first session id found or nothing if no session
sub getMailSession {
my ( $self, $user ) = splice @_;
my ( $self, $user ) = @_;
my $moduleOptions = $self->{globalStorageOptions} || {};
$moduleOptions->{backend} = $self->{globalStorage};
@ -157,7 +157,7 @@ sub getMailSession {
# @param mail the value of the mail key in session
# @return the first session id found or nothing if no session
sub getRegisterSession {
my ( $self, $mail ) = splice @_;
my ( $self, $mail ) = @_;
my $moduleOptions = $self->{globalStorageOptions} || {};
$moduleOptions->{backend} = $self->{globalStorage};

@ -75,7 +75,7 @@ _RETURN $getCookiesResponse Response
#@param sessionid optional session identifier
#@return session => { error => code , cookies => { cookieName1 => value ,... } }
sub getCookies {
my ( $self, $user, $password, $sessionid ) = splice @_;
my ( $self, $user, $password, $sessionid ) = @_;
$self->lmLog( "SOAP authentication request for $user", 'debug' );
$self->{user} = $user;
@ -137,7 +137,7 @@ _RETURN $getAttributesResponse Response
# @param $id Cookie value
# @return SOAP::Data sequence
sub getAttributes {
my ( $self, $id ) = splice @_;
my ( $self, $id ) = @_;
die 'id is required' unless ($id);
my $session = $self->getApacheSession( $id, 1 );
@ -168,7 +168,7 @@ sub getAttributes {
# @param $args datas to store
# @return true if succeed
sub setAttributes {
my ( $self, $id, $args ) = splice @_;
my ( $self, $id, $args ) = @_;
die 'id is required' unless ($id);
my $session = $self->getApacheSession($id);
@ -213,7 +213,7 @@ sub lastCfg {
# Store a new session.
# @return Session datas
sub newSession {
my ( $self, $args ) = splice @_;
my ( $self, $args ) = @_;
my $session = $self->getApacheSession();
@ -241,7 +241,7 @@ sub newSession {
## @method SOAP::Data deleteSession()
# Deletes an existing session
sub deleteSession {
my ( $self, $id ) = splice @_;
my ( $self, $id ) = @_;
die('id parameter is required') unless ($id);
my $session = $self->getApacheSession($id);
@ -317,7 +317,7 @@ _RETURN $getMenuApplicationsResponse Response
# @param $id Id of the session
#@return SOAP::Data
sub getMenuApplications {
my ( $self, $id ) = splice @_;
my ( $self, $id ) = @_;
die 'id is required' unless ($id);
$self->lmLog( "SOAP getMenuApplications request for id $id", 'debug' );

@ -16,7 +16,7 @@ use utf8;
# @param $lang Array ref for 2-letters languages (e.g. ['es', 'fr'])
# @return Message string in the first matching language
sub msg {
my ( $msg, $lang ) = splice @_;
my ( $msg, $lang ) = @_;
foreach ( @{$lang} ) {
if ( __PACKAGE__->can("msg_$_") ) {
return &{"msg_$_"}->[$msg];
@ -30,7 +30,7 @@ sub msg {
# @param $lang Array ref for 2-letters languages (e.g. ['es', 'fr'])
# @return Error string in the first matching language
sub error {
my ( $error, $lang ) = splice @_;
my ( $error, $lang ) = @_;
$error = 0 if ( $error < 0 );
foreach ( @{$lang} ) {
if ( __PACKAGE__->can("error_$_") ) {

Loading…
Cancel
Save