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

char[] password for Driver-based configurations #2021

Open
cquezel opened this issue Dec 21, 2022 · 1 comment
Open

char[] password for Driver-based configurations #2021

cquezel opened this issue Dec 21, 2022 · 1 comment

Comments

@cquezel
Copy link

cquezel commented Dec 21, 2022

I'm pretty sure this is not a bug but a feature request but here it goes:

I just updated the JDBC driver I was using and the connexion pool configuration started failling.
The problem is that my JDBC driver's setPassword method now has this signature:

void com.ibm.as400.access.AS400JDBCDataSource.setPassword(char[])

Notice "not a String."

In the PropertyElf.setProperty method, there is an if to branch to the various types of parameters (int, long, short, boolean, String). char[] could be added to the list. :)

There is a discussion on stackoverflow on why char[] is better than String for password: https://stackoverflow.com/questions/8881291/why-is-char-preferred-over-string-for-passwords

@legrottagliegionata
Copy link

Hi, I propose to use one more condition to select the correct method to invoke. This could be an example.
var writeMethod = methods.stream().filter(m -> m.getName().equals(methodName) && m.getParameterCount() == 1 && m.getParameterTypes()[0].equals(paramValue.getClass())).findFirst().orElse(null);

in my case the AS400JDBCDataSource class has two setPassword methods, one with char[] and the other String, in this way we should be able to use the right method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants