-
Notifications
You must be signed in to change notification settings - Fork 49
AMM-1491 fix: cookie name #202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe change updates the Changes
Poem
Note β‘οΈ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. β¨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. πͺ§ TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
π Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
π Files selected for processing (1)
src/main/java/com/iemr/common/controller/users/IEMRAdminController.java(1 hunks)
β° Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: style-check / checkstyle
- GitHub Check: Build
- GitHub Check: Analyze (java)
- GitHub Check: Package-test
| if (cookies != null) { | ||
| for (Cookie cookie : cookies) { | ||
| if ("jwtToken".equals(cookie.getName())) { | ||
| if ("Jwttoken".equals(cookie.getName())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π‘ Verification agent
π§© Analysis chain
Bug fix approved but inconsistency detected.
The cookie name change from "jwtToken" to "Jwttoken" appears to fix the bug as intended. However, there's an inconsistency in the same file where the getLoginResponse method (line 499) still searches for a cookie named "jwtToken".
Please verify that all cookie lookups use the correct name:
π Script executed:
#!/bin/bash
# Description: Find all cookie name references to ensure consistency
# Expected: All JWT cookie references should use the same name
echo "=== Searching for JWT cookie name references ==="
rg -A 3 -B 3 'cookie\.getName\(\)' --type java
echo -e "\n=== Searching for hardcoded cookie names ==="
rg '"[Jj]wt[Tt]oken"' --type java
echo -e "\n=== Checking CookieUtil implementation ==="
ast-grep --pattern 'addJwtTokenToCookie($_, $_, $_) {
$$$
}'Length of output: 6798
Inconsistent JWT cookie name usage detected β fixes required
The codebase currently mixes two cookie names, "jwtToken" and "Jwttoken", for the same purpose. Since CookieUtil (and other filters) consistently use "Jwttoken", we should standardize on that value everywhere.
Please update the following:
- IEMRAdminController.java
- At the
getLoginResponsecookie loop (line ~499):
Changetoif ("jwtToken".equals(cookie.getName())) {
if ("Jwttoken".equals(cookie.getName())) {
- At the
- Any other manual cookie lookups
- Replace remaining occurrences of
"jwtToken"incookie.getName()checks with"Jwttoken". - Consider using
CookieUtil.getCookieValue(request, COOKIE_NAME)instead of manual loops to centralize the cookieβname constant.
- Replace remaining occurrences of
Optionally, extract "Jwttoken" into a shared constant (e.g. JwtConstants.COOKIE_NAME) to prevent future typos.
π€ Prompt for AI Agents
In src/main/java/com/iemr/common/controller/users/IEMRAdminController.java
around line 499 and other locations where cookie names are checked, the code
inconsistently uses "jwtToken" and "Jwttoken" for the same cookie. To fix this,
update all occurrences of cookie.getName() checks from "jwtToken" to "Jwttoken"
to match the consistent usage in CookieUtil and filters. Additionally, consider
refactoring to use a centralized constant for the cookie name, such as
JwtConstants.COOKIE_NAME, or use CookieUtil.getCookieValue(request, COOKIE_NAME)
to avoid manual loops and hardcoded strings.



π Description
JIRA ID: AMM-1491
Fix incoming cookie name
β Type of Change
Summary by CodeRabbit