| 1 |
## Test cases for authorization plugins |
| 2 |
|
| 3 |
--source include/xplugin_preamble.inc |
| 4 |
--source include/xplugin_create_user.inc |
| 5 |
|
| 6 |
# |
| 7 |
## Setup |
| 8 |
# |
| 9 |
|
| 10 |
--write_file $MYSQL_TMP_DIR/try_login_using_memory.xpl |
| 11 |
-->import connection_auth_mechanism_memory_helpers.macro |
| 12 |
|
| 13 |
callmacro Try_to_login_all_xusers_using_memory %RESULT%; |
| 14 |
EOF |
| 15 |
|
| 16 |
--write_file $MYSQL_TMP_DIR/login_using_plain.xpl |
| 17 |
-->import connection_auth_mechanism_memory_helpers.macro |
| 18 |
|
| 19 |
callmacro Login_all_xusers_using_plain_to_fill_the_cache; |
| 20 |
EOF |
| 21 |
|
| 22 |
--let $MYSQLXTEST=$MYSQLXTEST -ux_root --ssl-cipher='ECDHE-RSA-AES128-GCM-SHA256' |
| 23 |
--let $memory_login_fail= --file=$MYSQL_TMP_DIR/try_login_using_memory.xpl -v%RESULT%=Login_failed |
| 24 |
--let $memory_login_ok= --file=$MYSQL_TMP_DIR/try_login_using_memory.xpl -v%RESULT%=Login_ok_and_verify |
| 25 |
--let $plain_login_ok= --file=$MYSQL_TMP_DIR/login_using_plain.xpl |
| 26 |
|
| 27 |
|
| 28 |
# Create and configure xuser_* accounts that use native, sha256 and |
| 29 |
# cache_sha2 authentication plugins. |
| 30 |
|
| 31 |
--source ../include/create_mysql_accounts_for_xplugin_tests.inc |
| 32 |
|
| 33 |
GRANT ALL ON *.* TO xuser_native@localhost; |
| 34 |
GRANT ALL ON *.* TO xuser_sha256@localhost; |
| 35 |
GRANT ALL ON *.* TO xuser_cache2@localhost; |
| 36 |
|
| 37 |
|
| 38 |
# |
| 39 |
## Test starts here |
| 40 |
# |
| 41 |
|
| 42 |
--echo |
| 43 |
--echo ####################################################################### |
| 44 |
--echo ## 2. Memory mechanism ok after filling the cache, fails after flush |
| 45 |
--echo ## |
| 46 |
--echo ## when: |
| 47 |
--echo ## * The cache is empty, the memory request is going to fail |
| 48 |
--echo ## * plain auth is going to fill the cache (mysqlx_cache_cleaner installed) |
| 49 |
--echo ## * The cache is filled, the memory auth request is going to be successful |
| 50 |
--echo ## * FLUSH PRIVILEGES is going to clear the cache, |
| 51 |
--echo ## the memory auth request is going to be successful |
| 52 |
--echo ## |
| 53 |
--echo ## Requirements: F2, F4, F5, CI6 |
| 54 |
--echo # |
| 55 |
|
| 56 |
--echo |
| 57 |
--echo ####################################################################### |
| 58 |
--echo # Cache is empty, the sha256_memory request must fail |
| 59 |
exec $MYSQLXTEST $memory_login_fail 2>&1; |
| 60 |
|
| 61 |
--echo |
| 62 |
--echo ####################################################################### |
| 63 |
--echo # Plain auth work as expected and it fill the cache |
| 64 |
exec $MYSQLXTEST $plain_login_ok 2>&1; |
| 65 |
|
| 66 |
--echo |
| 67 |
--echo ####################################################################### |
| 68 |
--echo # Plain filled the cache, thus auth-mech sha256_memory must be successful |
| 69 |
exec $MYSQLXTEST $memory_login_ok 2>&1; |
| 70 |
|
| 71 |
--echo |
| 72 |
--echo ####################################################################### |
| 73 |
--echo # Cache is cleared by FLUSH SQL, thus auth-mech sha256_memory must fail |
| 74 |
FLUSH PRIVILEGES; |
| 75 |
exec $MYSQLXTEST $memory_login_fail 2>&1; |
| 76 |
|
| 77 |
|
| 78 |
--echo |
| 79 |
--echo ####################################################################### |
| 80 |
--echo ## 3. Memory mechanism fails after uninstall plugin |
| 81 |
--echo ## |
| 82 |
--echo ## when: |
| 83 |
--echo ## * plain auth is going to fill the cache |
| 84 |
--echo ## * uninstall plugin mysqlx_cache_cleaner, disables the cache |
| 85 |
--echo ## |
| 86 |
--echo ## Requirements: F1 |
| 87 |
--echo # |
| 88 |
|
| 89 |
--echo |
| 90 |
--echo ####################################################################### |
| 91 |
--echo # Plain auth work as expected and it fill the cache |
| 92 |
exec $MYSQLXTEST $plain_login_ok 2>&1; |
| 93 |
|
| 94 |
--echo |
| 95 |
--echo ####################################################################### |
| 96 |
--echo # Plain filled the cache, thus auth-mech sha256_memory must be successful |
| 97 |
exec $MYSQLXTEST $memory_login_ok 2>&1; |
| 98 |
|
| 99 |
|
| 100 |
# |
| 101 |
# Postamble |
| 102 |
# |
| 103 |
--source ../include/xplugin_cleanup.inc |
| 104 |
--source ../include/remove_mysql_accounts_for_xplugin_tests.inc |