-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: clean up and consolidate AuthClient API between web and node.js…
… SDKs This commit does the following: * Extend CredentialProvider so that it is possible to use a session token with it. (This mostly just entailed checking to see if the endpoint claims exist in the JWT, and if they don't, requiring the user to explicitly override them.) * Refactor the AuthClients to make their constructor require a CredentialProvider, like the CacheClient constructor does. This is possible now that we can support session tokens in CredentialProvider. This allows us to remove the extra arguments for credentials/endpoints from the signatures for the generate and refresh APIs. * Refactor the auth client integration tests that Ben wrote so that they now live in the common-integration-tests package and can be used for both the node.js and web SDKs. * Clean up and complete the implementations of the generate and refresh APIs in the web SDK so that they now have parity with the node.js SDK and can pass the shared integration tests. This commit doesn't address any of the new token generation functionality that we need to complete in order to be able to dynamically generate tokens for the web SDK; that will be handled in a subsequent commit.
- Loading branch information
Showing
25 changed files
with
379 additions
and
295 deletions.
There are no files selected for viewing
This file contains 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 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,8 @@ | ||
import {CredentialProvider} from '.'; | ||
|
||
export interface AuthClientProps { | ||
/** | ||
* controls how the client will get authentication information for connecting to the Momento service | ||
*/ | ||
credentialProvider: CredentialProvider; | ||
} |
This file contains 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 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
116 changes: 0 additions & 116 deletions
116
packages/client-sdk-nodejs/test/integration/auth.test.ts
This file was deleted.
Oops, something went wrong.
This file contains 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
7 changes: 7 additions & 0 deletions
7
packages/client-sdk-nodejs/test/integration/shared/auth-client.test.ts
This file contains 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,7 @@ | ||
import {SetupAuthClientIntegrationTest} from '../integration-setup'; | ||
import {runAuthClientTests} from '@gomomento/common-integration-tests'; | ||
|
||
const {sessionTokenAuthClient, authTokenAuthClientFactory} = | ||
SetupAuthClientIntegrationTest(); | ||
|
||
runAuthClientTests(sessionTokenAuthClient, authTokenAuthClientFactory); |
This file contains 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 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,8 @@ | ||
import {CredentialProvider} from '.'; | ||
|
||
export interface AuthClientProps { | ||
/** | ||
* controls how the client will get authentication information for connecting to the Momento service | ||
*/ | ||
credentialProvider: CredentialProvider; | ||
} |
This file contains 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
Oops, something went wrong.