mraible opened a new pull request, #300: URL: https://github.com/apache/roller/pull/300
Replaces `WEB-INF/security.xml` with a Java `SecurityConfig`, loaded by the annotation-based web application context that `web.xml` now sets up. This is a draft for 7.0: it removes a file admins edit, so it belongs in the major release, and Spring Security 7's MFA support is only available through Java config, which we want for 7.1. The filter chain keeps the same URL rules, form login, OpenID Connect login, remember-me, security headers, CSRF setting and the `/images`, `/scripts` and `/styles` exceptions. - `SecurityConfigTest` sends requests through the chain built from `SecurityConfig`. Its table was recorded from `security.xml` first. The two configurations gave the same status, redirect, response headers and session behaviour for every request, including FORWARD and ERROR dispatches, the saved request after login and the default request firewall, except one: with remember-me off, a failed login no longer sends a header clearing a remember-me cookie that was never set. - `RollerContext` no longer looks up beans by the names the XML namespace generated (`DaoAuthenticationProvider#0`, `_formLoginEntryPoint` and the authentication manager). `SecurityConfig` sets the password encoder, the HTTPS-only login entry point (`securelogin.enabled`) and remember-me (`rememberme.enabled`) from `roller.properties`. Under Java config the encoder lookup would have quietly found nothing, so each of these has a test. The encoder factory moved unchanged to `RollerPasswordEncoders`, and `RollerContext.getPasswordEncoder()` returns the same instance the login provider uses. - `RollerRememberMeAuthenticationProvider` is removed. `rememberMe()` creates a provider with the remember-me services' key, which is the key Roller's provider used. For sites that edited `security.xml`: - LDAP is set with `authentication.method=ldap` and new `users.ldap.url`, `users.ldap.managerDn`, `users.ldap.managerPassword`, `users.ldap.userSearchBase`, `users.ldap.userSearchFilter` and `users.ldap.defaultRole` properties, which map one-to-one to the beans the XML asked admins to uncomment. - URL rules, such as a private weblog for one role, are `security.access.<path>=<roles>` properties, checked before Roller's own rules and matched without regard to case. - CHANGES has an entry under "Behaviour changes worth reading before upgrading", and the install guide describes both. The user guide doesn't cover any of this, so it doesn't change. Testing: - `mvn install` passes on JDK 21 (775 tests, 1 skipped). - The Playwright UI tests pass against `jetty:run` with database login (20 run, 3 OIDC tests skipped). The OIDC stack wasn't run locally. - LDAP login wasn't tested against a directory server; the project's stacks don't include one. Found while writing the tests, and left for separate PRs because they predate this change: - The login page's remember-me checkbox is named `_spring_security_remember_me`, but Roller's remember-me services read `remember-me`, so ticking it sets no cookie. This happens with `security.xml` too. - `passwds.encryption.lazyUpgradeFrom` lets old SHA-1 and MD5 hashes verify, but nothing re-hashes them at login. This should merge after the open fixes for master and before 7.0.0 RC2. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
