MySQL 9.3.0
Source Code Documentation
track_authorize_handler.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2022, 2025, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is designed to work with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have either included with
14 the program or referenced in the documentation.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24*/
25
26#ifndef ROUTER_SRC_REST_MRS_SRC_MRS_AUTHENTICATION_TRACK_AUTHORIZE_HANDLER_H_
27#define ROUTER_SRC_REST_MRS_SRC_MRS_AUTHENTICATION_TRACK_AUTHORIZE_HANDLER_H_
28
29#include <memory>
30
32
33namespace mrs {
34namespace authentication {
35
36template <typename Callback, typename Handler>
37class TrackAuthorizeHandler : public Handler {
38 public:
39 using AuthApp = typename Handler::AuthApp;
40 using Session = typename Handler::Session;
42 using AuthUser = typename Handler::AuthUser;
43 using RequestContext = typename Handler::RequestContext;
45
46 template <typename... T>
47 TrackAuthorizeHandler(Callback *cb, T... t) : Handler(t...), cb_{cb} {}
48
49 std::set<UniversalId> get_service_ids() const override {
50 return Handler::get_service_ids();
51 }
52
53 bool redirects(RequestContext &ctxt) const override {
54 return Handler::redirects(ctxt);
55 }
56 UniversalId get_id() const override { return Handler::get_id(); }
57
58 const AuthApp &get_entry() const override { return Handler::get_entry(); }
59
60 bool authorize(RequestContext &ctxt, const SessionPtr &session,
61 AuthUser *out_user) override {
62 return Handler::authorize(ctxt, session, out_user);
63 }
64
66 const std::string &account) override {
67 log_debug("TrackAuthorizeHandler::pre_authorize_account %s",
68 account.c_str());
69 cb_->pre_authorize_account(handler, account);
70 }
71
72 private:
74};
75
76} // namespace authentication
77} // namespace mrs
78
79#endif // ROUTER_SRC_REST_MRS_SRC_MRS_AUTHENTICATION_TRACK_AUTHORIZE_HANDLER_H_
Class that stores callback function reference as well as the result of the callback function call (in...
Definition: keyring_service.cc:44
The handler class is the interface for dynamically loadable storage engines.
Definition: handler.h:4618
Definition: track_authorize_handler.h:37
const AuthApp & get_entry() const override
Definition: track_authorize_handler.h:58
Callback * cb_
Definition: track_authorize_handler.h:73
bool authorize(RequestContext &ctxt, const SessionPtr &session, AuthUser *out_user) override
Definition: track_authorize_handler.h:60
typename Handler::AuthUser AuthUser
Definition: track_authorize_handler.h:42
std::set< UniversalId > get_service_ids() const override
Definition: track_authorize_handler.h:49
typename Handler::Session Session
Definition: track_authorize_handler.h:40
typename Handler::SessionPtr SessionPtr
Definition: track_authorize_handler.h:41
typename Handler::RequestContext RequestContext
Definition: track_authorize_handler.h:43
bool redirects(RequestContext &ctxt) const override
Definition: track_authorize_handler.h:53
UniversalId get_id() const override
Definition: track_authorize_handler.h:56
typename Handler::AuthApp AuthApp
Definition: track_authorize_handler.h:39
TrackAuthorizeHandler(Callback *cb, T... t)
Definition: track_authorize_handler.h:47
void pre_authorize_account(AuthorizeHandler *handler, const std::string &account) override
Definition: track_authorize_handler.h:65
Definition: authorize_handler.h:53
Log log_debug(std::cout, "DEBUG")
#define T
Definition: jit_executor_value.cc:373
static bool cb(unsigned long long new_value)
Definition: option_usage.cc:45
mrs::database::entry::AuthApp AuthApp
Definition: oauth2_handler.cc:58
mrs::database::entry::AuthUser AuthUser
Definition: scram_handler.cc:54
AuthorizeManager::SessionPtr SessionPtr
Definition: authorize_manager.cc:79
AuthorizeManager::Session Session
Definition: authorize_manager.cc:75
Definition: authorize_manager.h:48
mrs::database::entry::UniversalId UniversalId
Definition: universal_id.h:33
pid_type get_id()
Definition: process.h:48