MySQL 8.0.30
Source Code Documentation
http_auth_backend_component.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2018, 2022, 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 also distributed 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 included with MySQL.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23*/
24
25#ifndef MYSQLROUTER_HTTP_AUTH_BACKEND_COMPONENT_INCLUDED
26#define MYSQLROUTER_HTTP_AUTH_BACKEND_COMPONENT_INCLUDED
27
28#include <map>
29#include <memory>
30#include <mutex>
31#include <string>
32#include <system_error>
33
35
36class HttpAuthBackend;
37
38/**
39 * public API of the HttpAuthBackend plugin.
40 */
42 public:
43 using value_type = std::map<std::string, std::shared_ptr<HttpAuthBackend>>;
44
45 /**
46 * get instance of Component.
47 */
48 static HttpAuthBackendComponent &get_instance();
49
50 /**
51 * register an authentication backend.
52 */
53 void add_backend(const std::string &name,
54 std::shared_ptr<HttpAuthBackend> backend);
55
56 /**
57 * unregister an authentication backend.
58 */
59 void remove_backend(const std::string &name);
60
61 /**
62 * authenticate user against auth-backend.
63 *
64 * @returns error
65 * @retval false authentication without error.
66 */
67 std::error_code authenticate(const std::string &inst,
68 const std::string &username,
69 const std::string &authdata);
70
71 private:
72 // disable copy, as we are a single-instance
74 void operator=(HttpAuthBackendComponent const &) = delete;
75
76 std::mutex backends_m_;
78
80};
81
82#endif
public API of the HttpAuthBackend plugin.
Definition: http_auth_backend_component.h:41
value_type auth_backends_
Definition: http_auth_backend_component.h:77
void operator=(HttpAuthBackendComponent const &)=delete
HttpAuthBackendComponent()=default
std::map< std::string, std::shared_ptr< HttpAuthBackend > > value_type
Definition: http_auth_backend_component.h:43
HttpAuthBackendComponent(HttpAuthBackendComponent const &)=delete
std::mutex backends_m_
Definition: http_auth_backend_component.h:76
Base class of all AuthBackends.
Definition: http_auth_backend.h:44
#define HTTP_AUTH_BACKEND_LIB_EXPORT
Definition: http_auth_backend_lib_export.h:15
case opt name
Definition: sslopt-case.h:32