Skip to content

Commit db600ca

Browse files
mkurapovcozminunjlie
authored
fix(mase): handle subjectId null case (#3707)
* feat(auth): add subject to grant * feat(auth): add subject to grant * fix(auth): grant access when is undefined * feat(auth): subject id validation * fix(auth): fix tests * Update packages/auth/src/graphql/schema.graphql Co-authored-by: Max Kurapov <[email protected]> * feat(auth): throw GrantError instead of Error * fix(auth): description for subIdFormat * fix(auth): trx in tests is knex * fix: grant service to throw only grant errors * fix(auth): address change requests * fix(auth): address change requests * fix tests * access token optional in grant response * fix(auth): move accessErrorsMap to grant * fix(auth): fix test for grant access * fix(auth): changed interaction generic error message * use main OpenAPI spec for Auth * fix(auth): approved grant does not return subject * fix(auth): remove unused import Co-authored-by: Max Kurapov <[email protected]> * fix(auth): make access_token optional in response * fix(deps): sha.js critical update * fix(deps): critical update * Update package.json Co-authored-by: Max Kurapov <[email protected]> * update pnpm lock file * change op specs version * feat(auth): update idp openapi spec * feat(auth): make idp standalone * chore(deps): update axios * fix(auth): access token in response when it shouldnt * fix(auth): tests * try to fix grype scan * try fix grype * restore 'fix' * try fix grype * try fix grype 2 * feat(localenv): expose subject during consent in mock-ase (#3666) * feat(localenv): expose subject during consent in mock-ase * feat: include client name in subject grant line * fix(mase): grantId not being retrieved * fix(mase): consent and confirmation texts * fix: handle subject-only grants properly --------- Co-authored-by: Cozmin Ungureanu <[email protected]> * fix(mase): handle subjectId null case * chore(mase): remove unused SubjectId type --------- Co-authored-by: Cozmin Ungureanu <[email protected]> Co-authored-by: Nathan Lie <[email protected]>
1 parent 539ced6 commit db600ca

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

localenv/mock-account-servicing-entity/app/lib/types.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ export interface Access {
2828
limits?: AccessLimit
2929
}
3030

31-
export interface SubjectId {
32-
id: string
33-
format: string
34-
}
35-
3631
export type InstanceConfig = {
3732
name: string
3833
logo: string

localenv/mock-account-servicing-entity/app/routes/mock-idp._index.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type { Dispatch, SetStateAction } from 'react'
88
import { useEffect, useState } from 'react'
99
import { Button } from '~/components'
1010
import { ApiClient } from '~/lib/apiClient'
11-
import type { Access, InstanceConfig, SubjectId } from '~/lib/types'
11+
import type { Access, InstanceConfig } from '~/lib/types'
1212
import { CONFIG } from '~/lib/parse_config.server'
1313

1414
interface ConsentScreenContext {
@@ -20,7 +20,7 @@ interface ConsentScreenContext {
2020
returnUrl: string
2121
accesses: Array<Access> | null
2222
outgoingPaymentAccess: Access | null
23-
subjectId: SubjectId | null
23+
subjectId: string | null
2424
price: GrantAmount | null
2525
costToUser: GrantAmount | null
2626
errors: Array<Error>
@@ -64,7 +64,7 @@ function ConsentScreenBody({
6464
interactId: string
6565
nonce: string
6666
returnUrl: string
67-
subjectId: SubjectId | null
67+
subjectId: string | null
6868
}) {
6969
const chooseConsent = (accept: boolean) => {
7070
const href = new URL(returnUrl)
@@ -82,7 +82,7 @@ function ConsentScreenBody({
8282
{subjectId && (
8383
<p>
8484
{thirdPartyName} is asking you to confirm ownership of{' '}
85-
{subjectId.id}.
85+
{subjectId}.
8686
</p>
8787
)}
8888
</div>
@@ -365,14 +365,15 @@ export default function ConsentScreen({ idpSecretParam }: ConsentScreenProps) {
365365
: AmountType.UNLIMITED
366366
)
367367
}
368-
returnUrlObject.searchParams.append(
369-
'subjectId',
370-
response.payload.subject.sub_ids[0]?.id ?? null
371-
)
368+
369+
const subjectId = response.payload.subject?.sub_ids[0]?.id ?? null
370+
if (subjectId) {
371+
returnUrlObject.searchParams.append('subjectId', subjectId)
372+
}
372373
setCtx({
373374
...ctx,
374375
accesses: response.payload.access,
375-
subjectId: response.payload.subject.sub_ids[0],
376+
subjectId,
376377
outgoingPaymentAccess: outgoingPaymentAccess,
377378
thirdPartyName: ctx.thirdPartyName,
378379
thirdPartyUri: ctx.thirdPartyUri,

0 commit comments

Comments
 (0)