-
Notifications
You must be signed in to change notification settings - Fork 430
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
IBM Semeru Runtime Certified Edition for z/OS, Kerberos and mssql-jdbc don't work together #2576 #2581
Open
muskan124947
wants to merge
10
commits into
main
Choose a base branch
from
users/muskgupta/githubIssue#2576
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
IBM Semeru Runtime Certified Edition for z/OS, Kerberos and mssql-jdbc don't work together #2576 #2581
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
be9bd4a
IBM Semeru Runtime Certified Edition for z/OS, Kerberos and mssql-jdb…
muskan124947 d7fdd0a
Added test case
muskan124947 8cdb14e
Comment
muskan124947 efe75af
Updated test
muskan124947 2b4d706
Updated the configuration name JAAS
muskan124947 d2f4e37
Testing purpose
muskan124947 b698940
removed local changes
muskan124947 ab0181a
Added error string and useIbmModule boolean flag
muskan124947 7da553c
Merge branch 'main' into users/muskgupta/githubIssue#2576
muskan124947 6187602
Update isIBM()
muskan124947 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,26 +19,39 @@ | |
private final Configuration delegate; | ||
private AppConfigurationEntry[] defaultValue; | ||
|
||
private static AppConfigurationEntry[] generateDefaultConfiguration() { | ||
if (Util.isIBM()) { | ||
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<String, String> 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) { | ||
return loadIbmModule(); | ||
} | ||
} | ||
|
||
private static AppConfigurationEntry[] loadIbmModule() throws SQLServerException { | ||
try { | ||
Class.forName("com.ibm.security.auth.module.Krb5LoginModule"); | ||
useIbmModule = true; | ||
Map<String, String> confDetailsWithoutPassword = new HashMap<>(); | ||
confDetailsWithoutPassword.put("useDefaultCcache", "true"); | ||
Map<String, String> 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 { | ||
Map<String, String> confDetails = new HashMap<>(); | ||
confDetails.put("useTicketCache", "true"); | ||
return new AppConfigurationEntry[] { | ||
new AppConfigurationEntry("com.sun.security.auth.module.Krb5LoginModule", | ||
AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, confDetails)}; | ||
} catch (ClassNotFoundException ex) { | ||
throw new SQLServerException(SQLServerException.getErrString("R_moduleNotFound"), null); | ||
} | ||
} | ||
|
||
|
@@ -47,8 +60,10 @@ | |
* | ||
* @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 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. codecov error, need a test case for this |
||
this.delegate = delegate; | ||
this.defaultValue = generateDefaultConfiguration(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we only need to do this if isIBM(). Would it be better to just add this in Util.isIBM()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lilgreenbird The issue was reported due to a problem with Util.isIBM method implementation ( #2139)
Do you mean just adding the try catch logic in Util.isIBM method to improve it and leaving everything else unchanged?
So something like this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes that's what I meant :)