Skip to content

Commit 74d0f79

Browse files
Update DelegatingPasswordEncoder.java
Removes the use of `org.springframework.util.StringUtils` from `DelegatingPasswordEncoder` Closes gh-16442 Signed-off-by: Christian Hösel <[email protected]>
1 parent 5d9011b commit 74d0f79

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Diff for: crypto/src/main/java/org/springframework/security/crypto/password/DelegatingPasswordEncoder.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,8 +19,6 @@
1919
import java.util.HashMap;
2020
import java.util.Map;
2121

22-
import org.springframework.util.StringUtils;
23-
2422
/**
2523
* A password encoder that delegates to another PasswordEncoder based upon a prefixed
2624
* identifier.
@@ -297,10 +295,10 @@ public String encode(CharSequence rawPassword) {
297295
@Override
298296
public boolean matches(CharSequence rawPassword, String prefixEncodedPassword) {
299297
String id = extractId(prefixEncodedPassword);
300-
if (StringUtils.hasText(id)) {
298+
if (id != null && !id.isBlank()) {
301299
throw new IllegalArgumentException(String.format(NO_PASSWORD_ENCODER_MAPPED, id));
302300
}
303-
if (StringUtils.hasText(prefixEncodedPassword)) {
301+
if (prefixEncodedPassword != null && !prefixEncodedPassword.isBlank()) {
304302
int start = prefixEncodedPassword.indexOf(DelegatingPasswordEncoder.this.idPrefix);
305303
int end = prefixEncodedPassword.indexOf(DelegatingPasswordEncoder.this.idSuffix, start);
306304
if (start < 0 && end < 0) {

0 commit comments

Comments
 (0)