Class HaveIBeenPwnedRestApiPasswordChecker
java.lang.Object
org.springframework.security.web.authentication.password.HaveIBeenPwnedRestApiPasswordChecker
- All Implemented Interfaces:
CompromisedPasswordChecker
public final class HaveIBeenPwnedRestApiPasswordChecker
extends Object
implements CompromisedPasswordChecker
Checks if the provided password was leaked by relying on
Have I Been Pwned REST
API. This implementation uses the Search by Range in order to protect the value of
the source password being searched for.
- Since:
- 6.3
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCheck whether the password is compromised.voidsetRestClient(org.springframework.web.client.RestClient restClient) Sets theRestClientto use when making requests to Have I Been Pwned REST API.
-
Constructor Details
-
HaveIBeenPwnedRestApiPasswordChecker
public HaveIBeenPwnedRestApiPasswordChecker()
-
-
Method Details
-
check
Description copied from interface:CompromisedPasswordCheckerCheck whether the password is compromised. If password is null, then the return value must be false forCompromisedPasswordDecision.isCompromised()since a null password represents no password (e.g. the user leverages Passkeys instead).- Specified by:
checkin interfaceCompromisedPasswordChecker- Parameters:
password- the password to check- Returns:
- a non-null
CompromisedPasswordDecision
-
setRestClient
public void setRestClient(org.springframework.web.client.RestClient restClient) Sets theRestClientto use when making requests to Have I Been Pwned REST API. By default, aRestClientwith a base URL ofAPI_URLis used.- Parameters:
restClient- theRestClientto use
-