Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hariyada
Copy link

token handling for the below mentioned issue
issue link: #960

@cfdreddbot
Copy link

❌ 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).

@hariyada hariyada closed this May 15, 2019
@hariyada hariyada reopened this May 15, 2019
@cfdreddbot
Copy link

✅ Hey hariyada! The commit authors and yourself have already signed the CLA.

@twoseat twoseat self-assigned this May 22, 2019
Copy link
Contributor

@twoseat twoseat left a 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();
Copy link
Contributor

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));
Copy link
Contributor

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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo

@twoseat twoseat changed the base branch from master to main July 9, 2020 15:43
@dmikusa dmikusa added bug triaged Initial triage of issue has been performed uaa labels Jun 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug triaged Initial triage of issue has been performed uaa
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants