-
Notifications
You must be signed in to change notification settings - Fork 317
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
Handling of expired access tokens when CF CC rate limiting exhausts #965
base: main
Are you sure you want to change the base?
Conversation
❌ Hey hariyada! All pull request submitters and commit authors must have a Contributor License Agreement (CLA). Click here for details on the CLA process. The following github user @hariyada is not covered by a CLA. After the CLA process is complete, this pull request will need to be closed & reopened. DreddBot will then validate the CLA(s). |
✅ Hey hariyada! The commit authors and yourself have already signed the CLA. |
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.
Thanks for the PR, @hariyada, and my apologies for the delay in getting to it. Let me know if you have questions.
Mono<String> accessToken = this.accessTokens.get(connectionContext); | ||
if(accessToken != null) { | ||
try { | ||
String token = this.accessTokens.get(connectionContext).map(s -> s.split(" ")[1]).block(); |
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.
Making a .block()
call is a significant code smell in a reactive project (note that, outside of a few specific tests, it's not used anywhere else in this project). This needs to be refactored into a reactive style.
int i = expirationTime.compareTo(new Date()); | ||
long milliSeconds = expirationTime.getTime() - new Date().getTime(); | ||
// invalidate the token if it is going to be expired in one minute. | ||
boolean isTokenInvalid = ((i <= 0) || (i == 1 && milliSeconds <= 60000)); |
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.
Inspection tells me that i == 1
(rather than i > 0
is bad practice).
@@ -279,5 +305,12 @@ private RefreshToken getRefreshTokenStream(ConnectionContext connectionContext) | |||
private FluxSink<String> sink = this.processor.sink(); | |||
|
|||
} | |||
|
|||
private static Optional<Claims> exctractClaimsFromToken(String token) { |
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.
Typo
token handling for the below mentioned issue
issue link: #960