@@ -3965,22 +3965,22 @@ void connection::tls_deprecation()
3965
3965
3966
3966
/*
3967
3967
Testing FIDO/WebAuthn connection and callback functionality.
3968
-
3968
+
3969
3969
These tests are designed for manual run. They require the following preparation steps:
3970
-
3970
+
3971
3971
1. Install FIDO auth plugin on the server:
3972
3972
3973
3973
INSTALL PLUGIN authentication_fido SONAME 'authentication_fido.so'
3974
3974
3975
3975
2. Create user with FIDO/Webauthn authentication:
3976
3976
3977
- CREATE USER 'u2 '@'localhost'
3977
+ CREATE USER 'ufido '@'localhost'
3978
3978
IDENTIFIED WITH caching_sha2_password BY 'sha2_password'
3979
3979
AND IDENTIFIED WITH authentication_webauthn
3980
3980
3981
3981
3. Register FIDO:
3982
3982
3983
- mysql --port=13000 --protocol=tcp --user=u2 --password1 --fido-register-factor=2
3983
+ mysql --port=13000 --protocol=tcp --user=ufido --password1 --fido-register-factor=2
3984
3984
3985
3985
4. Set env variable MYSQL_FIDO to non-empty value
3986
3986
*/
@@ -4024,19 +4024,15 @@ class MyWindowWebAuthn : public sql::WebAuthn_Callback
4024
4024
*/
4025
4025
4026
4026
template <class CB , class MY >
4027
- void connection::test_fido_webauthn (bool callback_ignored)
4027
+ void connection::test_fido_webauthn (sql::ConnectOptionsMap &opt, bool callback_ignored)
4028
4028
{
4029
4029
using std::string;
4030
4030
using std::cout;
4031
4031
using std::endl;
4032
-
4033
- String fido_user = " u2" ;
4034
- String fido_pwd = " sha2_password" ;
4035
4032
4036
- sql::ConnectOptionsMap opt;
4037
4033
opt[OPT_HOSTNAME] = url;
4038
- opt[OPT_USERNAME] = fido_user;
4039
- opt[OPT_PASSWORD ] = fido_pwd ;
4034
+ if ( getenv ( " PLUGIN_DIR " ))
4035
+ opt[OPT_PLUGIN_DIR ] = getenv ( " PLUGIN_DIR " ) ;
4040
4036
4041
4037
sql::Driver * driver = sql::mysql::get_driver_instance ();
4042
4038
@@ -4057,7 +4053,6 @@ void connection::test_fido_webauthn(bool callback_ignored)
4057
4053
try
4058
4054
{
4059
4055
4060
-
4061
4056
cout << endl << " Default callback (0)" << endl;
4062
4057
test_connection (0 );
4063
4058
@@ -4138,7 +4133,7 @@ void connection::test_fido_webauthn(bool callback_ignored)
4138
4133
4139
4134
4140
4135
/*
4141
- Note: This test is expecting account `u2 ` configured to use
4136
+ Note: This test is expecting account `ufido ` configured to use
4142
4137
`authentication_fido` plugin.
4143
4138
*/
4144
4139
@@ -4150,17 +4145,21 @@ void connection::fido_test()
4150
4145
if (!getenv (" MYSQL_FIDO" ))
4151
4146
return ;
4152
4147
4153
- test_fido_webauthn<sql::Fido_Callback, MyWindowFido>();
4148
+ sql::ConnectOptionsMap opt;
4149
+ opt[OPT_USERNAME] = " ufido" ;
4150
+ opt[OPT_PASSWORD] = " sha2_password" ;
4151
+
4152
+ test_fido_webauthn<sql::Fido_Callback, MyWindowFido>(opt);
4154
4153
4155
4154
cout << endl
4156
- << " Check that webauthn callback is not used for fido accounts" << endl;
4155
+ << " Check that webauthn callback is not used for fido accounts" << endl;
4157
4156
4158
- test_fido_webauthn<sql::WebAuthn_Callback, MyWindowWebAuthn>(true );
4157
+ test_fido_webauthn<sql::WebAuthn_Callback, MyWindowWebAuthn>(opt, true );
4159
4158
}
4160
4159
4161
4160
4162
4161
/*
4163
- Note: This test is expecting account `u2 ` configured to use
4162
+ Note: This test is expecting account `uwebauthn ` configured to use
4164
4163
`authentication_webauthn` plugin.
4165
4164
*/
4166
4165
@@ -4172,13 +4171,17 @@ void connection::webauthn_test()
4172
4171
if (!getenv (" MYSQL_FIDO" ) && !getenv (" MYSQL_WEBAUTHN" ))
4173
4172
return ;
4174
4173
4175
- test_fido_webauthn<sql::WebAuthn_Callback, MyWindowWebAuthn>();
4174
+ sql::ConnectOptionsMap opt;
4175
+ opt[OPT_USERNAME] = " uwebauthn" ;
4176
+ opt[OPT_PASSWORD] = " sha2_password" ;
4177
+
4178
+ test_fido_webauthn<sql::WebAuthn_Callback, MyWindowWebAuthn>(opt);
4176
4179
4177
4180
// Note: The fido callback should also work
4178
4181
4179
4182
cout << endl << " Running tests with Fido callbacks" << endl;
4180
4183
4181
- test_fido_webauthn<sql::Fido_Callback, MyWindowFido>();
4184
+ test_fido_webauthn<sql::Fido_Callback, MyWindowFido>(opt );
4182
4185
4183
4186
cout << endl << " Overwrite WebAuthn callback with Fido one" << endl;
4184
4187
0 commit comments