Skip to content

Commit

Permalink
Update DelegatingPasswordEncoder.java
Browse files Browse the repository at this point in the history
Removes the use of `org.springframework.util.StringUtils` from `DelegatingPasswordEncoder`

Closes gh-16442

Signed-off-by: Christian Hösel <[email protected]>
  • Loading branch information
ChristianHoesel committed Jan 24, 2025
1 parent 5d9011b commit 74d0f79
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,8 +19,6 @@
import java.util.HashMap;
import java.util.Map;

import org.springframework.util.StringUtils;

/**
* A password encoder that delegates to another PasswordEncoder based upon a prefixed
* identifier.
Expand Down Expand Up @@ -297,10 +295,10 @@ public String encode(CharSequence rawPassword) {
@Override
public boolean matches(CharSequence rawPassword, String prefixEncodedPassword) {
String id = extractId(prefixEncodedPassword);
if (StringUtils.hasText(id)) {
if (id != null && !id.isBlank()) {
throw new IllegalArgumentException(String.format(NO_PASSWORD_ENCODER_MAPPED, id));
}
if (StringUtils.hasText(prefixEncodedPassword)) {
if (prefixEncodedPassword != null && !prefixEncodedPassword.isBlank()) {
int start = prefixEncodedPassword.indexOf(DelegatingPasswordEncoder.this.idPrefix);
int end = prefixEncodedPassword.indexOf(DelegatingPasswordEncoder.this.idSuffix, start);
if (start < 0 && end < 0) {
Expand Down

0 comments on commit 74d0f79

Please sign in to comment.