seastar::httpd::request was deprecated in favor of `seastar::http::request`
since bdd5d929891d2cb821eca25896e25ed4ff658b7a.
so let's use the latter. this change also silences the warning of:
```
/home/kefu/dev/scylladb/api/authorization_cache.cc: In function ‘void api::set_authorization_cache(http_context&, seastar::httpd::routes&, seastar::sharded<auth::service>&)’:
/home/kefu/dev/scylladb/api/authorization_cache.cc:19:104: error: ‘using seastar::httpd::request = struct seastar::http::request’ is deprecated: Use http::request instead [-Werror=deprecated-declarations]
19 | httpd::authorization_cache_json::authorization_cache_reset.set(r, [&auth_service] (std::unique_ptr<request> req) -> future<json::json_return_type> {
| ^~~~~~~
```
Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
34 lines
905 B
C++
34 lines
905 B
C++
/*
|
|
* Copyright (C) 2022-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
#include "api/api-doc/authorization_cache.json.hh"
|
|
|
|
#include "api/authorization_cache.hh"
|
|
#include "api/api.hh"
|
|
#include "auth/common.hh"
|
|
|
|
namespace api {
|
|
using namespace json;
|
|
|
|
void set_authorization_cache(http_context& ctx, routes& r, sharded<auth::service> &auth_service) {
|
|
httpd::authorization_cache_json::authorization_cache_reset.set(r, [&auth_service] (std::unique_ptr<http::request> req) -> future<json::json_return_type> {
|
|
co_await auth_service.invoke_on_all([] (auth::service& auth) -> future<> {
|
|
auth.reset_authorization_cache();
|
|
return make_ready_future<>();
|
|
});
|
|
|
|
co_return json_void();
|
|
});
|
|
}
|
|
|
|
void unset_authorization_cache(http_context& ctx, routes& r) {
|
|
httpd::authorization_cache_json::authorization_cache_reset.unset(r);
|
|
}
|
|
|
|
}
|