Browse Source

Add nullability contract to `PasswordEncoder#encode`

Signed-off-by: Stefano Cordio <stefano.cordio@gmail.com>
pull/18483/head
Stefano Cordio 1 month ago committed by Rob Winch
parent
commit
a612522ecd
  1. 2
      crypto/src/main/java/org/springframework/security/crypto/password/PasswordEncoder.java

2
crypto/src/main/java/org/springframework/security/crypto/password/PasswordEncoder.java

@ -17,6 +17,7 @@
package org.springframework.security.crypto.password; package org.springframework.security.crypto.password;
import org.jspecify.annotations.Nullable; import org.jspecify.annotations.Nullable;
import org.springframework.lang.Contract;
/** /**
* Service interface for encoding passwords. * Service interface for encoding passwords.
@ -36,6 +37,7 @@ public interface PasswordEncoder {
* @return A non-null encoded password, unless the rawPassword was null in which case * @return A non-null encoded password, unless the rawPassword was null in which case
* the result must be null. * the result must be null.
*/ */
@Contract("null -> null; !null -> !null")
@Nullable String encode(@Nullable CharSequence rawPassword); @Nullable String encode(@Nullable CharSequence rawPassword);
/** /**

Loading…
Cancel
Save