Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Azure Active Directory tests for Azure Data Explorer using user/password/applicationName AND removed deprecated tags to fix build warnings #1755

Merged
merged 3 commits into from
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,9 @@ public class SQLServerConnection implements ISQLServerConnection, java.io.Serial
private String clientKeyPassword = "";

/** AAD principal id */
@Deprecated
private String aadPrincipalID = "";

/** AAD principal secret */
@Deprecated
private String aadPrincipalSecret = "";

/** sendTemporalDataTypesAsStringForBulkCopy flag */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,7 @@ enum SQLServerDriverStringProperty {
CLIENT_CERTIFICATE("clientCertificate", ""),
CLIENT_KEY("clientKey", ""),
CLIENT_KEY_PASSWORD("clientKeyPassword", ""),
@Deprecated
AAD_SECURE_PRINCIPAL_ID("AADSecurePrincipalId", ""),
@Deprecated
AAD_SECURE_PRINCIPAL_SECRET("AADSecurePrincipalSecret", ""),
MAX_RESULT_BUFFER("maxResultBuffer", "-1");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public class FedauthCommon extends AbstractTest {

static boolean enableADIntegrated = false;

static String hostNameInCertificate = null;
static String applicationName = null;
static String kustoServer = null;
static String spn = null;
static String stsurl = null;
static String fedauthClientId = null;
Expand Down Expand Up @@ -140,6 +143,9 @@ public static void getConfigs() throws Exception {
fedauthJksPaths = getConfiguredProperty("fedauthJksPaths", "").split(Constants.SEMI_COLON);
fedauthJavaKeyAliases = getConfiguredProperty("fedauthJavaKeyAliases", "").split(Constants.SEMI_COLON);

hostNameInCertificate = getConfiguredProperty("hostNameInCertificate");
applicationName = getConfiguredProperty("applicationName");
kustoServer = getConfiguredProperty("kustoServer");
spn = getConfiguredProperty("spn");
stsurl = getConfiguredProperty("stsurl");
fedauthClientId = getConfiguredProperty("fedauthClientId");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,29 @@ public void testCorrectAccessTokenDS() throws SQLException {
}
}

/**
* Test AAD Password Authentication using username/password in connection string, data source and SSL
* encryption, in addition to application name in order to use different authorities.
*
* @throws Exception
* if an exception occurs
*/
@Test
public void testAADPasswordApplicationName() throws Exception {
String url = "jdbc:sqlserver://" + kustoServer + ";database=" + azureDatabase + ";user=" + azureUserName
+ ";password=" + azurePassword + ";Authentication="
+ SqlAuthentication.ActiveDirectoryPassword.toString() + ";hostNameInCertificate="
+ hostNameInCertificate + ";applicationName=" + applicationName
+ ";encrypt=true;trustServerCertificate=true;";
SQLServerDataSource ds = new SQLServerDataSource();
ds.setURL(url);

try (Connection con = ds.getConnection()) {
} catch (Exception e) {
fail(e.getMessage());
}
}

/**
* Test AAD Service Principal Authentication using AADSecurePrincipalId/AADSecurePrincipalSecret in connection
* string, data source and SSL encryption.
Expand Down