File tree Expand file tree Collapse file tree
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 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 ;
@@ -301,6 +302,7 @@ static class LazyPasswordEncoder implements PasswordEncoder {
301302 this .applicationContext = applicationContext ;
302303 }
303304
305+ @ Contract ("!null -> !null; null -> null" )
304306 @ Override
305307 public String encode (CharSequence rawPassword ) {
306308 return getPasswordEncoder ().encode (rawPassword );
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 ;
@@ -292,6 +293,7 @@ static class LazyPasswordEncoder implements PasswordEncoder {
292293 this .applicationContext = applicationContext ;
293294 }
294295
296+ @ Contract ("!null -> !null; null -> null" )
295297 @ Override
296298 public String encode (CharSequence rawPassword ) {
297299 return getPasswordEncoder ().encode (rawPassword );
Original file line number Diff line number Diff line change 1818
1919import org .jspecify .annotations .Nullable ;
2020
21+ import org .springframework .lang .Contract ;
22+
2123public abstract class AbstractValidatingPasswordEncoder implements PasswordEncoder {
2224
2325 @ Override
26+ @ Contract ("!null -> !null; null -> null" )
2427 public final @ Nullable String encode (@ Nullable CharSequence rawPassword ) {
2528 if (rawPassword == null ) {
2629 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