feat(api)!: remove api.access.token.required - #3496
Conversation
With api.access.token.required=true, RoleQueryHelper refused every API request that had neither a login session nor an access token. Until the previous fix it refused valid tokens as well, so in practice the setting meant "the API is for logged-in users only" while the search screen stayed open. That split no longer exists in 15.9: the default search UI is a static theme that calls /api/v2/search itself, so turning the setting on left anonymous visitors with an empty search page. login.required=true is the setting that keeps anonymous users from searching. Remove the key from fess_config.properties, FessConfig and FessProp, and drop the check from RoleQueryHelper. Access tokens behave as before: a registered token adds its permissions to the request, and an unregistered or expired token is still rejected. BREAKING CHANGE: api.access.token.required is no longer read. Use login.required=true to require a login for searching.
utafrali
left a comment
There was a problem hiding this comment.
Clean, complete removal of a setting that had become misleading after #3488. All references are gone, the guest-role fallback path is unaffected for the default case, and the test suite is updated accurately — removing the two tests that pinned the old enforcement behavior while keeping the one that validates token-permission assignment.
| @@ -2835,22 +2832,6 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction | |||
| */ | |||
There was a problem hiding this comment.
The interface removes isApiAccessTokenRequired() as a breaking change, which is correct. Worth noting in the release notes that any third-party plugin or custom extension that implemented the FessConfig interface and overrode this method will get a compile error on upgrade. The feat! commit type signals the break, but a short note in the migration guide alongside login.required=true would help plugin authors triage the error quickly.
There was a problem hiding this comment.
Thanks — labeled breaking, so the release notes will cover this, including the removed FessConfig getters.
Summary
Remove the
api.access.token.requiredsetting.With
api.access.token.required=true,RoleQueryHelperrefused every API request that had neither a login session nor an access token. Until #3488 it refused requests with a valid token as well, so in practice the setting meant "the API is for logged-in users only" while the search screen stayed open to anonymous users.That split no longer exists in 15.9. The default search UI is a static theme that calls
/api/v2/searchitself, so turning the setting on left anonymous visitors with an empty search page.login.required=trueis the setting that keeps anonymous users from searching.Changes
fess_config.properties: removeapi.access.token.required.FessConfig/FessProp: remove the key constant, the getters and the default map entry.RoleQueryHelper: drop the "token required" check and the import it used.SearchApiV2Manager/V2EnvelopeWriter: drop the setting from the comments aboutInvalidAccessTokenException.RoleQueryHelperTest: remove the tests that pinned the setting; keep one that checks an API request with a registered token gets the token's permissions and not the guest roles.Access tokens behave as before: a registered token adds its permissions to the request, and an unregistered or expired token is still rejected by
AccessTokenService(401 on/api/v2).Migration
A value left under
api.access.token.requiredhas no effect. An installation that set it totruenow answers anonymous API requests with the guest roles, the same as the search screen. To keep anonymous users from searching, setlogin.required=true.Tests
mvn -o formatter:format license:formatmvn -o test -Dtest='RoleQueryHelperTest,*V2*Test,SearchApiV2*Test,org.codelibs.fess.api.v2.**.*Test': 574 tests, 0 failures, 0 errorsgrepfor the key in the repository: no hitsRelated
The documentation change is codelibs/fess-docs#557 (15.9 properties pages and upgrade notes). It describes this removal and should be merged together with, or after, this PR.