Skip to content

Commit d21d74f

Browse files
committed
WL#14650, Support for MFA (multi factor authentication) authentication.
1 parent 18b2525 commit d21d74f

17 files changed

+442
-182
lines changed

CHANGES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
Version 8.0.28
55

6+
- WL#14650, Support for MFA (multi factor authentication) authentication.
7+
68
Version 8.0.27
79

810
- Fix for Bug#103612 (32902019), Incorrectly identified WITH...SELECT as unsafe for read-only connections.

src/main/core-api/java/com/mysql/cj/conf/ConnectionUrl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ protected HostInfo fixHostInfo(HostInfo hi) {
477477
hostProps.putAll(this.properties);
478478
// Add/override host specific connection arguments.
479479
hi.getHostProperties().entrySet().stream().forEach(e -> hostProps.put(PropertyKey.normalizeCase(e.getKey()), e.getValue()));
480-
// Add the database name
480+
// Add the database name.
481481
if (!hostProps.containsKey(PropertyKey.DBNAME.getKeyName())) {
482482
hostProps.put(PropertyKey.DBNAME.getKeyName(), getDatabase());
483483
}
@@ -513,7 +513,7 @@ protected HostInfo fixHostInfo(HostInfo hi) {
513513
}
514514

515515
String password = hostProps.remove(PropertyKey.PASSWORD.getKeyName());
516-
if (!isNullOrEmpty(hi.getPassword())) {
516+
if (hi.getPassword() != null) { // Password can be specified as empty string.
517517
password = hi.getPassword();
518518
} else if (isNullOrEmpty(password)) {
519519
password = getDefaultPassword();

src/main/core-api/java/com/mysql/cj/conf/ConnectionUrlParser.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,6 @@ private void parseAuthoritySegment(String authSegment) {
292292
*/
293293
private HostInfo buildHostInfoForEmptyHost(String user, String password, String hostInfo) {
294294
if (isNullOrEmpty(hostInfo)) {
295-
if (isNullOrEmpty(user) && isNullOrEmpty(password)) {
296-
return new HostInfo();
297-
}
298295
return new HostInfo(this, null, HostInfo.NO_PORT, user, password);
299296
}
300297
return null;

src/main/core-api/java/com/mysql/cj/conf/PropertyDefinitions.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,17 +187,26 @@ public enum DatabaseTerm {
187187
Messages.getString("ConnectionProperties.Password"), Messages.getString("ConnectionProperties.allVersions"), CATEGORY_AUTH,
188188
Integer.MIN_VALUE + 2),
189189

190+
new StringPropertyDefinition(PropertyKey.password1, DEFAULT_VALUE_NULL_STRING, RUNTIME_NOT_MODIFIABLE,
191+
Messages.getString("ConnectionProperties.Password1"), "8.0.27", CATEGORY_AUTH, Integer.MIN_VALUE + 3),
192+
193+
new StringPropertyDefinition(PropertyKey.password2, DEFAULT_VALUE_NULL_STRING, RUNTIME_NOT_MODIFIABLE,
194+
Messages.getString("ConnectionProperties.Password2"), "8.0.27", CATEGORY_AUTH, Integer.MIN_VALUE + 4),
195+
196+
new StringPropertyDefinition(PropertyKey.password3, DEFAULT_VALUE_NULL_STRING, RUNTIME_NOT_MODIFIABLE,
197+
Messages.getString("ConnectionProperties.Password3"), "8.0.27", CATEGORY_AUTH, Integer.MIN_VALUE + 5),
198+
190199
new StringPropertyDefinition(PropertyKey.authenticationPlugins, DEFAULT_VALUE_NULL_STRING, RUNTIME_MODIFIABLE,
191-
Messages.getString("ConnectionProperties.authenticationPlugins"), "5.1.19", CATEGORY_AUTH, Integer.MIN_VALUE + 3),
200+
Messages.getString("ConnectionProperties.authenticationPlugins"), "5.1.19", CATEGORY_AUTH, Integer.MIN_VALUE + 6),
192201

193202
new StringPropertyDefinition(PropertyKey.disabledAuthenticationPlugins, DEFAULT_VALUE_NULL_STRING, RUNTIME_MODIFIABLE,
194-
Messages.getString("ConnectionProperties.disabledAuthenticationPlugins"), "5.1.19", CATEGORY_AUTH, Integer.MIN_VALUE + 4),
203+
Messages.getString("ConnectionProperties.disabledAuthenticationPlugins"), "5.1.19", CATEGORY_AUTH, Integer.MIN_VALUE + 7),
195204

196205
new StringPropertyDefinition(PropertyKey.defaultAuthenticationPlugin, "mysql_native_password", RUNTIME_MODIFIABLE,
197-
Messages.getString("ConnectionProperties.defaultAuthenticationPlugin"), "5.1.19", CATEGORY_AUTH, Integer.MIN_VALUE + 5),
206+
Messages.getString("ConnectionProperties.defaultAuthenticationPlugin"), "5.1.19", CATEGORY_AUTH, Integer.MIN_VALUE + 8),
198207

199208
new StringPropertyDefinition(PropertyKey.ldapServerHostname, DEFAULT_VALUE_NULL_STRING, RUNTIME_MODIFIABLE,
200-
Messages.getString("ConnectionProperties.ldapServerHostname"), "8.0.23", CATEGORY_AUTH, Integer.MIN_VALUE + 6),
209+
Messages.getString("ConnectionProperties.ldapServerHostname"), "8.0.23", CATEGORY_AUTH, Integer.MIN_VALUE + 9),
201210

202211
new StringPropertyDefinition(PropertyKey.ociConfigFile, DEFAULT_VALUE_NULL_STRING, RUNTIME_MODIFIABLE,
203212
Messages.getString("ConnectionProperties.ociConfigFile"), "8.0.27", CATEGORY_AUTH, Integer.MIN_VALUE + 7),

src/main/core-api/java/com/mysql/cj/conf/PropertyKey.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ public enum PropertyKey {
6262

6363
allowLoadLocalInfile("allowLoadLocalInfile", true), //
6464
allowLoadLocalInfileInPath("allowLoadLocalInfileInPath", true), //
65-
allowSourceDownConnections("allowSourceDownConnections", "allowMasterDownConnections", true), //
6665
allowMultiQueries("allowMultiQueries", true), //
6766
allowNanAndInf("allowNanAndInf", true), //
6867
allowPublicKeyRetrieval("allowPublicKeyRetrieval", true), //
6968
allowReplicaDownConnections("allowReplicaDownConnections", "allowSlaveDownConnections", true), //
69+
allowSourceDownConnections("allowSourceDownConnections", "allowMasterDownConnections", true), //
7070
allowUrlInLocalInfile("allowUrlInLocalInfile", true), //
7171
alwaysSendSetIsolation("alwaysSendSetIsolation", true), //
7272
authenticationPlugins("authenticationPlugins", true), //
@@ -125,13 +125,14 @@ public enum PropertyKey {
125125
failOverReadOnly("failOverReadOnly", true), //
126126
fallbackToSystemKeyStore("fallbackToSystemKeyStore", true), //
127127
fallbackToSystemTrustStore("fallbackToSystemTrustStore", true), //
128+
forceConnectionTimeZoneToSession("forceConnectionTimeZoneToSession", true), //
128129
functionsNeverReturnBlobs("functionsNeverReturnBlobs", true), //
129130
gatherPerfMetrics("gatherPerfMetrics", true), //
130131
generateSimpleParameterMetadata("generateSimpleParameterMetadata", true), //
131132
getProceduresReturnsFunctions("getProceduresReturnsFunctions", true), //
132-
holdResultsOpenOverStatementClose("holdResultsOpenOverStatementClose", true), //
133133
ha_enableJMX("ha.enableJMX", "haEnableJMX", true), //
134134
ha_loadBalanceStrategy("ha.loadBalanceStrategy", "haLoadBalanceStrategy", true), //
135+
holdResultsOpenOverStatementClose("holdResultsOpenOverStatementClose", true), //
135136
ignoreNonTxTables("ignoreNonTxTables", true), //
136137
includeInnodbStatusInDeadlockExceptions("includeInnodbStatusInDeadlockExceptions", true), //
137138
includeThreadDumpInDeadlockExceptions("includeThreadDumpInDeadlockExceptions", true), //
@@ -148,8 +149,8 @@ public enum PropertyKey {
148149
loadBalanceExceptionChecker("loadBalanceExceptionChecker", true), //
149150
loadBalanceHostRemovalGracePeriod("loadBalanceHostRemovalGracePeriod", true), //
150151
loadBalancePingTimeout("loadBalancePingTimeout", true), //
151-
loadBalanceSQLStateFailover("loadBalanceSQLStateFailover", true), //
152152
loadBalanceSQLExceptionSubclassFailover("loadBalanceSQLExceptionSubclassFailover", true), //
153+
loadBalanceSQLStateFailover("loadBalanceSQLStateFailover", true), //
153154
loadBalanceValidateConnectionOnSwapServer("loadBalanceValidateConnectionOnSwapServer", true), //
154155
localSocketAddress("localSocketAddress", true), //
155156
locatorFetchBufferSize("locatorFetchBufferSize", true), //
@@ -172,6 +173,9 @@ public enum PropertyKey {
172173
padCharsWithSpace("padCharsWithSpace", true), //
173174
paranoid("paranoid", false), //
174175
parseInfoCacheFactory("parseInfoCacheFactory", true), //
176+
password1("password1", true), //
177+
password2("password2", true), //
178+
password3("password3", true), //
175179
passwordCharacterEncoding("passwordCharacterEncoding", true), //
176180
pedantic("pedantic", true), //
177181
pinGlobalTxToPhysicalConnection("pinGlobalTxToPhysicalConnection", true), //
@@ -182,7 +186,6 @@ public enum PropertyKey {
182186
processEscapeCodesForPrepStmts("processEscapeCodesForPrepStmts", true), //
183187
profilerEventHandler("profilerEventHandler", true), //
184188
profileSQL("profileSQL", true), //
185-
forceConnectionTimeZoneToSession("forceConnectionTimeZoneToSession", true), //
186189
propertiesTransform("propertiesTransform", true), //
187190
queriesBeforeRetrySource("queriesBeforeRetrySource", "queriesBeforeRetryMaster", true), //
188191
queryInterceptors("queryInterceptors", true), //
@@ -208,7 +211,6 @@ public enum PropertyKey {
208211
serverConfigCacheFactory("serverConfigCacheFactory", true), //
209212
serverRSAPublicKeyFile("serverRSAPublicKeyFile", true), //
210213
sessionVariables("sessionVariables", true), //
211-
trackSessionState("trackSessionState", true), //
212214
slowQueryThresholdMillis("slowQueryThresholdMillis", true), //
213215
slowQueryThresholdNanos("slowQueryThresholdNanos", true), //
214216
socketFactory("socketFactory", true), //
@@ -224,6 +226,7 @@ public enum PropertyKey {
224226
tcpTrafficClass("tcpTrafficClass", true), //
225227
tinyInt1isBit("tinyInt1isBit", true), //
226228
traceProtocol("traceProtocol", true), //
229+
trackSessionState("trackSessionState", true), //
227230
transformedBitIsBoolean("transformedBitIsBoolean", true), //
228231
treatUtilDateAsTimestamp("treatUtilDateAsTimestamp", true), //
229232
trustCertificateKeyStorePassword("trustCertificateKeyStorePassword", true), //

src/main/core-api/java/com/mysql/cj/protocol/ServerSessionStateController.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import com.mysql.cj.exceptions.ExceptionFactory;
3737

3838
public interface ServerSessionStateController {
39-
4039
public static int SESSION_TRACK_SYSTEM_VARIABLES = 0x00;
4140
public static int SESSION_TRACK_SCHEMA = 0x01;
4241
public static int SESSION_TRACK_STATE_CHANGE = 0x02;

0 commit comments

Comments
 (0)