[Enhancement](http) unify http auth config (#20864)
This commit is contained in:
@ -423,7 +423,7 @@ DEFINE_String(ssl_certificate_path, "");
|
||||
// Path of private key
|
||||
DEFINE_String(ssl_private_key_path, "");
|
||||
// Whether to check authorization
|
||||
DEFINE_Bool(enable_http_auth, "false");
|
||||
DEFINE_Bool(enable_all_http_auth, "false");
|
||||
// Number of webserver workers
|
||||
DEFINE_Int32(webserver_num_workers, "48");
|
||||
// Period to update rate counters and sampling counters in ms.
|
||||
|
||||
@ -459,7 +459,7 @@ DECLARE_String(ssl_certificate_path);
|
||||
// Path of private key
|
||||
DECLARE_String(ssl_private_key_path);
|
||||
// Whether to check authorization
|
||||
DECLARE_Bool(enable_http_auth);
|
||||
DECLARE_Bool(enable_all_http_auth);
|
||||
// Number of webserver workers
|
||||
DECLARE_Int32(webserver_num_workers);
|
||||
// Period to update rate counters and sampling counters in ms.
|
||||
|
||||
@ -39,7 +39,7 @@ int HttpHandlerWithAuth::on_header(HttpRequest* req) {
|
||||
TCheckAuthResult auth_result;
|
||||
AuthInfo auth_info;
|
||||
|
||||
if (!config::enable_http_auth) {
|
||||
if (!config::enable_all_http_auth) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ static HttpAuthTestHandler s_auth_handler =
|
||||
class HttpAuthTest : public testing::Test {};
|
||||
|
||||
TEST_F(HttpAuthTest, disable_auth) {
|
||||
EXPECT_FALSE(config::enable_http_auth);
|
||||
EXPECT_FALSE(config::enable_all_http_auth);
|
||||
|
||||
auto evhttp_req = evhttp_request_new(nullptr, nullptr);
|
||||
HttpRequest req(evhttp_req);
|
||||
@ -57,8 +57,8 @@ TEST_F(HttpAuthTest, disable_auth) {
|
||||
evhttp_request_free(evhttp_req);
|
||||
}
|
||||
|
||||
TEST_F(HttpAuthTest, enable_http_auth) {
|
||||
config::enable_http_auth = true;
|
||||
TEST_F(HttpAuthTest, enable_all_http_auth) {
|
||||
config::enable_all_http_auth = true;
|
||||
|
||||
// 1. empty auth info
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user