Commit 0da228ff authored by Yadd's avatar Yadd
Browse files

make tidy

parent 585bf4a2
......@@ -140,7 +140,7 @@ sub purge {
return 0;
}
my $clause = ($force ? '' : '(description={done}*)');
my $clause = ( $force ? '' : '(description={done}*)' );
return $self->_delete( '(&(objectClass=applicationProcess)'
. "(description={uid}$u)"
. "(description={ref}$r)"
......
......@@ -41,7 +41,8 @@ sub retrieveSession {
my ( $class, $id ) = @_;
# First check if session already exists
return 1 if ( $class->Lemonldap::NG::Handler::Main::Run::retrieveSession($id) );
return 1
if ( $class->Lemonldap::NG::Handler::Main::Run::retrieveSession($id) );
# Then ask portal to create it
if ( $class->createSession($id) ) {
......@@ -115,7 +116,8 @@ sub hideCookie {
sub goToPortal {
my ( $class, $url, $arg ) = @_;
if ($arg) {
return $class->Lemonldap::NG::Handler::Main::Run::goToPortal( $url, $arg );
return $class->Lemonldap::NG::Handler::Main::Run::goToPortal( $url,
$arg );
}
else {
$class->set_header_out(
......
......@@ -1013,17 +1013,18 @@ sub applyConf {
# Parse apply values
while ( my ( $host, $request ) = each %reloadUrls ) {
my $r = HTTP::Request->new( 'GET', "http://$host$request");
if ($request =~ /^https?:\/\/[^\/]+.*$/) {
my $r = HTTP::Request->new( 'GET', "http://$host$request" );
if ( $request =~ /^https?:\/\/[^\/]+.*$/ ) {
my $url = URI::URL->new($request);
my $targetUrl = $url->scheme."://".$host;
$targetUrl .= ":".$url->port if defined ($url->port);
my $targetUrl = $url->scheme . "://" . $host;
$targetUrl .= ":" . $url->port if defined( $url->port );
$targetUrl .= $url->full_path;
$r =
HTTP::Request->new( 'GET', $targetUrl,
HTTP::Headers->new( Host => $url->host ) );
if (defined $url->userinfo && $url->userinfo =~/^([^:]+):(.*)$/) {
$r->authorization_basic($1,$2);
if ( defined $url->userinfo && $url->userinfo =~ /^([^:]+):(.*)$/ )
{
$r->authorization_basic( $1, $2 );
}
}
......
......@@ -280,8 +280,8 @@ sub newNotification {
) . ">$json->{xml}</notification></root>";
unless ( eval { $self->notifAccess->newNotification($newNotif) } ) {
$self->lmLog( "Notification not created: $@", 'error');
return $self->sendError( $req, "Notification not created: $@", 200);
$self->lmLog( "Notification not created: $@", 'error' );
return $self->sendError( $req, "Notification not created: $@", 200 );
}
else {
return $self->sendJSONresponse( $req, { result => 1 } );
......@@ -337,8 +337,9 @@ sub deleteDoneNotification {
my ( $uid, $ref, $date ) = ( $id =~ /([^_]+?)_([^_]+?)_(.+)/ );
my $identifier = $self->notifAccess->getIdentifier( $uid, $ref, $date );
unless ( eval { $self->notifAccess->purge($identifier) } ) {
$self->lmLog( "Notification $identifier not purged ($@)", 'warn');
return $self->sendError( $req, "Notification $identifier not purged ($@)", 400);
$self->lmLog( "Notification $identifier not purged ($@)", 'warn' );
return $self->sendError( $req,
"Notification $identifier not purged ($@)", 400 );
}
$self->lmLog( "Notification $identifier purged", 'info' );
......
......@@ -29,7 +29,14 @@ sub newSession {
);
count(1);
$tmp->update(
{ ipAddr => $ip, _whatToTrace => $uid, uid => $uid, _utime => time, _session_kind => 'SSO' } );
{
ipAddr => $ip,
_whatToTrace => $uid,
uid => $uid,
_utime => time,
_session_kind => 'SSO'
}
);
return $tmp->{id};
}
......
......@@ -35,7 +35,8 @@ sub authenticate {
sub setAuthSessionInfo {
my ( $self, $req ) = @_;
$req->{sessionInfo}->{authenticationLevel} = $self->conf->{apacheAuthnLevel};
$req->{sessionInfo}->{authenticationLevel} =
$self->conf->{apacheAuthnLevel};
PE_OK;
}
......
......@@ -135,9 +135,11 @@ sub authenticate {
sub setAuthSessionInfo {
my ( $self, $req ) = @_;
$req->{sessionInfo}->{authenticationLevel} = $self->conf->{browserIdAuthnLevel};
$req->{sessionInfo}->{authenticationLevel} =
$self->conf->{browserIdAuthnLevel};
$req->{sessionInfo}->{_browserIdAnswer} = $self->conf->{browserIdAnswer};
$req->{sessionInfo}->{_browserIdAnswerRaw} = $self->conf->{browserIdAnswerRaw};
$req->{sessionInfo}->{_browserIdAnswerRaw} =
$self->conf->{browserIdAnswerRaw};
PE_OK;
}
......
......@@ -121,7 +121,8 @@ sub authenticate {
sub setAuthSessionInfo {
my ( $self, $req ) = @_;
$req->{sessionInfo}->{authenticationLevel} = $self->conf->{facebookAuthnLevel};
$req->{sessionInfo}->{authenticationLevel} =
$self->conf->{facebookAuthnLevel};
PE_OK;
}
......
......@@ -81,7 +81,8 @@ sub extractFormInfo {
# Forward hidden fields
if ( exists $self->{portalHiddenFormValues} ) {
$self->lmLog( "Add hidden values to Twitter redirect URL", 'debug' );
$self->lmLog( "Add hidden values to Twitter redirect URL",
'debug' );
foreach ( keys %{ $self->{portalHiddenFormValues} } ) {
$callback_url .=
......
......@@ -66,7 +66,8 @@ sub computeGetParams {
my $value =
eval { uri_escape( $req->{sessionInfo}->{ $prms->{$param} } ) };
if ($@) {
$self->lmLog( "IssuerGet: unable to compute $param ($@)", 'error' );
$self->lmLog( "IssuerGet: unable to compute $param ($@)",
'error' );
return;
}
$value =~ s/[\r\n\t]//;
......
......@@ -21,7 +21,9 @@ sub init {
my ( $self, $type ) = @_;
$self->type($type);
unless( $self->conf->{authChoiceModules} and %{ $self->conf->{authChoiceModules} } ) {
unless ( $self->conf->{authChoiceModules}
and %{ $self->conf->{authChoiceModules} } )
{
$self->error("'authChoiceModules' is empty");
return 0;
}
......
......@@ -53,7 +53,7 @@ sub init {
sub _redirect {
my ( $self, $req, @path ) = @_;
$self->lmLog('Processing _redirect','debug');
$self->lmLog( 'Processing _redirect', 'debug' );
my $prms = $req->params;
foreach my $k ( keys %$prms ) {
$self->p->setHiddenFormValue( $req, $k, $prms->{$k}, '', 0 );
......@@ -92,7 +92,7 @@ sub _pRedirect {
# Case 3: authentified user, launch
sub _forAuthUser {
my ( $self, $req, @path ) = @_;
$self->lmLog('Processing _forAuthUser','debug');
$self->lmLog( 'Processing _forAuthUser', 'debug' );
return $self->p->do(
$req,
[
......
......@@ -138,8 +138,7 @@ sub deleteSession {
return PE_ERROR;
}
else {
$self->lmLog( "Session $id deleted from global storage",
'debug' );
$self->lmLog( "Session $id deleted from global storage", 'debug' );
}
# TODO
......
......@@ -22,7 +22,7 @@ has vars => (
sub init {
my ($self) = @_;
unless ( $self->p->getModule(undef,'auth') =~ /^Facebook/ ) {
unless ( $self->p->getModule( undef, 'auth' ) =~ /^Facebook/ ) {
$self->error(
"UserDBFacebook isn't useable unless authentication module is set to Facebook"
);
......
......@@ -4,7 +4,7 @@ use strict;
use Mouse;
use Lemonldap::NG::Portal::Main::Constants 'PE_OK';
extends 'Lemonldap::NG::Common::Module','Lemonldap::NG::Portal::Lib::Proxy';
extends 'Lemonldap::NG::Common::Module', 'Lemonldap::NG::Portal::Lib::Proxy';
our $VERSION = '2.0.0';
......
......@@ -6,8 +6,7 @@ use Lemonldap::NG::Portal::Main::Constants qw(PE_OK);
our $VERSION = '2.0.0';
extends 'Lemonldap::NG::Common::Module',
'Lemonldap::NG::Portal::Lib::Remote';
extends 'Lemonldap::NG::Common::Module', 'Lemonldap::NG::Portal::Lib::Remote';
# RUNNING METHODS
......
......@@ -22,14 +22,14 @@ sub init {
my ($self) = @_;
unless ( $self->p->getModule( undef, 'auth' ) =~ /^SAML/ ) {
$self->error(
"SAML user module requires SAML authentication"
);
$self->error( "SAML user module requires SAML authentication" );
return 0;
}
# SAML service has been already loaded
$self->lassoServer($self->p->loadedModules->{'Lemonldap::NG::Portal::Auth::SAML'}->lassoServer);
$self->lassoServer(
$self->p->loadedModules->{'Lemonldap::NG::Portal::Auth::SAML'}
->lassoServer );
return 1;
}
......@@ -57,18 +57,21 @@ sub setSessionInfo {
# Get all required attributes, not already set
# in setAuthSessionInfo()
foreach (
keys %{ $self->conf->{samlIDPMetaDataExportedAttributes}->{$idpConfKey} } )
keys %{ $self->conf->{samlIDPMetaDataExportedAttributes}->{$idpConfKey}
} )
{
# Extract fields from exportedAttr value
my ( $mandatory, $name, $format, $friendly_name ) =
split( /;/,
$self->conf->{samlIDPMetaDataExportedAttributes}->{$idpConfKey}->{$_} );
$self->conf->{samlIDPMetaDataExportedAttributes}->{$idpConfKey}
->{$_} );
# Keep mandatory attributes not sent in authentication response
if ( $mandatory and not defined $req->{sessionInfo}->{$_} ) {
$exportedAttr->{$_} =
$self->conf->{samlIDPMetaDataExportedAttributes}->{$idpConfKey}->{$_};
$self->conf->{samlIDPMetaDataExportedAttributes}->{$idpConfKey}
->{$_};
$self->lmLog( "Attribute $_ will be requested to $idpConfKey",
'debug' );
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment