Skip to content

Commit 2bcdee6

Browse files
author
Bogdan Degtyariov
committed
Merge branch 'wl16154' into trunk
Change-Id: I7b05f8b8d39c157915b1084cbccfd05a60af9d1b
2 parents 2656ab6 + d9fc545 commit 2bcdee6

File tree

7 files changed

+29
-71
lines changed

7 files changed

+29
-71
lines changed

jdbc/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ set(AUTH_PLUGINS
419419
)
420420

421421
if(NOT CMAKE_SYSTEM_NAME MATCHES "SunOS")
422-
list(APPEND AUTH_PLUGINS webauthn fido)
422+
list(APPEND AUTH_PLUGINS webauthn)
423423
# Note: Kerberos authentication plugin is not supported on macOS
424424
if(NOT APPLE)
425425
list(APPEND AUTH_PLUGINS kerberos)
@@ -434,7 +434,6 @@ endif()
434434
# will break... For example: `krb5support` must go before `krb5`
435435

436436
set(AUTH_DEPS_webauthn fido2)
437-
set(AUTH_DEPS_fido fido2)
438437

439438

440439
if(WIN32)

jdbc/cppconn/callback.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class MySQL_Driver;
7474
struct My_Callback : WebAuthn_Callback
7575
{
7676
void ActionRequested(SQLString) override;
77-
}
77+
}
7878
cb;
7979
8080
driver->setCallback(cb);
@@ -137,6 +137,9 @@ class WebAuthn_Callback
137137

138138

139139
/*
140+
* TODO: This class is not needed. Remove it when the decision to
141+
* break ABI is made.
142+
*
140143
* Class that provides functionality allowing user code to set the
141144
* callback functions through inheriting, passing the callback as
142145
* constructor parameters or using lambdas.

jdbc/cppconn/driver.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class CPPCONN_PUBLIC_FUNC Driver
5959

6060
virtual const sql::SQLString & getName() = 0;
6161

62+
// TODO: Remove these functions when ABI breaking change is made elsewhere.
6263
virtual void setCallBack(sql::Fido_Callback &cb) = 0;
6364
virtual void setCallBack(sql::Fido_Callback &&cb) = 0;
6465

jdbc/driver/mysql_connection.cpp

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -422,14 +422,14 @@ struct Prio
422422

423423

424424
/*
425-
A callback setter object arranges for correct WebAuthn/Fido authentication
426-
callbacks to be used by the correpsonding clientlib authentication plugin.
425+
A callback setter object arranges for WebAuthn/Fido authentication
426+
callbacks to be used by the WebAuthn clientlib authentication plugin.
427427
428428
If a user has registered a callback with a driver that creates a connection
429-
then a callback function is registered with authentication plugins which will
429+
then a callback function is registered with authentication plugin which will
430430
call the callback stored in the driver.
431431
432-
The callback function registered with authentication plugins must be changed
432+
The callback function registered with authentication plugin must be changed
433433
depending on which driver is used to create a connection. A callback setter
434434
object makes necessary changes when it detects that the current driver passed
435435
to its ctor is different from the one used last time.
@@ -469,15 +469,13 @@ struct MySQL_Driver::WebAuthn_Callback_Setter
469469
driver = &drv; // Set current driver.
470470

471471
/*
472-
Note: A webauthn callback (callback_type 2 or 5) is registered with both
473-
"fido" and "webauthn" plugins. A fido callback (callback_type 1 or 4)
474-
is registered only with "fido" plugin. And if user did not register any
475-
callback (callback_type 0 or 3) then both plugin callbacks are re-set
476-
to null.
472+
Note: A webauthn callback (callback_type 2 or 5) is registered with
473+
"webauthn" plugin as well as fido callback (callback_type 1 or 4).
474+
If user did not register any callback (callback_type 0 or 3) then
475+
plugin callback is re-set to null.
477476
*/
478477

479-
register_callback(prx, "fido", (callback_type % 3) > 1);
480-
register_callback(prx, "webauthn", (callback_type % 3) > 0);
478+
register_callback(prx, (callback_type % 3) > 0);
481479

482480
/*
483481
Note: This will be reset to value 0-2 when user deregisters
@@ -509,12 +507,10 @@ struct MySQL_Driver::WebAuthn_Callback_Setter
509507
std::lock_guard<std::mutex> lock;
510508

511509
static
512-
void register_callback(Proxy *proxy, std::string which, bool set_or_reset)
510+
void register_callback(Proxy *proxy, bool set_or_reset)
513511
{
514-
std::string plugin = "authentication_" + which + "_client";
515-
std::string opt = (which == "webauthn" ?
516-
"plugin_authentication_webauthn_client" : which) +
517-
"_messages_callback";
512+
std::string plugin = "authentication_webauthn_client";
513+
std::string opt = "plugin_authentication_webauthn_client";
518514

519515
try
520516
{
@@ -530,13 +526,6 @@ struct MySQL_Driver::WebAuthn_Callback_Setter
530526
if(!set_or_reset)
531527
return;
532528

533-
/*
534-
If failed, plugin is not present, we ignore this fact for deprected
535-
fido plugin.
536-
*/
537-
538-
if ("fido" != which)
539-
throw;
540529
}
541530
catch (sql::InvalidArgumentException &e)
542531
{

jdbc/driver/mysql_driver.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,9 @@ class CPPCONN_PUBLIC_FUNC MySQL_Driver : public sql::Driver
7575
::sql::Fido_Callback fido_callback_store;
7676

7777
/*
78-
Callback function to be called by WebAuthn authentication plugin to notify
78+
Callback function to be called by WebAuthn authentication plugin to notify
7979
the user.
8080
81-
Note: Currently the same callback can be used wih deprecated Fido
82-
authentication plugin.
83-
8481
Note: The `fido_callback` pointer is re-used as a flag to indicate if
8582
the callback was set by a user and its type (WebAuthn vs. Fido).
8683
*/

jdbc/test/unit/classes/connection.cpp

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3964,25 +3964,25 @@ void connection::tls_deprecation()
39643964

39653965

39663966
/*
3967-
Testing FIDO/WebAuthn connection and callback functionality.
3967+
Testing WebAuthn connection and callback functionality.
39683968
39693969
These tests are designed for manual run. They require the following preparation steps:
39703970
3971-
1. Install FIDO auth plugin on the server:
3971+
1. Install Webauthn auth plugin on the server:
39723972
3973-
INSTALL PLUGIN authentication_fido SONAME 'authentication_fido.so'
3973+
INSTALL PLUGIN authentication_webauthn SONAME 'authentication_webauthn.so'
39743974
3975-
2. Create user with FIDO/Webauthn authentication:
3975+
2. Create user with Webauthn authentication:
39763976
3977-
CREATE USER 'ufido'@'localhost'
3977+
CREATE USER 'uwebauthn'@'localhost'
39783978
IDENTIFIED WITH caching_sha2_password BY 'sha2_password'
39793979
AND IDENTIFIED WITH authentication_webauthn
39803980
39813981
3. Register FIDO:
39823982
3983-
mysql --port=13000 --protocol=tcp --user=ufido --password1 --fido-register-factor=2
3983+
mysql --port=13000 --protocol=tcp --user=uwebauthn --password1 --fido-register-factor=2
39843984
3985-
4. Set env variable MYSQL_FIDO to non-empty value
3985+
4. Set env variable MYSQL_WEBAUTHN to non-empty value
39863986
*/
39873987

39883988
/* Variable value will be changed by callbacks */
@@ -4135,36 +4135,6 @@ void connection::test_fido_webauthn(sql::ConnectOptionsMap &opt, bool callback_i
41354135
}
41364136

41374137

4138-
/*
4139-
Note: This test is expecting account `ufido` configured to use
4140-
`authentication_fido` plugin.
4141-
*/
4142-
4143-
void connection::fido_test()
4144-
{
4145-
using std::cout;
4146-
using std::endl;
4147-
4148-
if(!getenv("MYSQL_FIDO"))
4149-
return;
4150-
4151-
sql::ConnectOptionsMap opt;
4152-
opt[OPT_USERNAME] = "ufido";
4153-
opt[OPT_PASSWORD] = "sha2_password";
4154-
4155-
test_fido_webauthn<sql::Fido_Callback, MyWindowFido>(opt);
4156-
4157-
cout << endl
4158-
<< "Check that webauthn callback is not used for fido accounts" << endl;
4159-
4160-
test_fido_webauthn<sql::WebAuthn_Callback, MyWindowWebAuthn>(opt, true);
4161-
4162-
// Clear up the callback.
4163-
sql::Driver *driver = sql::mysql::get_driver_instance();
4164-
driver->setCallBack(sql::WebAuthn_Callback{nullptr});
4165-
}
4166-
4167-
41684138
/*
41694139
Note: This test is expecting account `uwebauthn` configured to use
41704140
`authentication_webauthn` plugin.
@@ -4175,7 +4145,7 @@ void connection::webauthn_test()
41754145
using std::cout;
41764146
using std::endl;
41774147

4178-
if(!getenv("MYSQL_FIDO") && !getenv("MYSQL_WEBAUTHN"))
4148+
if(!getenv("MYSQL_WEBAUTHN"))
41794149
return;
41804150

41814151
sql::ConnectOptionsMap opt;

jdbc/test/unit/classes/connection.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ class connection : public unit_fixture
100100
TEST_CASE(dns_srv);
101101
TEST_CASE(mfa);
102102
TEST_CASE(tls_deprecation);
103-
TEST_CASE(fido_test);
104103
TEST_CASE(webauthn_test);
105104
TEST_CASE(normalize_ssl_options);
106105
TEST_CASE(macro_version);
106+
107107
}
108108

109109
/**
@@ -320,10 +320,9 @@ class connection : public unit_fixture
320320
void normalize_ssl_options();
321321

322322
/*
323-
* Test for checking fido connection.
323+
* Test for checking webauthn connection.
324324
*
325325
*/
326-
void fido_test();
327326
void webauthn_test();
328327

329328
/*

0 commit comments

Comments
 (0)