Skip to content

Replace OpenID 2.0 with OAuth 2.0/OIDC login - #3

Closed
mraible wants to merge 3 commits into
feature/jakarta-ee-10-migrationfrom
feature/oidc-login
Closed

Replace OpenID 2.0 with OAuth 2.0/OIDC login#3
mraible wants to merge 3 commits into
feature/jakarta-ee-10-migrationfrom
feature/oidc-login

Conversation

@mraible

@mraible mraible commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Stacked on apache#154 (1/3 in the stack); after that merges, this retargets to apache/roller:master. Replaces the obsolete OpenID 2.0 authentication (removed in Spring Security 6) with OAuth 2.0/OIDC login using spring-security-oauth2-client. Phase 3 of the Jakarta EE 10 migration (ROL-2183).

Removed / changed behavior — read before merging:

  • The openid and db-openid values of authentication.method no longer exist; configs using them must move to oidc or db-oidc. OpenID 2.0 relay support does not survive in any form (the protocol is dead and Spring Security dropped it upstream).
  • users.oidc.autoProvision.enabled defaults to true: anyone the identity provider authenticates gets a Roller account on first login. Set it to false to require pre-created accounts. Linking to an existing account additionally requires the provider to assert a verified email matching that account.
  • docker-compose now defaults AUTHENTICATION_METHOD to oidc, so the demo signs in through the bundled Keycloak by default; set db for the old form-login demo or db-oidc for both side by side.
  • This adds OAuth 2.0 for browser login only. It does not restore the AtomPub API's removed OAuth 1.0a option (see ROL-2183: Migrate from javax to Jakarta EE 11 apache/roller#154); AtomPub remains basic/wsse.

How it works:

  • RollerClientRegistrationRepository reads provider config (client-id, client-secret, issuer-uri) from Roller properties, with OIDC discovery at startup
  • RollerOidcUserService resolves the Roller account behind an authenticated OIDC user via the existing openIdUrl column (stores issuer#sub) and provisions accounts just in time, so the principal carries Roller roles from the first request
  • The returned principal is named after the resolved Roller account. Roller looks users up by principal name throughout (rendering models, filters, Struts actions), and the default OidcUser name is the opaque sub claim, which made every rendered weblog page fail with a Velocity error for signed-in OIDC users
  • AuthMethod gains OIDC/DB_OIDC, and Login.jsp shows provider buttons built from the resolved registrations, so it never advertises a provider whose discovery failed
  • docker-compose gains Keycloak seeded with admin/admin and user/user, and the image builds from the working tree instead of a cloned release tag
  • 19 unit tests cover the new classes, including regressions for the principal name and the provisioning policy

To try it: add 127.0.0.1 keycloak to /etc/hosts, then docker compose up -d and log in at http://localhost:8080/ as admin/admin or user/user.

Replace the obsolete OpenID 2.0 authentication (removed in Spring Security 6) with modern OAuth 2.0/OIDC login using spring-security-oauth2-client. OIDC providers are configured via roller-custom.properties with issuer discovery. The existing openIdUrl column is reused to store OIDC subjects (formatted as issuer#sub), avoiding schema changes. New OIDC users are redirected to registration with claims pre-populated; returning users go straight to the menu. AuthMethod enum values updated from OPENID/DB_OPENID to OIDC/DB_OIDC.
…est users

The Dockerfile previously cloned the roller-6.1.0 tag from GitHub, so local changes never made it into the image; it now builds from the checkout. The Keycloak realm import gains an administrator (admin/admin) and a regular user (user/user) so both roles can be tried right after docker compose up, and the compose file accepts AUTHENTICATION_METHOD=db-oidc to offer form login next to the provider buttons.
…form registration

Roller looks users up by principal name throughout the rendering layer and servlet filters, but an OidcUser's default name is the sub claim, an opaque provider ID that matches no Roller account; every rendered weblog page then failed with a Velocity NullPointerException for a signed-in OIDC user. The principal returned by RollerOidcUserService is now named after the resolved Roller account. Provisioning moves into the user service so the principal carries Roller roles from the first request, gets its own users.oidc.autoProvision.enabled toggle (default true, mirroring users.ldap.autoProvision.enabled) instead of piggybacking on the runtime form-registration setting that is off by default and blocked every provider user after the first, and requires a verified matching email before linking an existing account. Discovery needs jackson-databind on the classpath, and the login page lists providers from the resolved client registrations so it never advertises one whose discovery failed.
@mraible
mraible force-pushed the feature/oidc-login branch from da4c868 to acdf650 Compare August 12, 2026 19:37
@mraible

mraible commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

Moved to apache#155 now that the whole stack lives in the main repository. Review and discussion continue there.

@mraible mraible closed this Aug 12, 2026
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.

1 participant