Skip to content
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

feat: custom user agent CognitoUser changes for UI handoff #11643

Draft
wants to merge 30 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
378bc6b
chore: port code from CognitoUser and CognitoUserPool to internals
erinleigh90 Jul 17, 2023
241b3fa
chore: update imports and class name
erinleigh90 Jul 17, 2023
e9a7c58
feat: add userAgentValue param to cognito client api's
erinleigh90 Jul 17, 2023
077ccaf
feat: add userAgentValue param to InternalCognitoUser api's, pass to …
erinleigh90 Jul 17, 2023
511a744
feat: make CognitoUser extend InternalCognitoUser and override api's
erinleigh90 Jul 17, 2023
3c7264c
test: update tests to work with additional param, minor fix
erinleigh90 Jul 17, 2023
76223e6
chore: clean up unused imports and const's
erinleigh90 Jul 17, 2023
646f20a
feat: add missing userAgentValue param
erinleigh90 Jul 17, 2023
91af54e
chore: add new param to documentation comments
erinleigh90 Jul 17, 2023
d1c13d0
build: export InternalCognitoUser from internals scope
erinleigh90 Jul 17, 2023
5aad5c6
feat: send userAgent from auth actions to cognito service calls
erinleigh90 Jul 18, 2023
b1194b4
fix: remove default from InternalCognitoUser to fix scoped export
erinleigh90 Jul 18, 2023
1576463
chore: consolidate core imports
erinleigh90 Jul 18, 2023
badcffc
fix: correct wrong AuthAction for deleteUserAttributes
erinleigh90 Jul 18, 2023
9ecb8dc
test: update auth-unit-test to expect extra cognitouser param
erinleigh90 Jul 18, 2023
7b4ff62
Merge branch 'main' into feat/custom-user-agent-ui/cognito
erinleigh90 Jul 18, 2023
7ea3251
chore: increase bundle size-limits
erinleigh90 Jul 18, 2023
4182815
chore: increase bundle size limits
erinleigh90 Jul 18, 2023
77efe73
chore: delete unfinished InternalCognitoUserPool
erinleigh90 Jul 19, 2023
d870265
chore: trigger full integ test run on cognito branch
erinleigh90 Jul 19, 2023
acb90e8
chore: increase bundle size limit
erinleigh90 Jul 19, 2023
609fe14
chore: add casting back into verifyTotpToken to be safe
erinleigh90 Jul 19, 2023
444ef9b
chore: remove changes to return/param typing
erinleigh90 Jul 19, 2023
d3451f6
Merge branch 'main' into feat/custom-user-agent-ui/cognito
erinleigh90 Jul 28, 2023
a52449e
fix: fix typo causing signOut failure
erinleigh90 Jul 31, 2023
1842959
build: correct index.d.ts files with changes
erinleigh90 Jul 31, 2023
1752b30
Merge branch 'main' into feat/custom-user-agent-ui/cognito
erinleigh90 Aug 1, 2023
4330329
chore: remove branch from releasable_branches
erinleigh90 Aug 1, 2023
1806ad0
chore: increase bundle size limits
erinleigh90 Aug 2, 2023
f37b545
chore: increase bundle size limit
erinleigh90 Aug 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1632,6 +1632,7 @@ releasable_branches: &releasable_branches
- release
- main
- next
- feat/custom-user-agent-ui/cognito
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum appears this didn't trigger a run in circle CI. Probably need to push feature branch to main repo (can keep the PR branch how it is).


# List of test browsers that are always used in every E2E test. Tests that aren't expected to interact with browser APIs
# should use `minimal_browser_list` to keep test execution time low.
Expand Down
22 changes: 12 additions & 10 deletions packages/amazon-cognito-identity-js/__tests__/CognitoUser.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ describe('authenticateUser()', () => {
user.setAuthenticationFlowType('USER_PASSWORD_AUTH');
user.authenticateUser(authDetails, callback);

expect(spyon).toHaveBeenCalledWith(authDetails, callback);
expect(spyon).toHaveBeenCalledWith(authDetails, callback, undefined);
});

test('USER_SRP_AUTH and CUSTOM_AUTH flow types', () => {
Expand All @@ -212,12 +212,12 @@ describe('authenticateUser()', () => {
user.setAuthenticationFlowType('USER_SRP_AUTH');
user.authenticateUser(authDetails, callback);

expect(spyon).toHaveBeenCalledWith(authDetails, callback);
expect(spyon).toHaveBeenCalledWith(authDetails, callback, undefined);

user.setAuthenticationFlowType('CUSTOM_AUTH');
user.authenticateUser(authDetails, callback);

expect(spyon).toHaveBeenCalledWith(authDetails, callback);
expect(spyon).toHaveBeenCalledWith(authDetails, callback, undefined);
});

test('throws error for invalid Authentication flow type', () => {
Expand Down Expand Up @@ -310,7 +310,8 @@ describe('authenticateUserPlainUsernamePassword()', () => {
expect(userSpy3).toBeCalledWith(
'test auth result',
userSpy3.mock.calls[0][1],
callback
callback,
undefined
);
expect(userSpy3.mock.results[0].value).toBe('test return value');
});
Expand Down Expand Up @@ -755,7 +756,8 @@ describe('sendCustomChallengeAnswer()', () => {
expect(spyon3).toBeCalledWith(
vCognitoUserSession,
expect.any(AuthenticationHelper),
callback
callback,
undefined
);
});

Expand Down Expand Up @@ -1176,33 +1178,33 @@ describe('confirmPassword() and forgotPassword()', () => {
jest.clearAllMocks();
});

test('happy path should callback onSuccess', () => {
test('confirmPassword happy path should callback onSuccess', () => {
netRequestMockSuccess(true);
cognitoUser.confirmPassword(...confirmPasswordDefaults);
expect(callback.onSuccess).toHaveBeenCalledWith('SUCCESS');
});

test('client request throws an error', () => {
test('confirmPassword client request throws an error', () => {
netRequestMockSuccess(false);
cognitoUser.confirmPassword(...confirmPasswordDefaults);
expect(callback.onFailure.mock.calls.length).toEqual(1);
});

test('happy path should callback onSuccess', () => {
test('forgotPassword happy path should callback onSuccess', () => {
callback.inputVerificationCode = null;
netRequestMockSuccess(true);
cognitoUser.forgotPassword(...forgotPasswordDefaults);
expect(callback.onSuccess.mock.calls.length).toEqual(1);
});

test('inputVerification code is a function should callback inputVerificationCode', () => {
test('forgotPassword inputVerification code is a function should callback inputVerificationCode', () => {
callback.inputVerificationCode = jest.fn();
netRequestMockSuccess(true);
cognitoUser.forgotPassword(...forgotPasswordDefaults);
expect(callback.inputVerificationCode.mock.calls.length).toEqual(1);
});

test('client returning an error should call onFailure', () => {
test('forgotPassword client returning an error should call onFailure', () => {
netRequestMockSuccess(false);
cognitoUser.forgotPassword(...forgotPasswordDefaults);
expect(callback.onFailure.mock.calls.length).toEqual(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ describe('import * keys', () => {
Array [
"addAuthCategoryToCognitoUserAgent",
"addFrameworkToCognitoUserAgent",
"InternalCognitoUser",
]
`);
});
Expand Down
266 changes: 266 additions & 0 deletions packages/amazon-cognito-identity-js/internals/index.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading