-
Notifications
You must be signed in to change notification settings - Fork 140
Snow 1917307 refresh token #1040
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
Snow 1917307 refresh token #1040
Conversation
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
9093de5
to
5448f6c
Compare
dbc19a0
to
ea77ff9
Compare
token = await requestToken(as, tokenUrl, client, clientAuth, params, redirectUri, codeVerifier); | ||
|
||
//verify that there is access token in the cache | ||
const accessTokenFromCache = await GlobalConfig.getCredentialManager().read(accessTokenKey); |
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.
perhaps extract credentialManager to a variable/member?
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.
OK
globalThis.crypto ??= require('node:crypto').webcrypto; | ||
await this.loadOauth4webapi(); // import module using the dynamic import | ||
// const codeChallengeMethod = 'S256'; | ||
const as = { issuer: 'UNKNOWN' }; |
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.
comment why this is needed
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.
Added.
//cache refresh token | ||
Logger.getInstance().debug( | ||
`Received new OAuth refresh token from: Host: ${tokenUrl.host} Path: ${tokenUrl.pathname}`); | ||
await GlobalConfig.getCredentialManager().remove(refreshTokenKey); |
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.
do we have to remove it first? Won't it get replaced?
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.
Assuming that underneath there is a map type. I'm a little afraid about custom CacheManager implementation but it looks logical that cache could protect before containing rows with duplicated keys.
@@ -4,6 +4,7 @@ code.INCORRECT_USERNAME_PASSWORD = '390100'; | |||
code.SESSION_TOKEN_INVALID = '390104'; | |||
code.GONE_SESSION = '390111'; | |||
code.SESSION_TOKEN_EXPIRED = '390112'; | |||
code.OAUTH_TOKEN_EXPIRED = '390318'; |
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.
in JDBC I also handle scenario for this code: OAUTH_ACCESS_TOKEN_INVALID_GS_CODE = 390303;
53f6d88
to
235d87b
Compare
598ce2e
to
6153e48
Compare
22dcb2c
to
4d9fafe
Compare
Description
Please explain the changes you made here.
Checklist
npm run lint:check -- CHANGED_FILES
and fix problems in changed code)npm run test:unit
andnpm run test:integration
)