Added yii\web\Request::getAuthUser() and getAuthPassword()

This commit is contained in:
Qiang Xue
2014-02-28 21:29:18 -05:00
parent 24e086deaf
commit 032f38a57b
2 changed files with 17 additions and 0 deletions

View File

@@ -150,6 +150,7 @@ Yii Framework 2 Change Log
- Enh: Added support for reading page size from query parameters by `Pagination` (qiangxue)
- Enh: LinkPager can now register relational link tags in the html header for prev, next, first and last page (cebe)
- Enh: Added `yii\web\UrlRuleInterface` and `yii\web\CompositeUrlRule` (qiangxue)
- Enh: Added `yii\web\Request::getAuthUser()` and `getAuthPassword()` (qiangxue)
- Chg #1186: Changed `Sort` to use comma to separate multiple sort fields and use negative sign to indicate descending sort (qiangxue)
- Chg #1519: `yii\web\User::loginRequired()` now returns the `Response` object instead of exiting the application (qiangxue)
- Chg #1586: `QueryBuilder::buildLikeCondition()` will now escape special characters and use percentage characters by default (qiangxue)

View File

@@ -819,6 +819,22 @@ class Request extends \yii\base\Request
return isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : null;
}
/**
* @return string the username sent via HTTP authentication, null if the username is not given
*/
public function getAuthUser()
{
return isset($_SERVER['PHP_AUTH_USER']) ? $_SERVER['PHP_AUTH_USER'] : null;
}
/**
* @return string the password sent via HTTP authentication, null if the username is not given
*/
public function getAuthPassword()
{
return isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : null;
}
private $_port;
/**