-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(NODE-5191): OIDC Auth Updates #3637
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
Merged
Changes from all commits
Commits
Show all changes
93 commits
Select commit
Hold shift + click to select a range
51532f2
feat(NODE-5191): update oidc objects
durran 08823d1
feat(NODE-5191): add allowed hosts option
durran a943d7b
test(NODE-5191): add prose spec template
durran 3383e87
test: adding first prose test
durran 3608ea0
test: prose tests up to aws
durran ac802a2
fix: issuer is not optional
durran 58aa17e
test: more callback tests
durran 7bac7ea
fix: mechanism properties
durran 1ab3331
test: fix path
durran c45f285
test: add tests to speculative auth
durran 4fef6d4
test: update connection string regex
durran 0a5453d
fix: normal string testing
durran 23fd2c5
test: add debug
durran 640f31e
fix: fix formatting
durran b020c7d
test: fix sinon chai
durran 2402d3a
test: fix test env
durran 1d9af2d
test: adding reauth tests
durran 5b9f955
test: finish reauth tests
durran 3c74e55
chore: adding console debug
durran d504784
chore: more debug
durran 47d9b4d
fix: no assert, just run
durran 3f65e9e
fix: await
durran ec1b874
test: fixing callback, aws
durran 45a6220
test: more test fixes
durran 61448a1
chore: more debug to callback workflow
durran 99009e1
test: move cache clearing
durran e658e7a
test: use same auth mech props
durran 185c895
test: more test fixes:
durran 8a8e3c5
chore: more debug
durran cb19e9c
test: more debug
durran 76e3e2d
fix: result check
durran 392b6f6
test: fix callback instances in tests
durran e365c69
test: more test updates
durran 541e803
test: more updates
durran 3ffa95e
test: more test fixes
durran 5a7207a
test: update prose test debug
durran 0d14b64
test: only track find events
durran 3617ce2
fix: speculative auth
durran 0f139dc
refactor: refactoring callback workflow
durran c5e435b
fix: speculative auth and messages
durran c722b9f
fix: speculative auth
durran e3e2422
fix: change cleanup location
durran fbccca5
fix: change cleanup location
durran acde726
chore: more debug
durran aec6db2
fix: reauth cannot use cached token
durran 22f85d2
test: add speculative auth tests
durran 75d3aa3
test: fix spec auth test
durran ecab8d5
test: fix test cleanup
durran 6a07a15
fix: add db to speculative auth doc
durran f5ebffe
test: use correct error code
durran 556b99f
fix: speculative auth
durran 434bc01
test: more debug
durran bf15cc0
fix: no spec auth when reauth
durran bec5d9e
fix: client leak
durran d9ef4d1
fix: properly close, remove debug
durran 5ca0e6b
feat: oidc updates
durran 46534f1
test: fixing tests
durran b5b53e4
test: update tests
durran f35aa16
test: fix readfile
durran 393799f
chore: debug
durran 0f305a2
chore: dont send conversation id during reauth
durran fcfd9b6
chore: lint
durran 1163de6
chore: debug error
durran d1563ae
refactor: moving validation
durran 95d9064
refactor: move validation into client
durran 82f3e63
chore: remove console debug
durran 08fc2ef
test: fail reauth twice
durran 699e5a1
test: updating test assertions
durran e969628
fix: lint
durran 90b0522
fix: invalidate token in cache on error
durran 916aca2
chore: cleanup
durran 9f3f17c
chore: debug
durran 780e4df
test: create new client
durran 2e6d7a3
chore: remove console logs
durran e0899f6
test: fix unit tests
durran 87345ec
fix: ts import version
durran f193239
test: add case for unix sockets
durran ce5fcab
feat: prevent simultaneous callback execution
durran 8bb8ae1
test: add lock prose test
durran dda9dcb
chore: debug
durran 98b7225
chore: lock again
durran b4f2008
test: use lock cache
durran 1abd3b0
test: clear callback cache
durran 76897a4
chore: debug
durran 8e5c113
refactor: move function hashing
durran 9335966
test: throw if entered with lock
durran f28c29d
fix:lint
durran 68c52ef
fix: change cache keys
durran fd5a712
fix: timers on node 14
durran 76aa52b
fix: settimeout issues
durran 5fecafc
fix: suggestions
durran b947b11
fix: credentials defaulting
durran bc167a2
fix: comment addressing
durran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import { readFile } from 'fs/promises'; | ||
import * as fs from 'fs'; | ||
|
||
import { MongoAWSError } from '../../../error'; | ||
nbbeeken marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import { ServiceWorkflow } from './service_workflow'; | ||
|
||
/** Error for when the token is missing in the environment. */ | ||
const TOKEN_MISSING_ERROR = 'AWS_WEB_IDENTITY_TOKEN_FILE must be set in the environment.'; | ||
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 and other string constants just a simple refactoring of any non-interpolated string being a constant. |
||
|
||
/** | ||
* Device workflow implementation for AWS. | ||
* | ||
|
@@ -19,8 +22,8 @@ export class AwsServiceWorkflow extends ServiceWorkflow { | |
async getToken(): Promise<string> { | ||
const tokenFile = process.env.AWS_WEB_IDENTITY_TOKEN_FILE; | ||
if (!tokenFile) { | ||
throw new MongoAWSError('AWS_WEB_IDENTITY_TOKEN_FILE must be set in the environment.'); | ||
throw new MongoAWSError(TOKEN_MISSING_ERROR); | ||
} | ||
return readFile(tokenFile, 'utf8'); | ||
return fs.promises.readFile(tokenFile, 'utf8'); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Base class for OIDC caches. | ||
*/ | ||
export abstract class Cache<T> { | ||
entries: Map<string, T>; | ||
|
||
/** | ||
* Create a new cache. | ||
*/ | ||
constructor() { | ||
this.entries = new Map<string, T>(); | ||
} | ||
|
||
/** | ||
* Clear the cache. | ||
*/ | ||
clear() { | ||
this.entries.clear(); | ||
} | ||
|
||
/** | ||
* Create a cache key from the address and username. | ||
*/ | ||
cacheKey(address: string, username: string, callbackHash: string): string { | ||
return JSON.stringify([address, username, callbackHash]); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Speculative auth is implemented in the the workflows.