public async Task AuthGSSAPI() { var csb = AppConfig.CreateGSSAPIConnectionStringBuilder(); using var connection = new MySqlConnection(csb.ConnectionString); await connection.OpenAsync(); }
public async Task BadServerSPN() { var csb = AppConfig.CreateGSSAPIConnectionStringBuilder(); csb.ServerSPN = "BadServerSPN"; using var connection = new MySqlConnection(csb.ConnectionString); await Assert.ThrowsAsync <AuthenticationException>(() => connection.OpenAsync()); }
public async Task GoodServerSPN() { var csb = AppConfig.CreateGSSAPIConnectionStringBuilder(); string serverSPN; // Use server's variable gssapi_principal_name as SPN using (var connection = new MySqlConnection(csb.ConnectionString)) { await connection.OpenAsync(); using var cmd = connection.CreateCommand(); cmd.CommandText = "select @@gssapi_principal_name"; serverSPN = (string)await cmd.ExecuteScalarAsync(); } csb.ServerSPN = serverSPN; using (var connection = new MySqlConnection(csb.ConnectionString)) { await connection.OpenAsync(); } }