View Issue Details

This bug affects 1 person(s).
 10
IDProjectCategoryView StatusLast Update
09225Bug reportsAuthenticationpublic2014-10-20 13:49
Reporterchettor Assigned ToDenisChenu  
PrioritynormalSeveritycrash 
Status closedResolutionfixed 
Product Version2.05+ 
Fixed in Version2.05+ 
Summary09225: Infite redirection loop with WebServer authentication de lagation
Description

Hi,

I'm trying to delagate authentication to the webserver with basic auth.
I enabled the webserver authentication plugin and ask for the REMOTE_USER.

Everything works, authenticated user can log in Limesurvey when they have an account in Limesurvey.
In the case where user is authenticated by the webserver but do not have a Limesurvey account, browser enter in an infinite redirect loop.

GET /index.php/admin/authentication/sa/login HTTP/1.1
Location: https://xxxxxxxx/index.php/admin/authentication/sa/login
GET /index.php/admin/authentication/sa/login HTTP/1.1
Location: https://xxxxxxxx/index.php/admin/authentication/sa/login
...
...

My Apache configuration about authentication is pretty simple :

<Location /index.php/admin/ >
AuthType basic
AuthName "Basic"
AuthUserFile /etc/httpd/user.passwd

Require valid-user
</Location>

Does anyone can help me ?

Thank You !

TagsNo tags attached.
Bug heat10
Complete LimeSurvey version number (& build)2.05+ Build 140911
I will donate to the project if issue is resolvedNo
BrowserAll
Database type & versionMySQL 5.1.73
Server OS (if known)Centos 6.5
Webserver software & version (if known)Apache 2.2.15
PHP Version5.3.3

Relationships

related to 09197 closedc_schmitz Cannot logout of limesurvey, it logs me in right away. 

Users monitoring this issue

minnoce

Activities

DenisChenu

DenisChenu

2014-09-12 13:36

developer   ~30602

Last edited: 2014-09-12 13:38

The problem : the user are connected with webserver THEN his connection in LimeSurvey is active.
Sorry : bad reading.

You're right, redirection don't have to be if auth by DB is active?

chettor

chettor

2014-09-15 08:44

reporter   ~30626

Don't think I understand your note perfectly but the expected behavior is :

1 - User connect to an Apache location protected by Auth (Basic, Auth_Cas...)

2 - Limesurvey get the REMOTE_USER variable

3a - If connected user has a Limesurvey account (login=REMOTE_USER), user access to LS interfaces. (Database auth in Limesurvey still exist but it don't check the password. Only the presence of the authenticated user in database)

3b - If user is authenticated by webserver but NOT présent in limesurvey, I expect a page like "You're not allowed to access to this page" or Something else. In my case, there is no page displaying after being authenticated by the webserver but I've got the redirection loop instead.

chettor

chettor

2014-09-15 11:00

reporter   ~30627

Here is a quick and (very!) dirt workaround (I'm not a PHP expert...) :


application/core/plugins/Authwebserver/Authwebserver.php

if (function_exists("hook_get_auth_webserver_profile"))
{
// If defined this function returns an array
// describing the default profile for this user
$aUserProfile = hook_get_auth_webserver_profile($sUser);
}
elseif ($this->api->getConfigKey('auth_webserver_autocreate_user'))
{
$aUserProfile=$this->api->getConfigKey('auth_webserver_autocreate_profile');
}else {

//QND WORKAROUND
$this->setAuthFailure(self::ERROR_USERNAME_INVALID);
return;
}


application/controllers/admin/authentication.php

// Failed
$message = $identity->errorMessage;
if (empty($message)) {
// If no message, return a default message
$clang = $this->getController()->lang;
$message = $clang->gT('Incorrect username and/or password!');
}
App()->user->setFlash('loginError', $message);
//QND WORKAROUND
print("<h1>You are not allowed to access this page</h1>");
die();
//$this->getController()->redirect(array('/admin/authentication/sa/login'));

DenisChenu

DenisChenu

2014-09-15 12:10

developer   ~30628

Hi,

Think best is:

  • User authenticate via webserver
    • User exist in LS DB : OK login
    • User don't exist in LS DB : show defaut LS form
  • User not authenticate via webserver
    • Show defaut LS form

:)

chettor

chettor

2014-09-15 12:12

reporter   ~30629

Yes, this behavior will be fine too.

DenisChenu

DenisChenu

2014-09-16 11:10

developer   ~30659

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&amp;id=14512

DenisChenu

DenisChenu

2014-09-16 11:13

developer   ~30660

Now show an 401 page. If you want to allow access with LimeSurvey DB You have to update the DB to set NULL for is_default key.

chettor

chettor

2014-09-16 11:30

reporter   ~30662

This patch perfectly match what I expected !

Thank you very much !

minnoce

minnoce

2014-10-07 16:44

reporter   ~30747

I'm still experiencing this issue with Limesurvey 2.05+ build141003

c_schmitz

c_schmitz

2014-10-20 13:49

administrator   ~30834

Version 2.05+ Build 141020 released

Related Changesets

LimeSurvey: master c164871a

2014-09-16 09:10:47

DenisChenu

Details Diff
Fixed issue 09225: Infite redirection loop with WebServer authentication
Dev: Add is_default settings, if user don't have access to LimeSurvey admin : throw a 401
Dev: If user don't have access to LS admin and is_default is unset : show AuthDB form
Dev: is_default is true by default
Affected Issues
09225
mod - application/core/plugins/Authwebserver/Authwebserver.php Diff File

Issue History

Date Modified Username Field Change
2014-09-12 11:28 chettor New Issue
2014-09-12 13:35 DenisChenu Relationship added duplicate of 09197
2014-09-12 13:36 DenisChenu Note Added: 30602
2014-09-12 13:37 DenisChenu Relationship deleted 09197
2014-09-12 13:37 DenisChenu Relationship added related to 09197
2014-09-12 13:38 DenisChenu Note Edited: 30602
2014-09-15 08:44 chettor Note Added: 30626
2014-09-15 11:00 chettor Note Added: 30627
2014-09-15 12:10 DenisChenu Note Added: 30628
2014-09-15 12:12 chettor Note Added: 30629
2014-09-16 10:46 DenisChenu Assigned To => DenisChenu
2014-09-16 10:46 DenisChenu Status new => assigned
2014-09-16 11:10 DenisChenu Changeset attached => LimeSurvey master c164871a
2014-09-16 11:10 DenisChenu Note Added: 30659
2014-09-16 11:10 DenisChenu Resolution open => fixed
2014-09-16 11:13 DenisChenu Note Added: 30660
2014-09-16 11:13 DenisChenu Status assigned => resolved
2014-09-16 11:13 DenisChenu Fixed in Version => 2.05+
2014-09-16 11:30 chettor Note Added: 30662
2014-10-07 16:44 minnoce Note Added: 30747
2014-10-09 12:57 minnoce Issue Monitored: minnoce
2014-10-20 13:49 c_schmitz Note Added: 30834
2014-10-20 13:49 c_schmitz Status resolved => closed
2021-08-02 19:34 guest Bug heat 8 => 10