Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed issue #6938: Web server auth doesn't work - patch by pfpDave
  • Loading branch information
c-schmitz committed Nov 23, 2012
1 parent 84a4bc0 commit b9abfc2
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions application/core/UserIdentity.php
Expand Up @@ -27,7 +27,7 @@ class UserIdentity extends CUserIdentity
*/
public function authenticate($sOneTimePassword='')
{
if (Yii::app()->getConfig("auth_webserver")==false)
if (Yii::app()->getConfig("auth_webserver")==false || $this->username != "")
{
$user = User::model()->findByAttributes(array('users_name' => $this->username));

Expand Down Expand Up @@ -67,9 +67,14 @@ public function authenticate($sOneTimePassword='')
$this->errorCode = self::ERROR_NONE;
}
}
elseif(Yii::app()->getConfig("auth_webserver") === true && isset($_SERVER['PHP_AUTH_USER'])) // normal login through webserver authentication
elseif(Yii::app()->getConfig("auth_webserver") === true && (isset($_SERVER['PHP_AUTH_USER'])||isset($_SERVER['LOGON_USER']))) // normal login through webserver authentication
{
$sUser=$_SERVER['PHP_AUTH_USER'];
if (isset($_SERVER['PHP_AUTH_USER'])) {
$sUser=$_SERVER['PHP_AUTH_USER'];
} else {
$sUser = $_SERVER['LOGON_USER'];
$sUser = substr($sUser, strrpos($sUser, "\\")+1);
}
$aUserMappings=Yii::app()->getConfig("auth_webserver_user_map");
if (isset($aUserMappings[$sUser])) $sUser= $aUserMappings[$sUser];

Expand All @@ -85,6 +90,10 @@ public function authenticate($sOneTimePassword='')
elseif (Yii::app()->getConfig("auth_webserver_autocreate_user"))
{
$aUserProfile=Yii::app()->getConfig("auth_webserver_autocreate_profile");
} else {
$this->id = $oUser->uid;
$this->user = $oUser;
$this->errorCode = self::ERROR_NONE;
}
}

Expand Down

0 comments on commit b9abfc2

Please sign in to comment.