Skip to content

Commit 0ba7c76

Browse files
authored
chore: upgrade Spring User Framework to 5.3.1 (#88)
5.3.1 fixes POST /user/resendRegistrationToken, which bound the full registration UserDto and so rejected the email-only payload resend-verification.js posts with HTTP 400. It now binds ResendVerificationDto and returns 200. - build.gradle: 5.3.0 -> 5.3.1 - UserApiIntegrationTestFixed: cover the resend endpoint (email-only body succeeds, unknown address returns the identical generic body, malformed email returns 400). The first two fail against 5.3.0 and pass against 5.3.1 - docs/AUTHENTICATION.md, docs/CONFIGURATION.md: drop the known-limitation notes describing the 5.3.0 breakage - README.md, docs/EXTENDING.md: version references - CHANGELOG.md: 2026-08-18 entry
1 parent 473e73d commit 0ba7c76

7 files changed

Lines changed: 68 additions & 8 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,23 @@ the library.
99

1010
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
1111

12+
## 2026-08-18
13+
14+
### Changed
15+
- Spring User Framework upgraded from 5.3.0 to 5.3.1 (`build.gradle`). Patch release: no API,
16+
configuration, or behavior changes for this app beyond the resend fix below
17+
18+
### Fixed
19+
- The resend-verification page (`/user/request-new-verification-email.html`) works again.
20+
`UserAPI.resendRegistrationToken` now binds `ResendVerificationDto` instead of the full registration
21+
`UserDto`, so the email-only payload `resend-verification.js` posts passes validation and returns
22+
HTTP 200 instead of 400. The fix is framework-side; this app needed only the version bump
23+
24+
### Added
25+
- `UserApiIntegrationTestFixed` covers `POST /user/resendRegistrationToken`: an email-only body succeeds,
26+
an unknown address returns the identical generic body (anti-enumeration), and a malformed email is
27+
rejected with HTTP 400. The first two fail against 5.3.0 and pass against 5.3.1
28+
1229
## 2026-08-17
1330

1431
### Changed

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Documentation for this demo is in [docs/](docs); the framework's own documentati
2222
| main | 4.1.x | 5.3.x | 21 | `main` |
2323
| 1.0.0-springboot3 | 3.5.x | 3.5.x | 17 | [`v1.0.0-springboot3`](https://github.com/devondragon/SpringUserFrameworkDemoApp/tree/v1.0.0-springboot3) |
2424

25-
`main` is on Spring Boot 4.1.0 and framework 5.3.0 ([build.gradle](build.gradle)). For the Spring Boot 3.5.6
25+
`main` is on Spring Boot 4.1.0 and framework 5.3.1 ([build.gradle](build.gradle)). For the Spring Boot 3.5.6
2626
and framework 3.5.1 combination on Java 17, `git checkout v1.0.0-springboot3` after cloning.
2727

2828
## What this demo shows

‎build.gradle‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ repositories {
3939

4040
dependencies {
4141
// DigitalSanctuary Spring User Framework
42-
implementation 'com.digitalsanctuary:ds-spring-user-framework:5.3.0'
42+
implementation 'com.digitalsanctuary:ds-spring-user-framework:5.3.1'
4343

4444
// WebAuthn support (Passkey authentication)
4545
implementation 'org.springframework.security:spring-security-webauthn'

‎docs/AUTHENTICATION.md‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@ failed logins and lockouts land in the audit log.
2525
`/user/request-new-verification-email.html`
2626
([`resend-verification.js`](../src/main/resources/static/js/user/resend-verification.js) posts
2727
`POST /user/resendRegistrationToken`). Under `docker compose up` the message is captured by Mailpit
28-
rather than delivered: open <http://localhost:8025> and click the link there. The resend page itself
29-
is currently broken against `ds-spring-user-framework:5.3.0`: the endpoint binds the full
30-
registration `UserDto`, whose `firstName`/`lastName`/`password`/`matchingPassword` are `@NotBlank`,
31-
so the email-only payload the page posts is rejected with HTTP 400 and no mail goes out.
28+
rather than delivered: open <http://localhost:8025> and click the link there. The endpoint always
29+
returns the same generic success response whether the address is unknown, already verified, or
30+
genuinely awaiting verification, so it leaks nothing about which accounts exist.
3231
- `false`: the account is created enabled, the framework logs the user straight in, and the browser
3332
lands on `/user/registration-complete.html`. `application-local.yml-example:131` sets it false, so
3433
the Gradle `local` run path needs no SMTP server at all.

‎docs/CONFIGURATION.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pattern works for any other key, e.g. `USER_SECURITY_BCRYPTSTRENGTH` for `user.s
7575

7676
- `spring.mail.username`, `spring.mail.password`, `spring.mail.host`, `spring.mail.port` (`application.yml:2-6`) configure the SMTP transport used for verification, password-reset, and notification email. The base file's `host` is a placeholder SES endpoint; set real credentials in your profile.
7777
- `user.registration.sendVerificationEmail` (`application.yml:113`) controls whether a new account must click a verification link before it can log in. `false` enables the account immediately at registration.
78-
- Both Docker stacks (`compose.yaml` and `docker-compose-keycloak.yml`) run a `mailpit` service ([Mailpit](https://mailpit.axllent.org/)) that captures outbound mail instead of delivering it, and serves it as a web inbox on <http://localhost:8025>. The app container reaches it over plain SMTP with `SPRING_MAIL_HOST: mailpit` and `SPRING_MAIL_PORT: 1025`, auth and STARTTLS off. Neither stack overrides `user.registration.sendVerificationEmail`, so registration verification and password reset run their real email flows: read the message in the web inbox and click the link. Nothing leaves the machine, and Mailpit keeps no volume, so `docker compose down` discards the captured mail. The resend-verification page does not work against `ds-spring-user-framework:5.3.0`: `UserAPI.resendRegistrationToken` binds the full registration `UserDto`, whose `firstName`, `lastName`, `password`, and `matchingPassword` are `@NotBlank`, so the email-only payload that `resend-verification.js` posts is rejected with HTTP 400 and no mail is sent. That is a framework-side bug, not a stack setting.
78+
- Both Docker stacks (`compose.yaml` and `docker-compose-keycloak.yml`) run a `mailpit` service ([Mailpit](https://mailpit.axllent.org/)) that captures outbound mail instead of delivering it, and serves it as a web inbox on <http://localhost:8025>. The app container reaches it over plain SMTP with `SPRING_MAIL_HOST: mailpit` and `SPRING_MAIL_PORT: 1025`, auth and STARTTLS off. Neither stack overrides `user.registration.sendVerificationEmail`, so registration verification and password reset run their real email flows: read the message in the web inbox and click the link. Nothing leaves the machine, and Mailpit keeps no volume, so `docker compose down` discards the captured mail. The resend-verification page works as of `ds-spring-user-framework:5.3.1`, which binds `ResendVerificationDto` in `UserAPI.resendRegistrationToken` so the email-only payload that `resend-verification.js` posts passes validation. Under 5.3.0 the endpoint bound the full registration `UserDto` and rejected every resend with HTTP 400.
7979
- `user.mail.fromAddress` sets the `From` address on outbound mail; it is set per profile (e.g. `application-local.yml-example:144`), not in the base file.
8080

8181
## Security settings this demo sets

‎docs/EXTENDING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Extending the Spring User Framework
22

3-
This demo depends on `com.digitalsanctuary:ds-spring-user-framework:5.3.0` ([build.gradle](../build.gradle)). Every
3+
This demo depends on `com.digitalsanctuary:ds-spring-user-framework:5.3.1` ([build.gradle](../build.gradle)). Every
44
section below names one extension point the framework offers, the demo code that uses it, the configuration that wires
55
it, and what you would write in your own application to do the same.
66

‎src/test/java/com/digitalsanctuary/spring/user/api/UserApiIntegrationTestFixed.java‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ class UserApiIntegrationTestFixed {
7070

7171
private static final String TEST_EMAIL = "test@example.com";
7272

73+
/** Generic, outcome-independent body /user/resendRegistrationToken returns (anti-enumeration). */
74+
private static final String RESEND_GENERIC_MESSAGE = "If your account requires verification, a new verification email has been sent.";
75+
7376
private UserDto testUserDto;
7477

7578
@BeforeEach
@@ -180,6 +183,47 @@ void shouldHandlePasswordReset() throws Exception {
180183
.andExpect(jsonPath("$.messages[0]").value("If account exists, password reset email has been sent!"));
181184
}
182185

186+
@Test
187+
@DisplayName("Should resend verification email from an email-only request body")
188+
void shouldResendVerificationEmailForEmailOnlyBody() throws Exception {
189+
// Given - an unverified account
190+
userService.registerNewUserAccount(testUserDto);
191+
192+
// When - the resend page posts only an email (see resend-verification.js)
193+
String requestBody = objectMapper.writeValueAsString(java.util.Map.of("email", TEST_EMAIL));
194+
195+
// Then - ds-spring-user-framework 5.3.1 binds ResendVerificationDto here. Under 5.3.0 the endpoint
196+
// bound the full registration UserDto, so this payload failed @NotBlank validation with a 400.
197+
mockMvc.perform(post(API_BASE_PATH + "/resendRegistrationToken").contentType(MediaType.APPLICATION_JSON)
198+
.content(requestBody).with(csrf())).andExpect(status().isOk()).andExpect(jsonPath("$.success").value(true))
199+
.andExpect(jsonPath("$.messages[0]").value(RESEND_GENERIC_MESSAGE));
200+
}
201+
202+
@Test
203+
@DisplayName("Should not reveal account existence on resend (anti-enumeration)")
204+
void shouldNotRevealAccountExistenceOnResend() throws Exception {
205+
// Given - no account for this address
206+
207+
// When - a resend is requested for an unknown email
208+
String requestBody = objectMapper.writeValueAsString(java.util.Map.of("email", "nobody@example.com"));
209+
210+
// Then - the same generic 200 body as the unverified-account case above
211+
mockMvc.perform(post(API_BASE_PATH + "/resendRegistrationToken").contentType(MediaType.APPLICATION_JSON)
212+
.content(requestBody).with(csrf())).andExpect(status().isOk()).andExpect(jsonPath("$.success").value(true))
213+
.andExpect(jsonPath("$.messages[0]").value(RESEND_GENERIC_MESSAGE));
214+
}
215+
216+
@Test
217+
@DisplayName("Should reject a malformed email on resend")
218+
void shouldRejectMalformedEmailOnResend() throws Exception {
219+
// When - the email fails @Email validation
220+
String requestBody = objectMapper.writeValueAsString(java.util.Map.of("email", "not-an-email"));
221+
222+
// Then
223+
mockMvc.perform(post(API_BASE_PATH + "/resendRegistrationToken").contentType(MediaType.APPLICATION_JSON)
224+
.content(requestBody).with(csrf())).andExpect(status().isBadRequest());
225+
}
226+
183227
@Test
184228
@DisplayName("Should require authentication for update user")
185229
void shouldRequireAuthForUpdateUser() throws Exception {

0 commit comments

Comments
 (0)