MySQL 9.0.0
Source Code Documentation
validate_password_imp.h
Go to the documentation of this file.
1/* Copyright (c) 2017, 2024, Oracle and/or its affiliates.
2
3This program is free software; you can redistribute it and/or modify
4it under the terms of the GNU General Public License, version 2.0,
5as published by the Free Software Foundation.
6
7This program is designed to work with certain software (including
8but not limited to OpenSSL) that is licensed under separate terms,
9as designated in a particular file or component or in included license
10documentation. The authors of MySQL hereby grant you an additional
11permission to link the program and your derivative works with the
12separately licensed software that they have either included with
13the program or referenced in the documentation.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License, version 2.0, for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef VALIDATE_PASSWORD_IMP_H
25#define VALIDATE_PASSWORD_IMP_H
26
36
38extern REQUIRES_SERVICE_PLACEHOLDER(log_builtins);
39extern REQUIRES_SERVICE_PLACEHOLDER(log_builtins_string);
40extern REQUIRES_SERVICE_PLACEHOLDER(mysql_string_character_access);
41extern REQUIRES_SERVICE_PLACEHOLDER(mysql_string_factory);
42extern REQUIRES_SERVICE_PLACEHOLDER(mysql_string_case);
43extern REQUIRES_SERVICE_PLACEHOLDER(mysql_string_converter);
44extern REQUIRES_SERVICE_PLACEHOLDER(mysql_string_iterator);
45extern REQUIRES_SERVICE_PLACEHOLDER(mysql_string_ctype);
46extern REQUIRES_SERVICE_PLACEHOLDER(mysql_string_value);
47extern REQUIRES_SERVICE_PLACEHOLDER(component_sys_variable_register);
48extern REQUIRES_SERVICE_PLACEHOLDER(component_sys_variable_unregister);
49extern REQUIRES_SERVICE_PLACEHOLDER(status_variable_registration);
50extern REQUIRES_SERVICE_PLACEHOLDER(mysql_thd_security_context);
51extern REQUIRES_SERVICE_PLACEHOLDER(mysql_security_context_options);
52extern REQUIRES_SERVICE_PLACEHOLDER(psi_memory_v2);
53
54/**
55 An implementation of the password_validation_service to validate password and
56 to get its strength.
57*/
59 public:
60 /**
61 Validates the strength of given password.
62
63 @sa validate_password::validate()
64 */
65 static DEFINE_BOOL_METHOD(validate, (void *thd, my_h_string password));
66
67 /**
68 Gets the password strength between (0-100)
69
70 @sa validate_password::get_strength()
71 */
73 unsigned int *strength));
74};
75
77 public:
78 /**
79 Validate if number of changed characters matches the pre-configured
80 criteria
81
82 @param [in] current_password Current password
83 @param [in] new_password New password
84 @param [out] minimum_required Minimum required number of changed characters
85 @param [out] changed Actual number of changed characters
86
87 @returns Result of validation
88 @retval false Success
89 @retval true Error
90 */
91 static DEFINE_BOOL_METHOD(validate, (my_h_string current_password,
92 my_h_string new_password,
93 uint *minimum_required, uint *changed));
94};
95#endif /* VALIDATE_PASSWORD_IMP_H */
Definition: validate_password_imp.h:76
static mysql_service_status_t validate(my_h_string current_password, my_h_string new_password, uint *minimum_required, uint *changed) noexcept
Validate if number of changed characters matches the pre-configured criteria.
Definition: validate_password_imp.cc:616
An implementation of the password_validation_service to validate password and to get its strength.
Definition: validate_password_imp.h:58
static mysql_service_status_t get_strength(void *thd, my_h_string password, unsigned int *strength) noexcept
Gets the password strength between (0-100)
Definition: validate_password_imp.cc:532
static mysql_service_status_t validate(void *thd, my_h_string password) noexcept
Validates the strength of given password.
Definition: validate_password_imp.cc:588
Specifies macros to define Components.
static char * password
Definition: mysql_secure_installation.cc:58
Specifies macros to define Service Implementations.
#define DEFINE_BOOL_METHOD(name, args)
A short macro to define method that returns bool, which is the most common case.
Definition: service_implementation.h:88
Definition: mysql_string_service.cc:60
REQUIRES_SERVICE_PLACEHOLDER(registry)