-
Notifications
You must be signed in to change notification settings - Fork 45
cookieutil change #171
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
cookieutil change #171
Conversation
WalkthroughThis PR updates the cookie handling logic within the Changes
Sequence Diagram(s)sequenceDiagram
participant Server
participant CookieUtil
participant Response
Server->>CookieUtil: addJwtTokenToCookie(response, jwtToken)
CookieUtil->>Response: Prepare cookie
Note over CookieUtil: response.addCookie(cookie) is commented out
CookieUtil-->>Server: Cookie not added
sequenceDiagram
participant Client
participant Request
participant CookieUtil
participant CookieArray
Client->>Request: Sends request
Request->>CookieUtil: getJwtTokenFromCookie(request)
CookieUtil->>Request: call getCookies()
alt Cookies are null
CookieUtil-->>Client: returns null
else Cookies exist
CookieUtil->>CookieArray: iterate to find JWT cookie
CookieArray-->>CookieUtil: returns matching cookie?
CookieUtil-->>Client: returns JWT token
end
Possibly related PRs
Suggested reviewers
Poem
π Recent review detailsConfiguration used: CodeRabbit UI π Files selected for processing (1)
π§ Files skipped from review as they are similar to previous changes (1)
β° Context from checks skipped due to timeout of 90000ms (3)
πͺ§ TipsChatThere are 3 ways to chat with CodeRabbit:
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: 0
π§Ή Nitpick comments (1)
src/main/java/com/iemr/common/utils/CookieUtil.java (1)
44-44
: The standard cookie addition has been disabled.The standard method
response.addCookie(cookie)
has been commented out, leaving only the manual Set-Cookie header approach active. According to retrieved learnings, both approaches were previously confirmed to work as required. Consider whether disabling the standard method was intentional, as it may affect cookie handling.Given that the manual header is still added at line 60, this change likely removes duplication, but confirm that all environments and browsers still handle the cookie correctly with only the manual approach. The manual approach gives more control over attributes like SameSite.
π Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
π Files selected for processing (1)
src/main/java/com/iemr/common/utils/CookieUtil.java
(2 hunks)
π§° Additional context used
π§ Learnings (1)
src/main/java/com/iemr/common/utils/CookieUtil.java (1)
Learnt from: sandipkarmakar3
PR: PSMRI/Common-API#162
File: src/main/java/com/iemr/common/utils/CookieUtil.java:52-66
Timestamp: 2025-02-21T07:43:03.828Z
Learning: In the Common-API project's CookieUtil class, the current implementation of addJwtTokenToCookie using both response.addCookie() and manual Set-Cookie header has been tested and confirmed to work as required for their use case. URL encoding of the JWT token is not necessary.
β° Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: style-check / checkstyle
- GitHub Check: Analyze (java)
- GitHub Check: Build
- GitHub Check: Package-test
π Additional comments (1)
src/main/java/com/iemr/common/utils/CookieUtil.java (1)
64-66
: Good defensive programming approach.Adding this null check for request cookies prevents potential NullPointerExceptions when iterating through cookies that don't exist. This is a positive change that improves code robustness.
|
π Description
JIRA ID:
Please provide a summary of the change and the motivation behind it. Include relevant context and details.
β Type of Change
βΉοΈ Additional Information
Please describe how the changes were tested, and include any relevant screenshots, logs, or other information that provides additional context.
Summary by CodeRabbit