Skip to content

Commit d7fdd0a

Browse files
committed
Added test case
1 parent be9bd4a commit d7fdd0a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/test/java/com/microsoft/sqlserver/jdbc/KerberosTest.java

+20
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,26 @@ private static void createKerberosConnection(String connectionString) throws Exc
9292
}
9393
}
9494

95+
/**
96+
* Verify the Kerberos module used
97+
*/
98+
@Test
99+
public void testKerberosConnectionWithDefaultJaasConfig() {
100+
try {
101+
String connectionString = connectionStringKerberos + ";useDefaultJaasConfig=true;";
102+
createKerberosConnection(connectionString);
103+
104+
Configuration config = Configuration.getConfiguration();
105+
AppConfigurationEntry[] entries = config
106+
.getAppConfigurationEntry(SQLServerDriverStringProperty.JAAS_CONFIG_NAME.getDefaultValue());
107+
Assertions.assertNotNull(entries);
108+
Assertions.assertTrue(entries.length > 0);
109+
Assertions.assertEquals("com.sun.security.auth.module.Krb5LoginModule", entries[0].getLoginModuleName());
110+
} catch (Exception e) {
111+
Assertions.fail("Exception was thrown: " + e.getMessage());
112+
}
113+
}
114+
95115
/**
96116
* Overwrites the default JAAS config. Call before making a connection.
97117
*/

0 commit comments

Comments
 (0)