@@ -22,6 +22,7 @@ import (
2222
2323 sqle "github.com/dolthub/go-mysql-server"
2424 "github.com/dolthub/go-mysql-server/sql"
25+ "github.com/dolthub/go-mysql-server/sql/encodings"
2526 "github.com/dolthub/go-mysql-server/sql/mysql_db"
2627 "github.com/dolthub/go-mysql-server/sql/plan"
2728 "github.com/dolthub/go-mysql-server/sql/types"
@@ -772,6 +773,48 @@ var UserPrivTests = []UserPrivilegeTest{
772773 },
773774 },
774775 },
776+ {
777+ Name : "User creation with SSL/TLS requirements" ,
778+ SetUpScript : []string {
779+ "CREATE USER testuser1@`127.0.0.1` REQUIRE NONE;" ,
780+ "CREATE USER testuser2@`127.0.0.1` REQUIRE SSL;" ,
781+ "CREATE USER testuser3@`127.0.0.1` REQUIRE X509;" ,
782+ "CREATE USER testuser4@`127.0.0.1` IDENTIFIED WITH caching_sha2_password by 'pass1' REQUIRE X509;" ,
783+ "CREATE USER testuser5@`127.0.0.1` REQUIRE SUBJECT 'cert_subject';" ,
784+ "CREATE USER testuser6@`127.0.0.1` REQUIRE ISSUER 'cert_issuer';" ,
785+ "CREATE USER testuser7@`127.0.0.1` REQUIRE CIPHER 'cipher';" ,
786+ },
787+ Assertions : []UserPrivilegeTestAssertion {
788+ {
789+ Query : "select user, ssl_type, ssl_cipher, x509_issuer, x509_subject from mysql.user where user='testuser1';" ,
790+ Expected : []sql.Row {{"testuser1" , "" , encodings .StringToBytes ("" ), encodings .StringToBytes ("" ), encodings .StringToBytes ("" )}},
791+ },
792+ {
793+ Query : "select user, ssl_type, ssl_cipher, x509_issuer, x509_subject from mysql.user where user='testuser2';" ,
794+ Expected : []sql.Row {{"testuser2" , "ANY" , encodings .StringToBytes ("" ), encodings .StringToBytes ("" ), encodings .StringToBytes ("" )}},
795+ },
796+ {
797+ Query : "select user, ssl_type, ssl_cipher, x509_issuer, x509_subject from mysql.user where user='testuser3';" ,
798+ Expected : []sql.Row {{"testuser3" , "X509" , encodings .StringToBytes ("" ), encodings .StringToBytes ("" ), encodings .StringToBytes ("" )}},
799+ },
800+ {
801+ Query : "select user, plugin, ssl_type, ssl_cipher, x509_issuer, x509_subject from mysql.user where user='testuser4';" ,
802+ Expected : []sql.Row {{"testuser4" , "caching_sha2_password" , "X509" , encodings .StringToBytes ("" ), encodings .StringToBytes ("" ), encodings .StringToBytes ("" )}},
803+ },
804+ {
805+ Query : "select user, ssl_type, ssl_cipher, x509_issuer, x509_subject from mysql.user where user='testuser5';" ,
806+ Expected : []sql.Row {{"testuser5" , "SPECIFIED" , encodings .StringToBytes ("" ), encodings .StringToBytes ("" ), encodings .StringToBytes ("cert_subject" )}},
807+ },
808+ {
809+ Query : "select user, ssl_type, ssl_cipher, x509_issuer, x509_subject from mysql.user where user='testuser6';" ,
810+ Expected : []sql.Row {{"testuser6" , "SPECIFIED" , encodings .StringToBytes ("" ), encodings .StringToBytes ("cert_issuer" ), encodings .StringToBytes ("" )}},
811+ },
812+ {
813+ Query : "select user, ssl_type, ssl_cipher, x509_issuer, x509_subject from mysql.user where user='testuser7';" ,
814+ Expected : []sql.Row {{"testuser7" , "SPECIFIED" , encodings .StringToBytes ("cipher" ), encodings .StringToBytes ("" ), encodings .StringToBytes ("" )}},
815+ },
816+ },
817+ },
775818 {
776819 Name : "Dynamic privilege support" ,
777820 SetUpScript : []string {
0 commit comments