|
@@ -745,6 +745,8 @@ void default_socket_options(socket_t sock);
|
|
|
|
|
|
|
|
const char *status_message(int status);
|
|
const char *status_message(int status);
|
|
|
|
|
|
|
|
|
|
+std::string get_bearer_token_auth(const Request &req);
|
|
|
|
|
+
|
|
|
namespace detail {
|
|
namespace detail {
|
|
|
|
|
|
|
|
class MatcherBase {
|
|
class MatcherBase {
|
|
@@ -1943,6 +1945,15 @@ inline const char *status_message(int status) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+inline std::string get_bearer_token_auth(const Request &req) {
|
|
|
|
|
+ if (req.has_header("Authorization")) {
|
|
|
|
|
+ static std::string BearerHeaderPrefix = "Bearer ";
|
|
|
|
|
+ return req.get_header_value("Authorization")
|
|
|
|
|
+ .substr(BearerHeaderPrefix.length());
|
|
|
|
|
+ }
|
|
|
|
|
+ return "";
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
template <class Rep, class Period>
|
|
template <class Rep, class Period>
|
|
|
inline Server &
|
|
inline Server &
|
|
|
Server::set_read_timeout(const std::chrono::duration<Rep, Period> &duration) {
|
|
Server::set_read_timeout(const std::chrono::duration<Rep, Period> &duration) {
|