-
Notifications
You must be signed in to change notification settings - Fork 1k
WIP cookie auth fixes #9480
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
base: main
Are you sure you want to change the base?
WIP cookie auth fixes #9480
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,11 @@ | |
| import { getAccountInfo } from '../../api/account_management/account'; | ||
| import { ApiKey, AppName, AuthInternal } from '../../model/auth'; | ||
| import { UserInternal } from '../../model/user'; | ||
| import { PersistedBlob, PersistenceInternal } from '../persistence'; | ||
| import { | ||
| PersistedBlob, | ||
| PersistenceInternal, | ||
| PersistenceType | ||
| } from '../persistence'; | ||
| import { UserImpl } from '../user/user_impl'; | ||
| import { _getInstance } from '../util/instantiator'; | ||
| import { inMemoryPersistence } from './in_memory'; | ||
|
|
@@ -80,7 +84,17 @@ export class PersistenceUserManager { | |
| if (!response) { | ||
| return null; | ||
| } | ||
| return UserImpl._fromGetAccountInfoResponse(this.auth, response, blob); | ||
| const user = await UserImpl._fromGetAccountInfoResponse( | ||
| this.auth, | ||
| response, | ||
| blob | ||
| ); | ||
| // TODO look into why this is needed, probably something we need to fix in the cookie | ||
| // persistence layer | ||
| if (this.persistence.type === PersistenceType.COOKIE) { | ||
| user.stsTokenManager.refreshToken = 'REDACTED'; | ||
| } | ||
| return user; | ||
| } | ||
| return UserImpl._fromJSON(this.auth, blob); | ||
| } | ||
|
|
@@ -170,6 +184,11 @@ export class PersistenceUserManager { | |
| response, | ||
| blob | ||
| ); | ||
| // TODO look into why this is needed, probably something we need to fix in the cookie | ||
| // persistence layer | ||
| if (persistence.type === PersistenceType.COOKIE) { | ||
| user.stsTokenManager.refreshToken = 'REDACTED'; | ||
| } | ||
|
Comment on lines
+189
to
+191
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a duplicate of the same fragile hack of setting a hardcoded |
||
| } else { | ||
| user = UserImpl._fromJSON(auth, blob); // throws for unparsable blob (wrong format) | ||
| } | ||
|
|
||
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.
Hardcoding the
refreshTokento 'REDACTED' is a fragile hack. While the accompanying comment indicates this is a known issue, it's important to highlight that this approach relies on the internal implementation details ofStsTokenManagerand could break unexpectedly in the future. This could also lead to the 'REDACTED' value being persisted.A more robust solution would be to make
StsTokenManageraware of cookie-based authentication and adjust its token refresh logic accordingly, rather than tricking it with a fake token.