Commit a865cea0 authored by Xavier Guimard's avatar Xavier Guimard

Little change (#595)

parent cc0f19b0
......@@ -129,7 +129,7 @@
.\" ========================================================================
.\"
.IX Title "llng-fastcgi-server 1"
.TH llng-fastcgi-server 1 "2017-01-09" "perl v5.24.1" "User Contributed Perl Documentation"
.TH llng-fastcgi-server 1 "2017-01-24" "perl v5.24.1" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
......
......@@ -597,7 +597,7 @@ sub extractFormInfo {
my $real_session = $sessionInfo->data->{_saml_id};
my $ssoSession =
$self->p->getApacheSession( $real_session, 1 );
$self->p->getApacheSession($real_session);
# Import SSO session in $req
$self->importRealSession( $req, $ssoSession );
......
......@@ -211,7 +211,7 @@ sub run {
$self->deleteCasSecondarySessions($session_id);
# Delete local session
if ( my $session = $self->p->getApacheSession( $session_id, 1 ) ) {
if ( my $session = $self->p->getApacheSession($session_id) ) {
unless ( $self->p->_deleteSession( $req, $session ) ) {
$self->lmLog( "Fail to delete session $session_id ", 'error' );
}
......@@ -395,7 +395,7 @@ sub validate {
# Open local session
my $localSession =
$self->p->getApacheSession( $casServiceSession->data->{_cas_id}, 1 );
$self->p->getApacheSession( $casServiceSession->data->{_cas_id} );
unless ($localSession) {
$self->lmLog(
......@@ -618,7 +618,7 @@ sub _validate2 {
# Open local session
my $localSession =
$self->p->getApacheSession( $casServiceSession->data->{_cas_id}, 1 );
$self->p->getApacheSession( $casServiceSession->data->{_cas_id} );
unless ($localSession) {
$self->lmLog(
......
......@@ -914,7 +914,8 @@ sub token {
# Get user identifier
my $apacheSession =
$self->p->getApacheSession( $codeSession->data->{user_session_id}, 1 );
$self->p->getApacheSession( $codeSession->data->{user_session_id},
noInfo => 1 );
unless ($apacheSession) {
$self->lmLog(
......
......@@ -881,7 +881,8 @@ sub run {
: '?url=' . $cdc_idp
);
my $cdc_iframe = qq'<iframe src="$cdc_writer_url"'
my $cdc_iframe =
qq'<iframe src="$cdc_writer_url"'
. ' alt="Common Dommain Cookie" marginwidth="0"'
. ' marginheight="0" scrolling="no" class="hiddenFrame"'
. ' width="0" height="0" frameborder="0"></iframe>';
......@@ -1112,7 +1113,7 @@ sub soapSloServer {
);
# Open local session
my $local_session = $self->p->getApacheSession( $local_session_id, 1 );
my $local_session = $self->p->getApacheSession($local_session_id);
unless ($local_session) {
return $self->p->sendError( $req, "No local session found", 400 );
......@@ -1463,8 +1464,7 @@ sub sloServer {
unless ($session) {
# Open local session
my $local_session =
$self->p->getApacheSession( $local_session_id, 1 );
my $local_session = $self->p->getApacheSession($local_session_id);
unless ($local_session) {
$self->lmLog( "No local session found", 'error' );
......@@ -1693,7 +1693,7 @@ sub attributeServer {
$self->lmLog( "Retrieve real session $real_session for user $user",
'debug' );
$sessionInfo = $self->p->getApacheSession( $real_session, 1 );
$sessionInfo = $self->p->getApacheSession($real_session);
unless ($sessionInfo) {
return $self->p->sendError( $req,
......
......@@ -1112,7 +1112,7 @@ sub buildUserInfoResponse {
my $userinfo_response = {};
# Get user identifier
my $apacheSession = $self->p->getApacheSession( $user_session_id, 1 );
my $apacheSession = $self->p->getApacheSession($user_session_id);
unless ($apacheSession) {
$self->lmLog( "Unable to find user session", "error" );
......
......@@ -164,9 +164,7 @@ sub loadService {
# Create Lasso server with service metadata
my $server = $self->createServer(
$service_metadata->serviceToXML(
$self->conf
),
$service_metadata->serviceToXML( $self->conf ),
$self->conf->{samlServicePrivateKeySig},
$self->conf->{samlServicePrivateKeySigPwd},
......@@ -1822,7 +1820,7 @@ sub createArtifactResponse {
$self->lmLog( "Find session_id $session_id in artifact session",
'debug' );
my $session = $self->p->getApacheSession( $session_id, 1 );
my $session = $self->p->getApacheSession($session_id);
unless ($session) {
$self->lmLog( "Unable to open session $session_id", 'error' );
return;
......@@ -2498,7 +2496,8 @@ sub sendLogoutRequestToProvider {
# Redirect user to response URL
my $slo_url = $logout->msg_url;
$info .= qq'<tr><td><iframe src="$slo_url" alt="" marginwidth="0"'
$info .=
qq'<tr><td><iframe src="$slo_url" alt="" marginwidth="0"'
. ' marginheight="0" scrolling="no" class="noborder"'
. ' width="10px" height="10px" frameborder="0">'
. qq'</iframe></td><td>$providerName</td></tr>';
......@@ -2531,7 +2530,8 @@ sub sendLogoutRequestToProvider {
my $slo_url = $portal . '/saml/relaySingleLogoutPOST?relay=' . $relayID;
# Create iFrame
$info .= qq'<tr><td><iframe src="$slo_url" alt="" marginwidth="0"'
$info .=
qq'<tr><td><iframe src="$slo_url" alt="" marginwidth="0"'
. ' marginheight="0" scrolling="no" class="noborder"'
. ' width="10px" height="10px" frameborder="0">'
. qq'</iframe></td><td>$providerName</td></tr>';
......@@ -3012,7 +3012,8 @@ sub getQueryString {
my $query_string;
if ( $self->conf->{samlUseQueryStringSpecific} ) {
my @pairs = split( /&/, $req->param('issuerQuery') || $req->query_string );
my @pairs =
split( /&/, $req->param('issuerQuery') || $req->query_string );
$query_string = join( ';', @pairs );
}
......@@ -3035,7 +3036,7 @@ sub metadata {
my ( $self, $req ) = @_;
require Lemonldap::NG::Common::Conf::SAML::Metadata;
if ( my $metadata = Lemonldap::NG::Common::Conf::SAML::Metadata->new() ) {
my $s = $metadata->serviceToXML($self->conf);
my $s = $metadata->serviceToXML( $self->conf );
return [
200,
[
......
......@@ -153,7 +153,7 @@ sub getMailSession {
# Browse found sessions to check if it's a mail session
foreach my $id ( keys %$sessions ) {
my $mailSession = $self->p->getApacheSession( $id, 1 );
my $mailSession = $self->p->getApacheSession($id);
next unless ($mailSession);
return $id if ( $mailSession->data->{_type} =~ /^mail$/ );
}
......@@ -178,7 +178,7 @@ sub getRegisterSession {
# Browse found sessions to check if it's a register session
foreach my $id ( keys %$sessions ) {
my $registerSession = $self->p->getApacheSession( $id, 1 );
my $registerSession = $self->p->getApacheSession($id);
next unless ($registerSession);
return $id if ( $registerSession->data->{_type} =~ /^register$/ );
}
......
......@@ -406,7 +406,7 @@ sub store {
# Create second session for unsecure cookie
if ( $self->conf->{securedCookie} == 2 ) {
my $session2 = $self->getApacheSession( undef, 1 );
my $session2 = $self->getApacheSession(undef);
my %infos = %{ $req->{sessionInfo} };
$infos{_httpSessionType} = 1;
......@@ -417,7 +417,8 @@ sub store {
}
# Main session
my $session = $self->getApacheSession( $req->{id}, 0, $self->{force} );
my $session =
$self->getApacheSession( $req->{id}, force => $self->{force} );
return PE_APACHESESSIONERROR unless ($session);
$req->id( $session->{id} );
......
......@@ -234,21 +234,16 @@ sub autoRedirect {
}
# Try to recover the session corresponding to id and return session datas.
# If $id is set to undef or if $force is true, return a new session.
# @param id session reference
# @param noInfo do not set Apache REMOTE_USER
# @param force Force session creation if it does not exist
# @param kind Session kind
# return Lemonldap::NG::Common::Session object
# If $id is set to undef or if $args{force} is true, return a new session.
sub getApacheSession {
my ( $self, $id, $noInfo, $force, $kind ) = @_;
$kind ||= "SSO";
my ( $self, $id, %args ) = @_;
$args{kind} ||= "SSO";
if ($id) {
$self->lmLog( "Try to get $kind session $id", 'debug' );
$self->lmLog( "Try to get $args{kind} session $id", 'debug' );
}
else {
$self->lmLog( "Try to get a new $kind session", 'debug' );
$self->lmLog( "Try to get a new $args{kind} session", 'debug' );
}
my $as = Lemonldap::NG::Common::Session->new(
......@@ -258,8 +253,8 @@ sub getApacheSession {
cacheModule => $self->conf->{localSessionStorage},
cacheModuleOptions => $self->conf->{localSessionStorageOptions},
id => $id,
force => $force,
kind => $kind,
force => $args{force},
kind => $args{kind},
}
);
......@@ -269,8 +264,8 @@ sub getApacheSession {
return;
}
if ( $id and !$force and !$as->data ) {
$self->lmLog( "Session $kind $id not found", 'debug' );
if ( $id and !$args{force} and !$as->data ) {
$self->lmLog( "Session $args{kind} $id not found", 'debug' );
return;
}
......@@ -287,15 +282,11 @@ sub getApacheSession {
)
)
{
$self->lmLog( "Session $kind $id expired", 'debug' );
$self->lmLog( "Session $args{kind} $id expired", 'debug' );
return;
}
unless ($noInfo) {
$self->{id} = $as->id;
}
$self->lmLog( "Return $kind session " . $as->id, 'debug' );
$self->lmLog( "Return $args{kind} session " . $as->id, 'debug' );
return $as;
}
......@@ -396,7 +387,7 @@ sub updateSession {
}
# Update session in global storage
if ( my $apacheSession = $self->getApacheSession( $id, 1 ) ) {
if ( my $apacheSession = $self->getApacheSession($id) ) {
# Store updateTime
$infos->{updateTime} = strftime( "%Y%m%d%H%M%S", localtime() );
......@@ -427,7 +418,7 @@ sub _deleteSession {
if ( $self->conf->{securedCookie} == 2
and my $id2 = $session->data->{_httpSession} )
{
if ( my $session2 = $self->getApacheSession( $id2, 1 ) ) {
if ( my $session2 = $self->getApacheSession($id2) ) {
$session2->remove;
if ( $session2->error ) {
$self->lmLog( "Unable to remove linked session $id2",
......@@ -640,7 +631,7 @@ sub sendHtml {
# Set authorizated URL for POST
my $csp = $self->csp . "form-action 'self'";
if(my $url = $req->urldc) {
if ( my $url = $req->urldc ) {
$url =~ s#https?://([^/]+).*#$1#;
$csp .= " $url";
}
......
......@@ -26,8 +26,7 @@ sub changeUrldc {
$self->lmLog( 'CDA request', 'debug' );
# Create CDA session
if ( my $cdaSession =
$self->getApacheSession( undef, 1, undef, "CDA" ) )
if ( my $cdaSession = $self->getApacheSession( undef, kind => "CDA" ) )
{
my $cdaInfos = { '_utime' => time };
if ( $self->{conf}->{securedCookie} < 2 or $ssl ) {
......
......@@ -221,8 +221,7 @@ sub _register {
$self->lmLog( "Register session found: $register_session", 'debug' );
my $registerSessionObj =
$self->p->getApacheSession( $register_session, 1 );
my $registerSessionObj = $self->p->getApacheSession($register_session);
# Mail session expiration date
my $expTimestamp =
......
......@@ -206,7 +206,7 @@ sub getAttributes {
my ( $self, $req, $id ) = @_;
die 'id is required' unless ($id);
my $session = $self->p->getApacheSession( $id, 1 );
my $session = $self->p->getApacheSession($id);
my @tmp = ();
unless ($session) {
......@@ -378,7 +378,7 @@ sub isAuthorizedURI {
my ( $host, $uri ) = ( $1, $2 );
# Get user session.
my $session = $self->p->getApacheSession( $id, 1 );
my $session = $self->p->getApacheSession($id);
unless ($session) {
$self->lmLog( "Session $id does not exists", 'warn' );
......
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