MySQL 8.3.0
Source Code Documentation
http_auth_realm.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2018, 2023, 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 ROUTER_HTTP_AUTH_REALM_INCLUDED
26#define ROUTER_HTTP_AUTH_REALM_INCLUDED
27
29
30#include <string>
31#include <system_error>
32
33/**
34 * Authentication Realm.
35 *
36 * multiple areas in the HTTP server may have the same required authentication.
37 * They are in the same 'realm'.
38 *
39 * A realm has
40 *
41 * - a name
42 * - a requirement
43 * - a backend
44 * - a required authentication method
45 */
47 public:
48 HttpAuthRealm(const std::string &name, const std::string &require,
49 const std::string &method, const std::string &backend)
50 : name_{name}, require_{require}, method_{method}, backend_{backend} {}
51
52 /**
53 * name of the auth realm.
54 */
55 std::string name() const { return name_; }
56
57 /**
58 * require notitation of the realm
59 */
60 std::string require() const { return require_; }
61
62 /**
63 * Authentication Method name.
64 *
65 * - basic
66 */
67 std::string method() const { return method_; }
68
69 /**
70 * Authentication Backend name.
71 *
72 * - file
73 */
74 std::string backend() const { return backend_; }
75
76 /**
77 * authenticate a user in a realm.
78 *
79 * @returns error-code
80 * @retval 0 authentication without error
81 */
82 std::error_code authenticate(const std::string &username,
83 const std::string &password) const;
84
85 private:
86 std::string name_;
87 std::string require_;
88 std::string method_;
89 std::string backend_;
90};
91
92#endif
Authentication Realm.
Definition: http_auth_realm.h:46
std::string name() const
name of the auth realm.
Definition: http_auth_realm.h:55
HttpAuthRealm(const std::string &name, const std::string &require, const std::string &method, const std::string &backend)
Definition: http_auth_realm.h:48
std::string method() const
Authentication Method name.
Definition: http_auth_realm.h:67
std::string backend_
Definition: http_auth_realm.h:89
std::string backend() const
Authentication Backend name.
Definition: http_auth_realm.h:74
std::string require() const
require notitation of the realm
Definition: http_auth_realm.h:60
std::string method_
Definition: http_auth_realm.h:88
std::string name_
Definition: http_auth_realm.h:86
std::string require_
Definition: http_auth_realm.h:87
#define HTTP_AUTH_REALM_LIB_EXPORT
Definition: http_auth_realm_lib_export.h:15
static char * password
Definition: mysql_secure_installation.cc:57
case opt name
Definition: sslopt-case.h:32