Class PasswordResetConfigurer
The pages of a password reset by mail.
http.formLogin(Customizer.withDefaults())
.passwordReset(Customizer.withDefaults());
cn1.security.base-url=https://example.com
GET /forgot-password asks for a user name and POST /forgot-password
mails that user a link, answering the same whether or not there is such a
user. The link opens GET /reset-password, which asks for the new
password, and POST /reset-password sets it and sends the user to the
sign-in page. All four are open to everyone, whatever the authorization
rules say.
The work is a PasswordResetService's: the one given here, or the
application's bean of that type.
The address in the link
The link is mailed to somebody other than whoever asked for it, so it is
never built from the request's Host header, which the caller chooses.
It starts with cn1.security.base-url, or what baseUrl is given. With
neither, a request to localhost gets a link to itself, which is what a
developer's machine needs, and any other request is refused with an error
that names the setting.
How often
Asking is counted for the client's network and for the name asked about,
5 in 15 minutes each unless attemptLimiter(RateLimiter) says otherwise, and more are
answered 429. The count for a name is kept whether or not there is such a
user, so it tells nobody which there are; it is what stops one person's
mailbox being filled from many addresses.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionattemptLimiter(RateLimiter attemptLimiter) What counts requests for a link, in place of the application'sRateLimiterbean and of the count kept in this process; null to count none.The address the server is reached at from outside, in place of thecn1.security.base-urlsetting.voidinit(HttpSecurity http) Shares what other parts need to know; nothing by default.requestUrl(String requestUrl) Where a reset is asked for;/forgot-passwordunless set.Where the mailed link leads and the new password is posted;/reset-passwordunless set.servePages(boolean servePages) False leaves the twoGETpages to the application, which then posts the fieldsusername, andtoken,passwordandconfirm, to the same paths.service(PasswordResetService service) What mails the link and sets the password, in place of the application's bean.Methods inherited from class SecurityConfigurer
configure, disable, getBuilder
-
Field Details
-
BASE_URL
The setting that holds the address the server is reached at from outside,https://example.com, with no path.- See Also:
-
-
Method Details
-
service
What mails the link and sets the password, in place of the application's bean. -
requestUrl
Where a reset is asked for;/forgot-passwordunless set. -
resetUrl
Where the mailed link leads and the new password is posted;/reset-passwordunless set. -
baseUrl
The address the server is reached at from outside, in place of thecn1.security.base-urlsetting. -
servePages
False leaves the twoGETpages to the application, which then posts the fieldsusername, andtoken,passwordandconfirm, to the same paths. -
attemptLimiter
What counts requests for a link, in place of the application'sRateLimiterbean and of the count kept in this process; null to count none. -
init
Description copied from class:SecurityConfigurerShares what other parts need to know; nothing by default.- Overrides:
initin classSecurityConfigurer
-