MySQL 8.0.40
Source Code Documentation
auth_ldap_sasl_mechanism.h
Go to the documentation of this file.
1/* Copyright (c) 2020, 2024, 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_LDAP_SASL_MECHANISM_H_
25#define AUTH_LDAP_SASL_MECHANISM_H_
26
27#include "my_config.h"
28
29#include <stdio.h>
30#include <stdlib.h>
31#include <string.h>
32#include <memory>
33#if defined(KERBEROS_LIB_CONFIGURED)
34#include "auth_ldap_kerberos.h"
35#endif
36#include "log_client.h"
37
38const char SASL_GSSAPI[] = "GSSAPI";
39const char SASL_SCRAM_SHA1[] = "SCRAM-SHA-1";
40const char SASL_SCRAM_SHA256[] = "SCRAM-SHA-256";
42
44 public:
46 virtual ~Sasl_mechanism();
47 bool virtual pre_authentication();
48 void virtual get_ldap_host(std::string &host);
49 void set_user_info(std::string user, std::string password);
50
51 protected:
52 std::string m_user;
53 std::string m_password;
54};
55
56#if defined(KERBEROS_LIB_CONFIGURED)
58 public:
61 bool pre_authentication() override;
62 void get_ldap_host(std::string &host) override;
63
64 private:
65 std::unique_ptr<auth_ldap_client_kerberos_context::Kerberos> m_kerberos;
66};
67#endif
68#endif // AUTH_LDAP_SASL_MECHANISM_H_
const char SASL_SCRAM_SHA256[]
Definition: auth_ldap_sasl_mechanism.h:40
const int SASL_ERROR_INVALID_METHOD
Definition: auth_ldap_sasl_mechanism.h:41
const char SASL_SCRAM_SHA1[]
Definition: auth_ldap_sasl_mechanism.h:39
const char SASL_GSSAPI[]
Definition: auth_ldap_sasl_mechanism.h:38
Definition: auth_ldap_sasl_mechanism.h:57
std::unique_ptr< auth_ldap_client_kerberos_context::Kerberos > m_kerberos
Definition: auth_ldap_sasl_mechanism.h:65
bool pre_authentication() override
Definition: auth_ldap_sasl_mechanism.cc:48
~Sasl_mechanism_kerberos() override
void get_ldap_host(std::string &host) override
Definition: auth_ldap_sasl_mechanism.cc:102
Definition: auth_ldap_sasl_mechanism.h:43
virtual ~Sasl_mechanism()
std::string m_user
Definition: auth_ldap_sasl_mechanism.h:52
void set_user_info(std::string user, std::string password)
Definition: auth_ldap_sasl_mechanism.cc:110
virtual void get_ldap_host(std::string &host)
Definition: auth_ldap_sasl_mechanism.cc:121
virtual bool pre_authentication()
Definition: auth_ldap_sasl_mechanism.cc:119
std::string m_password
Definition: auth_ldap_sasl_mechanism.h:53
static char * password
Definition: mysql_secure_installation.cc:56
char * user
Definition: mysqladmin.cc:60
const char * host
Definition: mysqladmin.cc:59