From be9bd4a53beef80c0c509f4eb4ba0c2532d48552 Mon Sep 17 00:00:00 2001 From: Muskan Gupta Date: Fri, 10 Jan 2025 17:25:50 +0530 Subject: [PATCH 1/9] IBM Semeru Runtime Certified Edition for z/OS, Kerberos and mssql-jdbc don't work together #2576 --- .../sqlserver/jdbc/JaasConfiguration.java | 40 +++++++++++-------- .../sqlserver/jdbc/KerbAuthentication.java | 6 ++- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/JaasConfiguration.java b/src/main/java/com/microsoft/sqlserver/jdbc/JaasConfiguration.java index 2f8dda592..1fd8c1f92 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/JaasConfiguration.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/JaasConfiguration.java @@ -19,26 +19,32 @@ public class JaasConfiguration extends Configuration { private final Configuration delegate; private AppConfigurationEntry[] defaultValue; - private static AppConfigurationEntry[] generateDefaultConfiguration() { - if (Util.isIBM()) { - Map confDetailsWithoutPassword = new HashMap<>(); - confDetailsWithoutPassword.put("useDefaultCcache", "true"); - Map confDetailsWithPassword = new HashMap<>(); - // We generated a two configurations fallback that is suitable for password and password-less authentication - // See - // https://www.ibm.com/support/knowledgecenter/SSYKE2_8.0.0/com.ibm.java.security.component.80.doc/security-component/jgssDocs/jaas_login_user.html - final String ibmLoginModule = "com.ibm.security.auth.module.Krb5LoginModule"; - return new AppConfigurationEntry[] { - new AppConfigurationEntry(ibmLoginModule, AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT, - confDetailsWithoutPassword), - new AppConfigurationEntry(ibmLoginModule, AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT, - confDetailsWithPassword)}; - } else { + private static AppConfigurationEntry[] generateDefaultConfiguration() throws SQLServerException { + try { + Class.forName("com.sun.security.auth.module.Krb5LoginModule"); Map confDetails = new HashMap<>(); confDetails.put("useTicketCache", "true"); return new AppConfigurationEntry[] { new AppConfigurationEntry("com.sun.security.auth.module.Krb5LoginModule", AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, confDetails)}; + } catch (ClassNotFoundException e) { + try { + Class.forName("com.ibm.security.auth.module.Krb5LoginModule"); + Map confDetailsWithoutPassword = new HashMap<>(); + confDetailsWithoutPassword.put("useDefaultCcache", "true"); + Map confDetailsWithPassword = new HashMap<>(); + // We generated a two configurations fallback that is suitable for password and password-less authentication + // See + // https://www.ibm.com/support/knowledgecenter/SSYKE2_8.0.0/com.ibm.java.security.component.80.doc/security-component/jgssDocs/jaas_login_user.html + final String ibmLoginModule = "com.ibm.security.auth.module.Krb5LoginModule"; + return new AppConfigurationEntry[] { + new AppConfigurationEntry(ibmLoginModule, AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT, + confDetailsWithoutPassword), + new AppConfigurationEntry(ibmLoginModule, AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT, + confDetailsWithPassword)}; + } catch (ClassNotFoundException ex) { + throw new SQLServerException(SQLServerException.getErrString("R_moduleNotFound"), null); + } } } @@ -47,8 +53,10 @@ private static AppConfigurationEntry[] generateDefaultConfiguration() { * * @param delegate * a possibly null delegate + * @throws SQLServerException + * if neither Kerberos module is found: com.sun.security.auth.module.Krb5LoginModule or com.ibm.security.auth.module.Krb5LoginModule */ - JaasConfiguration(Configuration delegate) { + JaasConfiguration(Configuration delegate) throws SQLServerException { this.delegate = delegate; this.defaultValue = generateDefaultConfiguration(); } diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/KerbAuthentication.java b/src/main/java/com/microsoft/sqlserver/jdbc/KerbAuthentication.java index d02238196..95462737e 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/KerbAuthentication.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/KerbAuthentication.java @@ -45,7 +45,11 @@ final class KerbAuthentication extends SSPIAuthentication { static { // Overrides the default JAAS configuration loader. // This one will forward to the default one in all cases but the default configuration is empty. - Configuration.setConfiguration(new JaasConfiguration(Configuration.getConfiguration())); + try { + Configuration.setConfiguration(new JaasConfiguration(Configuration.getConfiguration())); + } catch (SQLServerException e) { + e.printStackTrace(); + } } /** From d7fdd0abd0fed44d847cd8ec142ce9b967008f91 Mon Sep 17 00:00:00 2001 From: Muskan Gupta Date: Wed, 15 Jan 2025 15:01:50 +0530 Subject: [PATCH 2/9] Added test case --- .../sqlserver/jdbc/KerberosTest.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/KerberosTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/KerberosTest.java index 47f0a9252..e009230b0 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/KerberosTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/KerberosTest.java @@ -92,6 +92,26 @@ private static void createKerberosConnection(String connectionString) throws Exc } } + /** + * Verify the Kerberos module used + */ + @Test + public void testKerberosConnectionWithDefaultJaasConfig() { + try { + String connectionString = connectionStringKerberos + ";useDefaultJaasConfig=true;"; + createKerberosConnection(connectionString); + + Configuration config = Configuration.getConfiguration(); + AppConfigurationEntry[] entries = config + .getAppConfigurationEntry(SQLServerDriverStringProperty.JAAS_CONFIG_NAME.getDefaultValue()); + Assertions.assertNotNull(entries); + Assertions.assertTrue(entries.length > 0); + Assertions.assertEquals("com.sun.security.auth.module.Krb5LoginModule", entries[0].getLoginModuleName()); + } catch (Exception e) { + Assertions.fail("Exception was thrown: " + e.getMessage()); + } + } + /** * Overwrites the default JAAS config. Call before making a connection. */ From 8cdb14ece316134cd8bc00d2b24f177c854b5031 Mon Sep 17 00:00:00 2001 From: Muskan Gupta Date: Wed, 15 Jan 2025 15:30:39 +0530 Subject: [PATCH 3/9] Comment --- src/test/java/com/microsoft/sqlserver/jdbc/KerberosTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/KerberosTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/KerberosTest.java index e009230b0..3d3d44070 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/KerberosTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/KerberosTest.java @@ -93,7 +93,7 @@ private static void createKerberosConnection(String connectionString) throws Exc } /** - * Verify the Kerberos module used + * Test to verify the Kerberos module used */ @Test public void testKerberosConnectionWithDefaultJaasConfig() { From efe75af34949e571a5c1c7395738b30980bdaf26 Mon Sep 17 00:00:00 2001 From: Muskan Gupta Date: Thu, 16 Jan 2025 09:46:55 +0530 Subject: [PATCH 4/9] Updated test --- src/test/java/com/microsoft/sqlserver/jdbc/KerberosTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/KerberosTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/KerberosTest.java index 3d3d44070..5bbccc097 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/KerberosTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/KerberosTest.java @@ -98,6 +98,9 @@ private static void createKerberosConnection(String connectionString) throws Exc @Test public void testKerberosConnectionWithDefaultJaasConfig() { try { + // Set a mock JAAS configuration using the existing method + overwriteJaasConfig(); + String connectionString = connectionStringKerberos + ";useDefaultJaasConfig=true;"; createKerberosConnection(connectionString); From 2b4d706290fb2e559fd7e49a38e8eef82e28edf3 Mon Sep 17 00:00:00 2001 From: Muskan Gupta Date: Thu, 16 Jan 2025 11:33:41 +0530 Subject: [PATCH 5/9] Updated the configuration name JAAS --- src/test/java/com/microsoft/sqlserver/jdbc/KerberosTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/KerberosTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/KerberosTest.java index 5bbccc097..e874a44d1 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/KerberosTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/KerberosTest.java @@ -105,8 +105,7 @@ public void testKerberosConnectionWithDefaultJaasConfig() { createKerberosConnection(connectionString); Configuration config = Configuration.getConfiguration(); - AppConfigurationEntry[] entries = config - .getAppConfigurationEntry(SQLServerDriverStringProperty.JAAS_CONFIG_NAME.getDefaultValue()); + AppConfigurationEntry[] entries = config.getAppConfigurationEntry("CLIENT_CONTEXT_NAME"); Assertions.assertNotNull(entries); Assertions.assertTrue(entries.length > 0); Assertions.assertEquals("com.sun.security.auth.module.Krb5LoginModule", entries[0].getLoginModuleName()); From d2f4e37171563a0b30b7864dc2466f69072fe499 Mon Sep 17 00:00:00 2001 From: Muskan Gupta Date: Tue, 21 Jan 2025 13:32:20 +0530 Subject: [PATCH 6/9] Testing purpose --- pom.xml | 6 +++--- .../sqlserver/jdbc/KerbAuthentication.java | 20 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 026144f46..5c8521043 100644 --- a/pom.xml +++ b/pom.xml @@ -371,6 +371,9 @@ jre21 + + true + ${project.artifactId}-${project.version}.jre21${releaseExt} @@ -404,9 +407,6 @@ jre23 - - true - ${project.artifactId}-${project.version}.jre23${releaseExt} diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/KerbAuthentication.java b/src/main/java/com/microsoft/sqlserver/jdbc/KerbAuthentication.java index 95462737e..e94edae59 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/KerbAuthentication.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/KerbAuthentication.java @@ -13,7 +13,7 @@ import java.util.logging.Level; import javax.security.auth.Subject; -import javax.security.auth.login.Configuration; +//import javax.security.auth.login.Configuration; import javax.security.auth.login.LoginContext; import javax.security.auth.login.LoginException; @@ -42,15 +42,15 @@ final class KerbAuthentication extends SSPIAuthentication { private boolean useDefaultNativeGSSCredential = false; private GSSContext peerContext = null; - static { - // Overrides the default JAAS configuration loader. - // This one will forward to the default one in all cases but the default configuration is empty. - try { - Configuration.setConfiguration(new JaasConfiguration(Configuration.getConfiguration())); - } catch (SQLServerException e) { - e.printStackTrace(); - } - } + // static { + // // Overrides the default JAAS configuration loader. + // // This one will forward to the default one in all cases but the default configuration is empty. + // try { + // Configuration.setConfiguration(new JaasConfiguration(Configuration.getConfiguration())); + // } catch (SQLServerException e) { + // e.printStackTrace(); + // } + // } /** * Initializes the Kerberos client security context From b6989406c5c7b42aeb650f0fdcb9c833273701da Mon Sep 17 00:00:00 2001 From: Muskan Gupta Date: Tue, 21 Jan 2025 13:36:26 +0530 Subject: [PATCH 7/9] removed local changes --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 5c8521043..026144f46 100644 --- a/pom.xml +++ b/pom.xml @@ -371,9 +371,6 @@ jre21 - - true - ${project.artifactId}-${project.version}.jre21${releaseExt} @@ -407,6 +404,9 @@ jre23 + + true + ${project.artifactId}-${project.version}.jre23${releaseExt} From ab0181ae61e89a807e7d6a22c8bec2b72de15572 Mon Sep 17 00:00:00 2001 From: Muskan Gupta Date: Fri, 24 Jan 2025 13:00:11 +0530 Subject: [PATCH 8/9] Added error string and useIbmModule boolean flag --- .../sqlserver/jdbc/JaasConfiguration.java | 41 +++++++++++-------- .../sqlserver/jdbc/KerbAuthentication.java | 20 ++++----- .../sqlserver/jdbc/SQLServerResource.java | 1 + 3 files changed, 35 insertions(+), 27 deletions(-) diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/JaasConfiguration.java b/src/main/java/com/microsoft/sqlserver/jdbc/JaasConfiguration.java index 1fd8c1f92..889bcdaa4 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/JaasConfiguration.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/JaasConfiguration.java @@ -19,8 +19,13 @@ public class JaasConfiguration extends Configuration { private final Configuration delegate; private AppConfigurationEntry[] defaultValue; + private static boolean useIbmModule = false; + private static AppConfigurationEntry[] generateDefaultConfiguration() throws SQLServerException { try { + if (useIbmModule) { + return loadIbmModule(); + } Class.forName("com.sun.security.auth.module.Krb5LoginModule"); Map confDetails = new HashMap<>(); confDetails.put("useTicketCache", "true"); @@ -28,23 +33,25 @@ private static AppConfigurationEntry[] generateDefaultConfiguration() throws SQL new AppConfigurationEntry("com.sun.security.auth.module.Krb5LoginModule", AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, confDetails)}; } catch (ClassNotFoundException e) { - try { - Class.forName("com.ibm.security.auth.module.Krb5LoginModule"); - Map confDetailsWithoutPassword = new HashMap<>(); - confDetailsWithoutPassword.put("useDefaultCcache", "true"); - Map confDetailsWithPassword = new HashMap<>(); - // We generated a two configurations fallback that is suitable for password and password-less authentication - // See - // https://www.ibm.com/support/knowledgecenter/SSYKE2_8.0.0/com.ibm.java.security.component.80.doc/security-component/jgssDocs/jaas_login_user.html - final String ibmLoginModule = "com.ibm.security.auth.module.Krb5LoginModule"; - return new AppConfigurationEntry[] { - new AppConfigurationEntry(ibmLoginModule, AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT, - confDetailsWithoutPassword), - new AppConfigurationEntry(ibmLoginModule, AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT, - confDetailsWithPassword)}; - } catch (ClassNotFoundException ex) { - throw new SQLServerException(SQLServerException.getErrString("R_moduleNotFound"), null); - } + return loadIbmModule(); + } + } + + private static AppConfigurationEntry[] loadIbmModule() throws SQLServerException { + try { + Class.forName("com.ibm.security.auth.module.Krb5LoginModule"); + useIbmModule = true; + Map confDetailsWithoutPassword = new HashMap<>(); + confDetailsWithoutPassword.put("useDefaultCcache", "true"); + Map confDetailsWithPassword = new HashMap<>(); + final String ibmLoginModule = "com.ibm.security.auth.module.Krb5LoginModule"; + return new AppConfigurationEntry[] { + new AppConfigurationEntry(ibmLoginModule, AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT, + confDetailsWithoutPassword), + new AppConfigurationEntry(ibmLoginModule, AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT, + confDetailsWithPassword)}; + } catch (ClassNotFoundException ex) { + throw new SQLServerException(SQLServerException.getErrString("R_moduleNotFound"), null); } } diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/KerbAuthentication.java b/src/main/java/com/microsoft/sqlserver/jdbc/KerbAuthentication.java index e94edae59..95462737e 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/KerbAuthentication.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/KerbAuthentication.java @@ -13,7 +13,7 @@ import java.util.logging.Level; import javax.security.auth.Subject; -//import javax.security.auth.login.Configuration; +import javax.security.auth.login.Configuration; import javax.security.auth.login.LoginContext; import javax.security.auth.login.LoginException; @@ -42,15 +42,15 @@ final class KerbAuthentication extends SSPIAuthentication { private boolean useDefaultNativeGSSCredential = false; private GSSContext peerContext = null; - // static { - // // Overrides the default JAAS configuration loader. - // // This one will forward to the default one in all cases but the default configuration is empty. - // try { - // Configuration.setConfiguration(new JaasConfiguration(Configuration.getConfiguration())); - // } catch (SQLServerException e) { - // e.printStackTrace(); - // } - // } + static { + // Overrides the default JAAS configuration loader. + // This one will forward to the default one in all cases but the default configuration is empty. + try { + Configuration.setConfiguration(new JaasConfiguration(Configuration.getConfiguration())); + } catch (SQLServerException e) { + e.printStackTrace(); + } + } /** * Initializes the Kerberos client security context diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResource.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResource.java index c9d875e58..6d39575ec 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResource.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResource.java @@ -550,6 +550,7 @@ protected Object[][] getContents() { {"R_InvalidRuleFormat", "Wrong number of parameters supplied to rule. Number of parameters: {0}, expected: 2 or 3."}, {"R_InvalidRetryInterval", "Current retry interval: {0}, is longer than queryTimeout: {1}."}, {"R_UnableToFindClass", "Unable to locate specified class: {0}"}, + {"R_moduleNotFound", "Neither com.sun.security.auth.module.Krb5LoginModule nor com.ibm.security.auth.module.Krb5LoginModule was found."}, }; } // @formatter:on From 6187602300574aee975b21ccdd924ad7fcdde8c3 Mon Sep 17 00:00:00 2001 From: Muskan Gupta Date: Wed, 29 Jan 2025 10:27:05 +0530 Subject: [PATCH 9/9] Update isIBM() --- .../sqlserver/jdbc/JaasConfiguration.java | 5 +---- .../sqlserver/jdbc/KerbAuthentication.java | 6 +++--- .../com/microsoft/sqlserver/jdbc/Util.java | 19 ++++++++++++++++++- .../sqlserver/jdbc/KerberosTest.java | 19 ++++++++++++++++++- 4 files changed, 40 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/JaasConfiguration.java b/src/main/java/com/microsoft/sqlserver/jdbc/JaasConfiguration.java index 889bcdaa4..6f23b965e 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/JaasConfiguration.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/JaasConfiguration.java @@ -19,11 +19,9 @@ public class JaasConfiguration extends Configuration { private final Configuration delegate; private AppConfigurationEntry[] defaultValue; - private static boolean useIbmModule = false; - private static AppConfigurationEntry[] generateDefaultConfiguration() throws SQLServerException { try { - if (useIbmModule) { + if (Util.isIBM()) { return loadIbmModule(); } Class.forName("com.sun.security.auth.module.Krb5LoginModule"); @@ -40,7 +38,6 @@ private static AppConfigurationEntry[] generateDefaultConfiguration() throws SQL private static AppConfigurationEntry[] loadIbmModule() throws SQLServerException { try { Class.forName("com.ibm.security.auth.module.Krb5LoginModule"); - useIbmModule = true; Map confDetailsWithoutPassword = new HashMap<>(); confDetailsWithoutPassword.put("useDefaultCcache", "true"); Map confDetailsWithPassword = new HashMap<>(); diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/KerbAuthentication.java b/src/main/java/com/microsoft/sqlserver/jdbc/KerbAuthentication.java index 95462737e..1541d007f 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/KerbAuthentication.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/KerbAuthentication.java @@ -43,12 +43,12 @@ final class KerbAuthentication extends SSPIAuthentication { private GSSContext peerContext = null; static { - // Overrides the default JAAS configuration loader. - // This one will forward to the default one in all cases but the default configuration is empty. try { + // Overrides the default JAAS configuration loader. + // This one will forward to the default one in all cases but the default configuration is empty. Configuration.setConfiguration(new JaasConfiguration(Configuration.getConfiguration())); } catch (SQLServerException e) { - e.printStackTrace(); + throw new RuntimeException("Failed to set JAAS configuration: " + e.getMessage(), e); } } diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/Util.java b/src/main/java/com/microsoft/sqlserver/jdbc/Util.java index 374626cbe..551dd55d7 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/Util.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/Util.java @@ -47,9 +47,26 @@ private Util() { static final String SYSTEM_JRE = System.getProperty("java.vendor") + " " + System.getProperty("java.version"); private static final Lock LOCK = new ReentrantLock(); + private static Boolean isIBM = null; + static boolean isIBM() { + if (isIBM != null) { + return isIBM; + } + String vmName = System.getProperty("java.vm.name"); - return SYSTEM_JRE.startsWith("IBM") && vmName.startsWith("IBM"); + if (vmName != null && vmName.startsWith("IBM")) { + isIBM = true; + return isIBM; + } + + try { + Class.forName("com.ibm.security.auth.module.Krb5LoginModule"); + isIBM = true; + } catch (ClassNotFoundException ex) { + isIBM = false; + } + return isIBM; } static String getJVMArchOnWindows() { diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/KerberosTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/KerberosTest.java index e874a44d1..50ecaa768 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/KerberosTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/KerberosTest.java @@ -108,12 +108,29 @@ public void testKerberosConnectionWithDefaultJaasConfig() { AppConfigurationEntry[] entries = config.getAppConfigurationEntry("CLIENT_CONTEXT_NAME"); Assertions.assertNotNull(entries); Assertions.assertTrue(entries.length > 0); - Assertions.assertEquals("com.sun.security.auth.module.Krb5LoginModule", entries[0].getLoginModuleName()); + if (Util.isIBM()) { + Assertions.assertEquals("com.ibm.security.auth.module.Krb5LoginModule", entries[0].getLoginModuleName()); + } else { + Assertions.assertEquals("com.sun.security.auth.module.Krb5LoginModule", entries[0].getLoginModuleName()); + } } catch (Exception e) { Assertions.fail("Exception was thrown: " + e.getMessage()); } } + /** + * Test to verify the JaasConfiguration constructor + */ + @Test + public void testJaasConfigurationConstructor() { + try { + JaasConfiguration config = new JaasConfiguration(Configuration.getConfiguration()); + Assertions.assertNotNull(config); + } catch (SQLServerException e) { + Assertions.fail("Exception was thrown: " + e.getMessage()); + } + } + /** * Overwrites the default JAAS config. Call before making a connection. */