-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat(Authorization): AuthorizationManager
enhancements.
#310
Conversation
9a7e437
to
de296a9
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #310 +/- ##
==========================================
+ Coverage 99.05% 99.06% +0.01%
==========================================
Files 70 70
Lines 1168 1182 +14
Branches 179 181 +2
==========================================
+ Hits 1157 1171 +14
Misses 11 11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
3605d65
to
bd0ce30
Compare
AuthorizationManager
enhancements.AuthorizationManager
enhancements.
feat: Adds `prompt` method to `AuthorizationManager` - allows prompting for consent **without** reseting configured authorization context. feat: Tokens managed by an `AuthorizationManager` will now be stored as a `StoredToken` type, which will include a `__metadata` property in addition to the raw `Token`. The `__metadata` will contain information about the creation and expiration time of the token allowing for improved refresh functionality. feat: Adds `isTokenExpired` method for determining whether or not a stored token is expired.
bd0ce30
to
26d9792
Compare
/* eslint-disable no-underscore-dangle */ | ||
return token && token.__metadata?.expires | ||
? Date.now() + augment >= token.__metadata.expires | ||
: true; |
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.
Is the idea of having a fallback to true
here to replace any old tokens that didn't get set with an expires
value?
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.
Yeah, although thinking about it a bit more, I think I'm going to change the signature to true | false | undefined
and just let the caller decide what to do; In our applications, we'll likely do a refresh in that case.
aa8f059
to
f69bad3
Compare
🤖 I have created a release *beep* *boop* --- ## [4.3.0](v4.2.0...v4.3.0) (2024-09-24) ### Features * **Authorization:** `AuthorizationManager` enhancements. ([#310](#310)) ([644c263](644c263)) ### Bug Fixes * **Search, Typescript:** updates return type for `search.index.getAll` and exports service types. ([#306](#306)) ([7fcebbe](7fcebbe)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
feat: Adds
prompt
method toAuthorizationManager
- allows prompting for consent without reseting configured authorization context.feat: Tokens managed by an
AuthorizationManager
will now be stored as aStoredToken
type, which will include a__metadata
property in addition to the rawToken
. The__metadata
will contain information about the creation and expiration time of the token allowing for improved refresh functionality.feat: Adds
isTokenExpired
method for determining whether or not a stored token is expired.