-
Notifications
You must be signed in to change notification settings - Fork 10
Remove Invalid Tokens from cache when found #1333
Conversation
Co-authored-by: jcrichlake <[email protected]> Co-authored-by: pluckyswan <[email protected]> Co-authored-by: halprin <[email protected]>
Co-authored-by: Sylvie <[email protected]>
Co-authored-by: Sylvie <[email protected]>
@Inject private Secrets secrets; | ||
@Inject private Logger logger; | ||
|
||
String ourPublicKey = "trusted-intermediary-public-key-" + ApplicationContext.getEnvironment(); |
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.
Do we want this public key name hardcoded here? And if so do we need a #pragma allow secret
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.
It previously existed, but I moved it to a higher level so it's accessible in tests. I can add the #pragma allow secrets if we want but I also don't think it got flagged before as a secret.
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.
Cool
@@ -21,10 +21,12 @@ public class AuthRequestValidator { | |||
private static final AuthRequestValidator INSTANCE = new AuthRequestValidator(); | |||
|
|||
@Inject private AuthEngine jwtEngine; | |||
@Inject private Cache keyCache; | |||
@Inject Cache keyCache; |
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.
Seems this is the only inject we actually use in this class. Would a small doc be good?
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.
Are you sure? I see jwtEngine
, secrets
, and logger
being used below.
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.
I added some extra comments on the class. I think all the injects are used unless I'm misunderstanding what you mean.
|
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.
Checklist needs to be updated (remove items or check them off)
/review |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
@@ -49,12 +52,12 @@ public boolean isValidAuthenticatedRequest(DomainRequest request) | |||
return true; | |||
} catch (InvalidTokenException e) { | |||
logger.logError("Invalid bearer token!", e); | |||
this.keyCache.remove(ourPublicKey); |
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.
Consider adding a log statement before removing the key from the cache to aid in debugging and operational monitoring. [important]
/describe |
TitleRemove Invalid Tokens from cache when found User descriptionDescription
IssueChecklist
Note: You may remove items that are not applicable PR Typebug_fix, enhancement Description
Changes walkthrough 📝
|
/improve |
PR Code Suggestions ✨
|
Description
Issue
#1326
Checklist
Note: You may remove items that are not applicable