Commit 032f38a5 by Qiang Xue

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

parent 24e086de
...@@ -150,6 +150,7 @@ Yii Framework 2 Change Log ...@@ -150,6 +150,7 @@ Yii Framework 2 Change Log
- Enh: Added support for reading page size from query parameters by `Pagination` (qiangxue) - 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: 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\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 #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 #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) - Chg #1586: `QueryBuilder::buildLikeCondition()` will now escape special characters and use percentage characters by default (qiangxue)
......
...@@ -819,6 +819,22 @@ class Request extends \yii\base\Request ...@@ -819,6 +819,22 @@ class Request extends \yii\base\Request
return isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : null; 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; private $_port;
/** /**
......
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