File tree Expand file tree Collapse file tree 4 files changed +7
-1
lines changed
config/src/main/java/org/springframework/security/config/annotation
authentication/configuration
crypto/src/main/java/org/springframework/security/crypto/password Expand file tree Collapse file tree 4 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 3636import org .springframework .context .annotation .Import ;
3737import org .springframework .core .annotation .AnnotationAwareOrderComparator ;
3838import org .springframework .core .log .LogMessage ;
39+ import org .springframework .lang .Contract ;
3940import org .springframework .security .authentication .AuthenticationEventPublisher ;
4041import org .springframework .security .authentication .AuthenticationManager ;
4142import org .springframework .security .authentication .DefaultAuthenticationEventPublisher ;
@@ -302,6 +303,7 @@ static class LazyPasswordEncoder implements PasswordEncoder {
302303 }
303304
304305 @ Override
306+ @ Contract ("!null -> !null; null -> null" )
305307 public String encode (CharSequence rawPassword ) {
306308 return getPasswordEncoder ().encode (rawPassword );
307309 }
Original file line number Diff line number Diff line change 3030import org .springframework .core .MethodParameter ;
3131import org .springframework .core .ResolvableType ;
3232import org .springframework .core .io .support .SpringFactoriesLoader ;
33+ import org .springframework .lang .Contract ;
3334import org .springframework .security .authentication .AuthenticationEventPublisher ;
3435import org .springframework .security .authentication .AuthenticationManager ;
3536import org .springframework .security .authentication .DefaultAuthenticationEventPublisher ;
@@ -293,6 +294,7 @@ static class LazyPasswordEncoder implements PasswordEncoder {
293294 }
294295
295296 @ Override
297+ @ Contract ("!null -> !null; null -> null" )
296298 public String encode (CharSequence rawPassword ) {
297299 return getPasswordEncoder ().encode (rawPassword );
298300 }
Original file line number Diff line number Diff line change 1818
1919import org .jspecify .annotations .Nullable ;
2020
21+ import org .springframework .lang .Contract ;
2122import org .springframework .util .StringUtils ;
2223
2324/**
3334public abstract class AbstractValidatingPasswordEncoder implements PasswordEncoder {
3435
3536 @ Override
37+ @ Contract ("!null -> !null; null -> null" )
3638 public final @ Nullable String encode (@ Nullable CharSequence rawPassword ) {
3739 if (rawPassword == null ) {
3840 return null ;
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ public interface PasswordEncoder {
3838 * @return A non-null encoded password, unless the rawPassword was null in which case
3939 * the result must be null.
4040 */
41- @ Contract ("null -> null; ! null -> ! null" )
41+ @ Contract ("! null -> ! null; null -> null" )
4242 @ Nullable String encode (@ Nullable CharSequence rawPassword );
4343
4444 /**
You can’t perform that action at this time.
0 commit comments