MySQL 8.0.31
Source Code Documentation
auth_ldap_sasl_mechanism.h
Go to the documentation of this file.
1/* Copyright (c) 2020, 2022, 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 also distributed 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 included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef AUTH_LDAP_SASL_MECHANISM_H_
24#define AUTH_LDAP_SASL_MECHANISM_H_
25
26#include "my_config.h"
27
28#include <stdio.h>
29#include <stdlib.h>
30#include <string.h>
31#include <memory>
32#if defined(KERBEROS_LIB_CONFIGURED)
33#include "auth_ldap_kerberos.h"
34#endif
35#include "log_client.h"
36
37const char SASL_GSSAPI[] = "GSSAPI";
38const char SASL_SCRAM_SHA1[] = "SCRAM-SHA-1";
39const char SASL_SCRAM_SHA256[] = "SCRAM-SHA-256";
41
43 public:
45 virtual ~Sasl_mechanism();
46 bool virtual pre_authentication();
47 void virtual get_ldap_host(std::string &host);
48 void set_user_info(std::string user, std::string password);
49
50 protected:
51 std::string m_user;
52 std::string m_password;
53};
54
55#if defined(KERBEROS_LIB_CONFIGURED)
57 public:
60 bool pre_authentication() override;
61 void get_ldap_host(std::string &host) override;
62
63 private:
64 std::unique_ptr<auth_ldap_client_kerberos_context::Kerberos> m_kerberos;
65};
66#endif
67#endif // AUTH_LDAP_SASL_MECHANISM_H_
const char SASL_SCRAM_SHA256[]
Definition: auth_ldap_sasl_mechanism.h:39
const int SASL_ERROR_INVALID_METHOD
Definition: auth_ldap_sasl_mechanism.h:40
const char SASL_SCRAM_SHA1[]
Definition: auth_ldap_sasl_mechanism.h:38
const char SASL_GSSAPI[]
Definition: auth_ldap_sasl_mechanism.h:37
Definition: auth_ldap_sasl_mechanism.h:56
std::unique_ptr< auth_ldap_client_kerberos_context::Kerberos > m_kerberos
Definition: auth_ldap_sasl_mechanism.h:64
bool pre_authentication() override
Definition: auth_ldap_sasl_mechanism.cc:47
~Sasl_mechanism_kerberos() override
void get_ldap_host(std::string &host) override
Definition: auth_ldap_sasl_mechanism.cc:101
Definition: auth_ldap_sasl_mechanism.h:42
virtual ~Sasl_mechanism()
std::string m_user
Definition: auth_ldap_sasl_mechanism.h:51
void set_user_info(std::string user, std::string password)
Definition: auth_ldap_sasl_mechanism.cc:109
virtual void get_ldap_host(std::string &host)
Definition: auth_ldap_sasl_mechanism.cc:120
virtual bool pre_authentication()
Definition: auth_ldap_sasl_mechanism.cc:118
std::string m_password
Definition: auth_ldap_sasl_mechanism.h:52
static char * password
Definition: mysql_secure_installation.cc:55
char * user
Definition: mysqladmin.cc:59
const char * host
Definition: mysqladmin.cc:58