Skip to content

Remove MFA factor-merging workaround once SpringUserFramework#313 is fixed #71

Closed

Description

@devondragon

Context

PR #60 works around a framework bug — SpringUserFramework#313 — where a second-factor login replaces the session authentication instead of merging factor authorities, so the MFA flow could never complete. The demo compensates with MfaSecurityConfig, which applies @EnableMultiFactorAuthentication(authorities = {}) to enable Spring Security 7's filter-level factor merging.

Once the framework ships the fix, this workaround becomes redundant boilerplate. Since this is a reference app, leaving it in would teach consumers they need wiring they no longer need.

Blocked on: devondragon/SpringUserFramework#313

Tasks (after upgrading to the framework release containing the fix)

  • Bump ds-spring-user-framework in build.gradle (currently 4.3.1) to the release containing the #313 fix
  • Delete src/main/java/com/digitalsanctuary/spring/demo/config/MfaSecurityConfig.java
  • Verify the MFA flow still completes without the workaround:
    • ./gradlew test (includes MfaChallengeFlowIntegrationTest)
    • APP_PROFILES=local,playwright-test,mfa npx playwright test --project=chromium-mfa — this E2E exercises the exact factor-merging behavior (enroll passkey → password login → challenge page → verify → both factors satisfied), so green means the framework fix fully covers it

Conditional (only if the "related observation" in #313 is also fixed)

If the framework starts auto-adding the configured MFA entry-point URIs (passwordEntryPointUri / webauthnEntryPointUri) to the unprotected URIs list:

  • Remove the manual /user/mfa/webauthn-challenge.html entries from user.security.unprotectedURIs in application.yml, application-mfa.yml, and application-test.properties
  • Relax or remove MfaConfigConsistencyTest, which currently enforces that manual sync (it would otherwise fail the build when the entries are removed)

If only the factor merging is fixed upstream, leave the unprotectedURIs entries and the consistency test as they are — the redirect-loop guard is still needed.

Activity

  1. devondragon commented on Jun 15, 2026

    @devondragon
    OwnerAuthor

    Done in #72 (merged), as part of the upgrade to ds-spring-user-framework 4.4.0 — which contains the fix for devondragon/SpringUserFramework#313 (factor merging) and its related observation (auto-unprotecting the configured MFA factor entry-point URIs, framework commit f3ca56c).

    All tasks completed and verified on main:

    • Bumped ds-spring-user-framework to 4.4.0
    • Deleted src/main/java/com/digitalsanctuary/spring/demo/config/MfaSecurityConfig.java
    • MFA flow still completes without the workaround:
      • ./gradlew test green (incl. MfaChallengeFlowIntegrationTest)
      • --project=chromium-mfa (profile playwright-test,mfa) green in CI and locally — enroll passkey → password login → challenge → verify → both factors satisfied

    Conditional cleanup (the auto-unprotect observation in #313 was also fixed), completed:

    • Removed the manual /user/mfa/webauthn-challenge.html entry from user.security.unprotectedURIs in application.yml, application-mfa.yml, and application-test.properties (the webauthnEntryPointUri setting itself remains, as it must)
    • Relaxed MfaConfigConsistencyTest so it no longer enforces the manual unprotected-URI sync; it now only asserts MFA is opt-in and the passkey enrollment endpoints stay reachable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions