42
42
43
43
@ RunWith (JUnitPlatform .class )
44
44
@ Tag (Constants .fedAuth )
45
- @ Tag (Constants .requireSecret )
46
45
public class FedauthTest extends FedauthCommon {
47
46
static String charTable = TestUtils
48
47
.escapeSingleQuotes (AbstractSQLGenerator .escapeIdentifier (RandomUtil .getIdentifier ("JDBC_FedAuthTest" )));
@@ -286,6 +285,7 @@ public void testAADPasswordApplicationName() throws Exception {
286
285
*/
287
286
@ Deprecated
288
287
@ Test
288
+ @ Tag (Constants .requireSecret )
289
289
public void testAADServicePrincipalAuthDeprecated () {
290
290
String url = "jdbc:sqlserver://" + azureServer + ";database=" + azureDatabase + ";authentication="
291
291
+ SqlAuthentication .ActiveDirectoryServicePrincipal + ";AADSecurePrincipalId=" + applicationClientID
@@ -308,6 +308,7 @@ public void testAADServicePrincipalAuthDeprecated() {
308
308
* encryption.
309
309
*/
310
310
@ Test
311
+ @ Tag (Constants .requireSecret )
311
312
public void testAADServicePrincipalAuth () {
312
313
String url = "jdbc:sqlserver://" + azureServer + ";database=" + azureDatabase + ";authentication="
313
314
+ SqlAuthentication .ActiveDirectoryServicePrincipal + ";Username=" + applicationClientID + ";Password="
@@ -326,6 +327,7 @@ public void testAADServicePrincipalAuth() {
326
327
}
327
328
328
329
@ Test
330
+ @ Tag (Constants .requireSecret )
329
331
public void testAADServicePrincipalAuthFailureOnSubsequentConnectionsWithInvalidatedTokenCacheWithInvalidSecret () throws Exception {
330
332
String url = "jdbc:sqlserver://" + azureServer + ";database=" + azureDatabase + ";authentication="
331
333
+ SqlAuthentication .ActiveDirectoryServicePrincipal + ";Username=" + applicationClientID + ";Password="
@@ -364,6 +366,7 @@ public void testActiveDirectoryPasswordFailureOnSubsequentConnectionsWithInvalid
364
366
}
365
367
366
368
@ Test
369
+ @ Tag (Constants .requireSecret )
367
370
public void testAADServicePrincipalCertAuthFailureOnSubsequentConnectionsWithInvalidatedTokenCacheWithInvalidPassword () throws Exception {
368
371
// Should succeed on valid cert field values
369
372
String url = "jdbc:sqlserver://" + azureServer + ";database=" + azureDatabase + ";authentication="
@@ -389,6 +392,7 @@ public void testAADServicePrincipalCertAuthFailureOnSubsequentConnectionsWithInv
389
392
* Test invalid connection property combinations when using AAD Service Principal Authentication.
390
393
*/
391
394
@ Test
395
+ @ Tag (Constants .requireSecret )
392
396
public void testAADServicePrincipalAuthWrong () {
393
397
String baseUrl = "jdbc:sqlserver://" + azureServer + ";database=" + azureDatabase + ";authentication="
394
398
+ SqlAuthentication .ActiveDirectoryServicePrincipal + ";" ;
@@ -426,6 +430,7 @@ public void testAADServicePrincipalAuthWrong() {
426
430
* encryption.
427
431
*/
428
432
@ Test
433
+ @ Tag (Constants .requireSecret )
429
434
public void testAADServicePrincipalCertAuth () {
430
435
// certificate from AKV has no password
431
436
String url = "jdbc:sqlserver://" + azureServer + ";database=" + azureDatabase + ";authentication="
@@ -449,6 +454,7 @@ public void testAADServicePrincipalCertAuth() {
449
454
* Test invalid connection property combinations when using AAD Service Principal Certificate Authentication.
450
455
*/
451
456
@ Test
457
+ @ Tag (Constants .requireSecret )
452
458
public void testAADServicePrincipalCertAuthWrong () {
453
459
String baseUrl = "jdbc:sqlserver://" + azureServer + ";database=" + azureDatabase + ";authentication="
454
460
+ SqlAuthentication .ActiveDirectoryServicePrincipalCertificate + ";userName="
@@ -488,23 +494,6 @@ public void testAccessTokenCallbackClassConnection() throws Exception {
488
494
try (Connection conn1 = DriverManager .getConnection (cs )) {}
489
495
}
490
496
491
- @ Test
492
- public void testAccessTokenCache () {
493
- try {
494
- SilentParameters silentParameters = SilentParameters .builder (Collections .singleton (spn + "/.default" ))
495
- .build ();
496
-
497
- // this will fail if not cached
498
- CompletableFuture <IAuthenticationResult > future = fedauthClientApp .acquireTokenSilently (silentParameters );
499
- IAuthenticationResult authenticationResult = future .get ();
500
- assertNotNull (authenticationResult .accessToken ());
501
- assertTrue (authenticationResult .accessToken ().equals (accessToken ), accessToken );
502
- } catch (Exception e ) {
503
- fail (e .getMessage ());
504
- }
505
-
506
- }
507
-
508
497
private static void validateException (String url , String resourceKey ) {
509
498
try (Connection conn = DriverManager .getConnection (url )) {
510
499
fail (TestResource .getResource ("R_expectedFailPassed" ));
0 commit comments