Skip to content

Commit

Permalink
Merge branch '6.4' into ag-backport-6-4-5-to-6-5
Browse files Browse the repository at this point in the history
  • Loading branch information
aarongranick-okta committed May 5, 2022
2 parents b747841 + 445b4fb commit 5a43bdb
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 14 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,16 @@
### Fixes

- [#1189](https://github.com/okta/okta-auth-js/pull/1189) IDX: fixes `input` type indicator's field name for `username` and `authenticator`. Before the indicator was named as `key`, now it's fixed to `type` to follow input metadata with all other inputs.
## 6.4.5

### Fixes

- [#1240](https://github.com/okta/okta-auth-js/pull/1204) Fixes Apple SSO flow: includes `stepUp` on returned `IdxTransaction`

## 6.4.4

### Fixes

- [#1199](https://github.com/okta/okta-auth-js/pull/1199) Fixes webauthn enrollment/verification to accept `credentials` object

## 6.4.3
Expand Down
5 changes: 3 additions & 2 deletions lib/idx/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,8 @@ export async function run(
}
}

// from idx-js, used by the widget
const { actions, context, neededToProceed, proceed, rawIdxState, requestDidSucceed } = idxResponse || {};
// copy all fields from idxResponse which are needed by the widget
const { actions, context, neededToProceed, proceed, rawIdxState, requestDidSucceed, stepUp } = idxResponse || {};
return {
status: status!,
...(meta && { meta }),
Expand All @@ -374,6 +374,7 @@ export async function run(
...(nextStep && { nextStep }),
...(messages && messages.length && { messages }),
...(error && { error }),
...(stepUp && { stepUp }),
interactionCode, // if options.exchangeCodeForTokens is false

// from idx-js
Expand Down
3 changes: 2 additions & 1 deletion lib/idx/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ export interface IdxTransaction {
enabledFeatures?: IdxFeature[];
availableSteps?: NextStep[];
requestDidSucceed?: boolean;

stepUp?: boolean;

// from idx-js, used by signin widget
proceed: (remediationName: string, params: unknown) => Promise<IdxResponse>;
neededToProceed: IdxRemediation[];
Expand Down
41 changes: 30 additions & 11 deletions test/spec/idx/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,20 +390,39 @@ describe('idx/run', () => {
expect(authClient.transactionManager.clear).not.toHaveBeenCalled();
});

it('does not include "stepUp" on the returned transaction', async () => {
const { authClient } = testContext;
const res = await run(authClient);
expect(res.stepUp).toBe(undefined);
});

// Special case of an error response that can be continued
it('does save the idxResponse if stepUp is true', async () =>{
const { authClient, idxResponse, transactionMeta } = testContext;
idxResponse.requestDidSucceed = false;
idxResponse.stepUp = true;
jest.spyOn(authClient.transactionManager, 'saveIdxResponse');
await run(authClient);
expect(authClient.transactionManager.saveIdxResponse).toHaveBeenCalledWith({
rawIdxResponse: idxResponse.rawIdxState,
requestDidSucceed: false,
stateHandle: idxResponse.context.stateHandle,
interactionHandle: transactionMeta.interactionHandle
describe('stepUp', () => {
beforeEach(() => {
const { idxResponse } = testContext;
idxResponse.stepUp = true;
});

it('does save the idxResponse', async () =>{
const { authClient, idxResponse, transactionMeta } = testContext;
jest.spyOn(authClient.transactionManager, 'saveIdxResponse');
await run(authClient);
expect(authClient.transactionManager.saveIdxResponse).toHaveBeenCalledWith({
rawIdxResponse: idxResponse.rawIdxState,
requestDidSucceed: false,
stateHandle: idxResponse.context.stateHandle,
interactionHandle: transactionMeta.interactionHandle
});
});

it('includes "stepUp" on the returned transaction', async () => {
const { authClient } = testContext;
const res = await run(authClient);
expect(res.stepUp).toBe(true);
});

});

});
});

Expand Down

0 comments on commit 5a43bdb

Please sign in to comment.