Skip to content

Commit f22fb2c

Browse files
silvakidBogdan Degtyariov
authored andcommitted
WL#15239: Support WebauthN authentication
Change-Id: Ibe7ce06b11f54c81dfdc65201a620db4116abd20
1 parent ddb70c4 commit f22fb2c

File tree

1 file changed

+25
-12
lines changed

1 file changed

+25
-12
lines changed

jdbc/driver/mysql_connection.cpp

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,27 +1436,40 @@ void MySQL_Connection::init(ConnectOptionsMap & properties)
14361436
"fido_messages_callback",
14371437
(const void*)fido_callback_func
14381438
);
1439+
} catch (sql::MethodNotImplementedException &) {
1440+
// If failed, authentication_fido_client is no longer present... skip
1441+
} catch (sql::InvalidArgumentException &e) {
1442+
throw ::sql::SQLException(
1443+
"Failed to set fido message callback for "
1444+
"authentication_fido_client plugin");
1445+
}
1446+
1447+
try
1448+
{
1449+
fido_callback_instance = callback;
1450+
proxy->plugin_option(MYSQL_CLIENT_AUTHENTICATION_PLUGIN,
1451+
"authentication_webauthn_client",
1452+
"webauthn_messages_callback",
1453+
(const void *)fido_callback_func);
14391454

14401455
}
14411456
catch (sql::InvalidArgumentException& e) {
1442-
throw ::sql::SQLUnsupportedOptionException(
1443-
"Failed to set fido message callback for authentication_fido_client plugin",
1444-
OPT_OCI_CONFIG_FILE
1445-
);
1457+
throw ::sql::SQLException(
1458+
"Failed to set webauthn message callback for "
1459+
"authentication_webauthn_client plugin");
14461460
}
14471461
}
14481462
}
14491463

1450-
~Fido_Callback_Setter()
1464+
~Fido_Callback_Setter()
1465+
{
1466+
if(fido_callback_instance && proxy)
14511467
{
1452-
if(fido_callback_instance && proxy)
1468+
try
14531469
{
1454-
try
1455-
{
1456-
proxy->plugin_option(MYSQL_CLIENT_AUTHENTICATION_PLUGIN,
1457-
"authentication_fido_client",
1458-
"fido_messages_callback",
1459-
nullptr);
1470+
proxy->plugin_option(MYSQL_CLIENT_AUTHENTICATION_PLUGIN,
1471+
"authentication_webauthn_client",
1472+
"webauthn_messages_callback", nullptr);
14601473
}
14611474
catch(...) {}
14621475
fido_callback_instance = nullptr;

0 commit comments

Comments
 (0)