-
Hi, We're currently upgrading our application from Lettuce 5.3.x to 6.0.3, and one thing I noted (since we have "warnings as errors" enabled for our project) is that the /**
* Configures authentication.
*
* @param password the password
* @return the builder
* @deprecated since 6.0. Use {@link #withPassword(CharSequence)} or {@link #withPassword(char[])} avoid String caching.
*/
@Deprecated
public Builder withPassword(String password) { I'm generally a quite curious person and hence, I wonder a bit about this. Given that However, this must clearly not be how Lettuce intends for me to write my code, so hence the question. Is the idea to force/suggest that my calling code shouldn't cache the password in memory or what's the thinking here? If so, what is the suggested way to retrieve the password in a safe way from "whereever it is kept"? /cc @mp911de |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
The reason is that |
Beta Was this translation helpful? Give feedback.
The reason is that
String
has a strong caching affinity and the JVM cannot be easily GCString
instances. Therefore we suggest either usingchar[]
or a customCharSequence
(StringBuilder
, netty'sAsciiString
). Deprecating this method should raise awareness and indicate that there are better options for password handling thanString
.