This repository has been archived by the owner on Oct 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updates libs to use AuthJS 2.0 * Increment package versions and update changelings * Update wait times in vie tests, these tests appear to be affected by the new async nature of the token getter
- Loading branch information
1 parent
2e251da
commit 2928b1f
Showing
19 changed files
with
4,017 additions
and
588 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
# 1.0.3 | ||
|
||
### Other | ||
|
||
- Updated `@okta/okta-auth-js` dependency to version 2. | ||
|
||
# 1.0.2 | ||
|
||
### Other | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,5 @@ | ||
# 1.0.3 | ||
|
||
### Other | ||
|
||
- Updated `@okta/okta-auth-js` dependency to version 2. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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 |
---|---|---|
@@ -1,11 +1,56 @@ | ||
import Auth from '../../src/Auth'; | ||
|
||
import AuthJS from '@okta/okta-auth-js' | ||
const pkg = require('../../package.json'); | ||
|
||
jest.mock('@okta/okta-auth-js'); | ||
|
||
const mockAccessToken = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXIiOj' + | ||
'EsImp0aSI6IkFULnJ2Ym5TNGlXdTJhRE5jYTNid1RmMEg5Z' + | ||
'VdjV2xsS1FlaU5ZX1ZlSW1NWkEiLCJpc3MiOiJodHRwczov' + | ||
'L2xib3lldHRlLnRyZXhjbG91ZC5jb20vYXMvb3JzMXJnM3p' + | ||
'5YzhtdlZUSk8wZzciLCJhdWQiOiJodHRwczovL2xib3lldH' + | ||
'RlLnRyZXhjbG91ZC5jb20vYXMvb3JzMXJnM3p5YzhtdlZUS' + | ||
'k8wZzciLCJzdWIiOiIwMHUxcGNsYTVxWUlSRURMV0NRViIs' + | ||
'ImlhdCI6MTQ2ODQ2NzY0NywiZXhwIjoxNDY4NDcxMjQ3LCJ' + | ||
'jaWQiOiJQZjBhaWZyaFladTF2MFAxYkZGeiIsInVpZCI6Ij' + | ||
'AwdTFwY2xhNXFZSVJFRExXQ1FWIiwic2NwIjpbIm9wZW5pZ' + | ||
'CIsImVtYWlsIl19.ziKfS8IjSdOdTHCZllTDnLFdE96U9bS' + | ||
'IsJzI0MQ0zlnM2QiiA7nvS54k6Xy78ebnkJvmeMCctjXVKk' + | ||
'JOEhR6vs11qVmIgbwZ4--MqUIRU3WoFEsr0muLl039QrUa1' + | ||
'EQ9-Ua9rPOMaO0pFC6h2lfB_HfzGifXATKsN-wLdxk6cgA'; | ||
|
||
const standardAccessTokenParsed = { | ||
accessToken: mockAccessToken, | ||
expiresAt: new Date().getTime() + 100, // ensure token is active | ||
scopes: ['openid', 'email'], | ||
tokenType: 'Bearer', | ||
authorizeUrl: 'https://foo/oauth2/v1/authorize', | ||
userinfoUrl: 'https://foo/oauth2/v1/userinfo' | ||
}; | ||
|
||
const mockAuthJsInstance = { | ||
userAgent: 'okta-auth-js', | ||
tokenManager: { | ||
get: jest.fn().mockReturnValue(Promise.resolve(standardAccessTokenParsed)) | ||
} | ||
}; | ||
|
||
AuthJS.mockImplementation(() => { | ||
return mockAuthJsInstance | ||
}); | ||
|
||
test('Auth component sets the right user agent on AuthJS', () => { | ||
const auth = new Auth({ | ||
issuer: 'https://foo/oauth2/default' | ||
}); | ||
const expectedUserAgent = `${pkg.name}/${pkg.version} okta-auth-js-`; | ||
const expectedUserAgent = `${pkg.name}/${pkg.version} okta-auth-js`; | ||
expect(auth._oktaAuth.userAgent).toMatch(expectedUserAgent); | ||
}); | ||
test('Auth component can retrieve an accessToken from the tokenManager', async (done) => { | ||
const auth = new Auth({ | ||
issuer: 'https://foo/oauth2/default' | ||
}); | ||
const accessToken = await auth.getAccessToken(); | ||
expect(accessToken).toBe(mockAccessToken); | ||
done(); | ||
}); |
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,5 @@ | ||
# 1.0.2 | ||
|
||
### Other | ||
|
||
- Updated `@okta/okta-auth-js` dependency to version 2. |
Oops, something went wrong.