Skip to content

docs: document RegistrationGuard SPI demo (closes #58)#73

Merged
devondragon merged 2 commits into
mainfrom
docs/registration-guard-spi
Jun 15, 2026
Merged

docs: document RegistrationGuard SPI demo (closes #58)#73
devondragon merged 2 commits into
mainfrom
docs/registration-guard-spi

Conversation

@devondragon

Copy link
Copy Markdown
Owner

Summary

Completes the remaining task from #58 — documenting the RegistrationGuard SPI demo in the README. The sample DomainRegistrationGuard, its enabling profile, and the SPI itself were previously only described in CLAUDE.md and Javadoc.

The guard implementation, unit test (DomainRegistrationGuardTest), and the library dependency (SPI shipped in ds-spring-user-framework 4.4.0) were already in place; only the docs were outstanding.

Changes (docs only)

  • New "Registration Guard (restricting who can register)" section under Configuration: what the SPI is, how the sample domain guard behaves (restricts form/passwordless to a domain, allows OAuth2/OIDC), how to enable it (registration-guard profile + registration.guard.allowed-domain), and a worked example of writing a custom guard. Links to the framework's REGISTRATION-GUARD.md.
  • Added the mfa and registration-guard opt-in profiles to the Configuration Profiles table.
  • Added Features bullets for MFA and the RegistrationGuard SPI.

All SPI references (RegistrationSource{FORM,PASSWORDLESS,OAUTH2,OIDC}, RegistrationContext(email, source, providerName), RegistrationDecision.allow()/deny()) were verified against the framework source.

Note on #58

The implementation diverged from the original issue spec: it uses a registration-guard Spring profile + registration.guard.allowed-domain property rather than the issue's proposed demo.registration.restricted=true + hardcoded domain set. The README documents the actual (profile-based) behavior.

Closes #58.

Completes the outstanding documentation task from #58. The demo's
DomainRegistrationGuard (and the framework's RegistrationGuard SPI) was
only described in CLAUDE.md / Javadoc, not the README.

- Add a "Registration Guard (restricting who can register)" section under
  Configuration: what the SPI is, how the sample domain guard works, how to
  enable it (registration-guard profile + registration.guard.allowed-domain),
  and how to write a custom guard, with a link to the framework's
  REGISTRATION-GUARD.md.
- List the mfa and registration-guard opt-in profiles in the Configuration
  Profiles table.
- Add Features bullets for MFA and the RegistrationGuard SPI.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the demo app’s README to document the existing RegistrationGuard SPI demo so users can understand and enable the sample guard without relying on CLAUDE.md/Javadoc.

Changes:

  • Added README documentation for the RegistrationGuard SPI and the demo DomainRegistrationGuard, including enablement via the registration-guard profile and configuration property.
  • Expanded the Configuration Profiles table to include the mfa and registration-guard add-on profiles.
  • Added feature bullets for MFA and the RegistrationGuard SPI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md Outdated
Comment on lines +349 to +350
./gradlew bootRun --args='--spring.profiles.active=local,registration-guard' \
-Dregistration.guard.allowed-domain=@mycompany.com
…args

A -Dregistration.guard.allowed-domain=... placed after the bootRun task
sets the property on the Gradle JVM, which is not forwarded to the forked
Spring Boot application, so the override silently no-ops. Pass it as a
Spring Boot command-line argument inside --args instead (same mechanism
used for --spring.profiles.active). Addresses PR review feedback.
@devondragon

Copy link
Copy Markdown
Owner Author

Good catch — fixed in 783a9aa. A -Dregistration.guard.allowed-domain=... after the bootRun task sets the property on the Gradle JVM, which the Spring Boot plugin does not forward to the forked application, so the override silently no-ops. Updated the example to pass it as a Spring Boot command-line argument inside --args (the same mechanism the project already uses for --spring.profiles.active):

./gradlew bootRun \
  --args='--spring.profiles.active=local,registration-guard --registration.guard.allowed-domain=@mycompany.com'

These land in Spring Boot's commandLineArgs property source (highest precedence), so @Value("${registration.guard.allowed-domain:@example.com}") resolves the override.

@devondragon devondragon merged commit eefad16 into main Jun 15, 2026
8 checks passed
@devondragon devondragon deleted the docs/registration-guard-spi branch June 15, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add RegistrationGuard SPI demo (invite-code example)

2 participants