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

FI-3285: Add fields to backend services access mode #544

Merged
merged 7 commits into from
Oct 23, 2024
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 backendServicesHideCondition =
Copy link
Collaborator

Choose a reason for hiding this comment

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

This isn't just for backend services, though, it's for everything, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sort of? I named it that since it stipulates backend_services in the check itself but I think this could be better named regardless -- updated.

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: backendServicesHideCondition,
},
{
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: backendServicesHideCondition,
},
{
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: backendServicesHideCondition,
},
{
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: backendServicesHideCondition,
},
{
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: backendServicesHideCondition,
},
{
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: backendServicesHideCondition,
},
{
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: backendServicesHideCondition,
},
] as TestInput[];

Expand Down
Loading