Skip to content

Commit

Permalink
FI-3285: Add fields to backend services access mode (#544)
Browse files Browse the repository at this point in the history
* show access fields for backend services access mode

* simplify hide condition

* rename token check

* update to variable name
  • Loading branch information
AlyssaWang authored Oct 23, 2024
1 parent b1af368 commit a3c913e
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions client/src/components/InputsModal/AuthSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ export const getAccessFields = (
accessValues: Map<string, unknown>,
components: TestInput[],
): TestInput[] => {
const tokenDoesNotExist =
authType === 'backend_services'
? !accessValues.get('access_token')
: !accessValues.get('refresh_token');

const fields = [
{
name: 'access_token',
Expand All @@ -249,7 +254,7 @@ export const getAccessFields = (
title: 'Client ID',
description: 'Client ID provided during registration of Inferno',
optional: true,
hide: !accessValues.get('refresh_token'),
hide: tokenDoesNotExist,
},
{
name: 'client_secret',
Expand All @@ -263,7 +268,7 @@ export const getAccessFields = (
title: 'Token URL',
description: "URL of the authorization server's token endpoint",
optional: true,
hide: !accessValues.get('refresh_token'),
hide: tokenDoesNotExist,
},
{
name: 'encryption_algorithm',
Expand All @@ -282,20 +287,15 @@ export const getAccessFields = (
],
},
optional: true,
hide:
!accessValues.get('refresh_token') ||
(authType === 'backend_services' && !accessValues.get('access_token')),
hide: tokenDoesNotExist,
},
{
name: 'kid',
title: 'Key ID (kid)',
description:
'Key ID of the JWKS private key used to sign the client assertion. If blank, the first key for the selected encryption algorithm will be used.',
optional: true,
hide:
authType === 'backend_services'
? !accessValues.get('access_token')
: !accessValues.get('refresh_token'),
hide: tokenDoesNotExist,
},
{
name: 'jwks',
Expand All @@ -304,30 +304,21 @@ export const getAccessFields = (
description:
"The JWKS (including private keys) which will be used to sign the client assertion. If blank, Inferno's default JWKS will be used.",
optional: true,
hide:
authType === 'backend_services'
? !accessValues.get('access_token')
: !accessValues.get('refresh_token'),
hide: tokenDoesNotExist,
},
{
name: 'issue_time',
title: 'Access Token Issue Time',
description: 'The time that the access token was issued in iso8601 format',
optional: true,
hide:
authType === 'backend_services'
? !accessValues.get('access_token')
: !accessValues.get('refresh_token'),
hide: tokenDoesNotExist,
},
{
name: 'expires_in',
title: 'Token Lifetime',
description: 'The lifetime of the access token in seconds',
optional: true,
hide:
authType === 'backend_services'
? !accessValues.get('access_token')
: !accessValues.get('refresh_token'),
hide: tokenDoesNotExist,
},
] as TestInput[];

Expand Down

0 comments on commit a3c913e

Please sign in to comment.