MySQL 9.3.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
auth_kerberos_client_plugin.h
Go to the documentation of this file.
1/* Copyright (c) 2021, 2025, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
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, version 2.0, 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#ifndef AUTH_KERBEROS_CLIENT_PLUGIN_H_
25#define AUTH_KERBEROS_CLIENT_PLUGIN_H_
26
27#include <stdio.h>
28#include <stdlib.h>
29#include <string.h>
30#include <memory>
31
32#include <mysql.h>
33#include <mysql/client_plugin.h>
34#include <mysql/plugin.h>
36#include "my_config.h"
37
39
41#if defined(_WIN32)
42 MODE_SSPI,
43#endif
45};
46
48 public:
52 bool authenticate();
53 void set_upn_info(const std::string &name, std::string pwd);
54 void set_mysql_account_name(const std::string &name);
57
58 protected:
59 void create_upn(const std::string &account_name);
61 std::string m_password;
63 std::string m_as_user_relam;
65 MYSQL *m_mysql{nullptr};
67 std::unique_ptr<I_Kerberos_client> m_kerberos_client;
68};
69
70#endif // AUTH_KERBEROS_CLIENT_PLUGIN_H_
authentication_mode
Definition: auth_kerberos_client_plugin.h:40
Definition: auth_kerberos_client_plugin.h:47
bool read_spn_realm_from_server()
Definition: auth_kerberos_client_plugin.cc:166
std::string m_password
Definition: auth_kerberos_client_plugin.h:61
MYSQL * m_mysql
Definition: auth_kerberos_client_plugin.h:65
std::unique_ptr< I_Kerberos_client > m_kerberos_client
Definition: auth_kerberos_client_plugin.h:67
authentication_mode m_mode
Definition: auth_kerberos_client_plugin.h:66
void set_mysql_account_name(const std::string &name)
Definition: auth_kerberos_client_plugin.cc:84
Kerberos_plugin_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql, authentication_mode mode)
Definition: auth_kerberos_client_plugin.cc:55
void set_upn_info(const std::string &name, std::string pwd)
Definition: auth_kerberos_client_plugin.cc:145
std::string m_as_user_relam
Definition: auth_kerberos_client_plugin.h:63
bool obtain_store_credentials()
Definition: auth_kerberos_client_plugin.cc:66
~Kerberos_plugin_client()=default
std::string m_user_principal_name
Definition: auth_kerberos_client_plugin.h:60
bool authenticate()
Definition: auth_kerberos_client_plugin.cc:162
MYSQL_PLUGIN_VIO * m_vio
Definition: auth_kerberos_client_plugin.h:64
std::string m_service_principal
Definition: auth_kerberos_client_plugin.h:62
void create_upn(const std::string &account_name)
Definition: auth_kerberos_client_plugin.cc:156
MySQL Client Plugin API.
This file defines the client API to MySQL and also the ABI of the dynamically linked libmysqlclient.
Definition: instrumented_condition_variable.h:32
mode
Definition: file_handle.h:61
This file defines constants and data structures that are the same for both client- and server-side au...
case opt name
Definition: sslopt-case.h:29
Provides plugin access to communication channel.
Definition: plugin_auth_common.h:147
Definition: mysql.h:300