Skip to content

Conversation

@woutslakhorst
Copy link
Member

@woutslakhorst woutslakhorst commented Nov 18, 2024

Cache access tokens per request. Subsequent requests are fulfilled from cache.
Added SessionOption to allow for custom ttl on session store.
Only implemented for auth.iam, not for auth/v1

closes #3552

@woutslakhorst woutslakhorst force-pushed the feature/3552/cached_access_tokens branch from a262394 to ea54414 Compare November 18, 2024 11:08
@woutslakhorst woutslakhorst force-pushed the feature/3552/cached_access_tokens branch from ea54414 to 0e660b0 Compare November 22, 2024 08:44
@woutslakhorst woutslakhorst marked this pull request as ready for review November 22, 2024 08:56
Copy link
Member

@reinkrul reinkrul left a comment

Choose a reason for hiding this comment

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

small remarks/questions

}
ttl := accessTokenValidity
if tokenResult.ExpiresIn != nil {
ttl = time.Second * time.Duration(*tokenResult.ExpiresIn)
Copy link
Member

Choose a reason for hiding this comment

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

when could it not be set 🤔 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a pointer, probably because the spec says it's optional. In our implementation it's not but you never know.

}
// TTL can't go below 0 because that is translated to "no expiration" by the library
// in that case it should be 1 nanosecond
if opts.ttl < 0 {
Copy link
Member

Choose a reason for hiding this comment

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

or just not put it in cache?

Copy link
Member Author

Choose a reason for hiding this comment

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

🤦

@woutslakhorst woutslakhorst merged commit 0fa8fb5 into master Nov 22, 2024
6 checks passed
@woutslakhorst woutslakhorst deleted the feature/3552/cached_access_tokens branch November 22, 2024 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cache access tokens

3 participants