Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request: Remove
req, resparams — use RequestContext/ResponseContextSummary
Removes explicit
Request/Responseparameter passing from all auth methods. Every method now reads fromRequestContext.get()/ResponseContext.get()internally, consistent with the ThreadLocal pattern introduced in v2.6.0.Changes
1. Auth — requireLogin() simplified
Modified:
security/auth/Auth.javarequireLogin(Request req, Response res)→requireLogin()(no-arg)RequestContext.get()for session/path info andResponseContext.get()for redirectimport ResponseContext2. TokenAuth — all methods now no-arg
Modified:
security/auth/TokenAuth.javauserFromToken(Request)→userFromToken()isAuthenticated(Request)→isAuthenticated()requireToken(Request, Response)→requireToken()requireTokenRole(Request, Response, String)→requireTokenRole(String)RequestContext.get()for headers/attributes andResponseContext.get()for status/haltimport RequestContextandimport ResponseContext3. RoleChecker — updated calls
Modified:
security/role/RoleChecker.javaTokenAuth.requireToken(req, res)→TokenAuth.requireToken()TokenAuth.requireTokenRole(req, res, role)→TokenAuth.requireTokenRole(role)Auth.requireLogin(req, res)→Auth.requireLogin()4. BaseController — updated delegation
Modified:
http/controller/BaseController.javaAuth.requireLogin(req, res)→Auth.requireLogin()5. Tests fixed
Modified:
AuthTest.javaimport RequestContextandimport AfterEachRequestContext.set(req)in@BeforeEach setUp()@AfterEach tearDown()withRequestContext.clear()Modified:
TokenAuthTest.javauserFromToken(),isAuthenticated()Breaking Changes
Auth.requireLogin(Request, Response)→Auth.requireLogin()TokenAuth.requireToken(Request, Response)→TokenAuth.requireToken()TokenAuth.requireTokenRole(Request, Response, String)→TokenAuth.requireTokenRole(String)TokenAuth.userFromToken(Request)→TokenAuth.userFromToken()TokenAuth.isAuthenticated(Request)→TokenAuth.isAuthenticated()