MySQL 26.10.0
Source Code Documentation
embedded_runtime_services.h
Go to the documentation of this file.
1/* Copyright (c) 2026, Oracle and/or its affiliates.
2
3This program is free software; you can redistribute it and/or modify
4it under the terms of the GNU General Public License, version 2.0,
5as published by the Free Software Foundation.
6
7This program is designed to work with certain software (including
8but not limited to OpenSSL) that is licensed under separate terms,
9as designated in a particular file or component or in included license
10documentation. The authors of MySQL hereby grant you an additional
11permission to link the program and your derivative works with the
12separately licensed software that they have either included with
13the program or referenced in the documentation.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License, version 2.0, for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef ROUTER_SRC_REST_MRS_INCLUDE_MRS_EMBEDDED_RUNTIME_SERVICES_H_
25#define ROUTER_SRC_REST_MRS_INCLUDE_MRS_EMBEDDED_RUNTIME_SERVICES_H_
26
27#include <cstdint>
28#include <memory>
29#include <optional>
30#include <string>
31
32#include "mrs/configuration.h"
33#include "secure_string.h" // NOLINT(build/include_subdir)
34
35namespace collector {
37class MysqlFixedPoolManager;
38} // namespace collector
39
40namespace mrs {
41
42/**
43 * Component-mode overrides for selected MRS runtime services.
44 *
45 * Standalone Router does not install these services and continues to use the
46 * normal network/password/keyring-backed implementation. The component backend
47 * installs a non-owning services instance before starting the embedded Router
48 * loader and clears it during shutdown.
49 *
50 * The services object must outlive all MRS objects created while it is
51 * installed.
52 */
54 public:
55 virtual ~EmbeddedRuntimeServices() = default;
56
57 virtual std::unique_ptr<collector::MysqlCacheManager>
59
60 /**
61 * Validate HTTP-supplied MySQL credentials through the server authentication
62 * path and return the authenticated CURRENT_USER() identity. The returned
63 * auth id is used for embedded sessions created after authentication; this
64 * call itself must not attach an embedded security context for a user that
65 * has not been authenticated yet.
66 */
67 virtual std::optional<std::string> authenticate_mysql_user(
68 const std::string &user, const mysql_harness::SecureString &password) = 0;
69
70 virtual std::shared_ptr<collector::MysqlFixedPoolManager>
71 create_mysql_user_session_pool(uint32_t passthrough_pool_size,
72 const std::string &auth_id) = 0;
73
74 virtual const std::string &jwt_secret() const = 0;
75};
76
79
80} // namespace mrs
81
82#endif // ROUTER_SRC_REST_MRS_INCLUDE_MRS_EMBEDDED_RUNTIME_SERVICES_H_
Definition: configuration.h:49
Component-mode overrides for selected MRS runtime services.
Definition: embedded_runtime_services.h:53
virtual std::optional< std::string > authenticate_mysql_user(const std::string &user, const mysql_harness::SecureString &password)=0
Validate HTTP-supplied MySQL credentials through the server authentication path and return the authen...
virtual std::unique_ptr< collector::MysqlCacheManager > create_mysql_cache_manager(const Configuration &configuration)=0
virtual ~EmbeddedRuntimeServices()=default
virtual const std::string & jwt_secret() const =0
virtual std::shared_ptr< collector::MysqlFixedPoolManager > create_mysql_user_session_pool(uint32_t passthrough_pool_size, const std::string &auth_id)=0
Null-terminated string which is securely wiped on destruction.
Definition: secure_string.h:59
static char * password
Definition: mysql_secure_installation.cc:58
Definition: mrs_component_embedded_mysql_cache.h:33
collector::MysqlCacheManager MysqlCacheManager
Definition: handler_db_object_table.cc:285
Definition: authorize_manager.h:48
void set_embedded_runtime_services(EmbeddedRuntimeServices *services)
Definition: embedded_runtime_services.cc:32
EmbeddedRuntimeServices * get_embedded_runtime_services()
Definition: embedded_runtime_services.cc:36
Definition: services.cc:40
required string configuration
Definition: replication_asynchronous_connection_failover.proto:49