From dbb330e04e62c35f0fa308746790519ec0c54b3f Mon Sep 17 00:00:00 2001 From: thomasridd Date: Mon, 26 Feb 2024 11:16:44 +0000 Subject: [PATCH] Update to accept/send accessTokenValidity to api in seconds, not minutes --- server/data/localMockData/baseClientsResponseMock.ts | 2 +- server/interfaces/baseClientApi/baseClientRequestBody.ts | 4 ++-- server/interfaces/baseClientApi/baseClientResponse.ts | 2 +- server/mappers/baseClientApi/addBaseClient.ts | 2 +- server/mappers/baseClientApi/getBaseClient.ts | 2 +- server/mappers/baseClientApi/updateBaseClient.ts | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/data/localMockData/baseClientsResponseMock.ts b/server/data/localMockData/baseClientsResponseMock.ts index c114b771..1bde937d 100644 --- a/server/data/localMockData/baseClientsResponseMock.ts +++ b/server/data/localMockData/baseClientsResponseMock.ts @@ -44,7 +44,7 @@ export const getBaseClientResponseMock: (grantType: GrantTypes) => GetBaseClient ips: [], jiraNumber: 'jiraNumber', validDays: 1, - accessTokenValidityMinutes: 60, + accessTokenValiditySeconds: 3600, deployment: { clientType: 'service', team: 'deployment team', diff --git a/server/interfaces/baseClientApi/baseClientRequestBody.ts b/server/interfaces/baseClientApi/baseClientRequestBody.ts index 9fca9f61..42511c50 100644 --- a/server/interfaces/baseClientApi/baseClientRequestBody.ts +++ b/server/interfaces/baseClientApi/baseClientRequestBody.ts @@ -6,7 +6,7 @@ export interface AddBaseClientRequest { jiraNumber?: string databaseUserName?: string validDays?: number - accessTokenValidityMinutes?: number + accessTokenValiditySeconds?: number grantType?: string mfa?: string mfaRememberMe?: boolean @@ -21,7 +21,7 @@ export interface UpdateBaseClientRequest { jiraNumber?: string databaseUserName?: string validDays?: number - accessTokenValidityMinutes?: number + accessTokenValiditySeconds?: number grantType?: string mfa?: string mfaRememberMe?: boolean diff --git a/server/interfaces/baseClientApi/baseClientResponse.ts b/server/interfaces/baseClientApi/baseClientResponse.ts index b9658088..26d2ed1c 100644 --- a/server/interfaces/baseClientApi/baseClientResponse.ts +++ b/server/interfaces/baseClientApi/baseClientResponse.ts @@ -21,7 +21,7 @@ export interface GetBaseClientResponse { jiraNumber?: string databaseUserName?: string validDays?: number - accessTokenValidityMinutes?: number + accessTokenValiditySeconds?: number grantType?: string mfa?: string mfaRememberMe?: boolean diff --git a/server/mappers/baseClientApi/addBaseClient.ts b/server/mappers/baseClientApi/addBaseClient.ts index 6a6ea3d0..8667a81f 100644 --- a/server/mappers/baseClientApi/addBaseClient.ts +++ b/server/mappers/baseClientApi/addBaseClient.ts @@ -11,7 +11,7 @@ export default (baseClient: BaseClient): AddBaseClientRequest => { jiraNumber: baseClient.audit, databaseUserName: baseClient.clientCredentials.databaseUserName, validDays: baseClient.config.expiryDate ? daysRemaining(baseClient.config.expiryDate) : null, - accessTokenValidityMinutes: baseClient.accessTokenValidity ? baseClient.accessTokenValidity / 60 : null, + accessTokenValiditySeconds: baseClient.accessTokenValidity ? baseClient.accessTokenValidity : null, grantType: snakeUpper(baseClient.grantType), mfa: baseClient.authorisationCode.mfa, mfaRememberMe: baseClient.authorisationCode.mfaRememberMe, diff --git a/server/mappers/baseClientApi/getBaseClient.ts b/server/mappers/baseClientApi/getBaseClient.ts index 50e6cf1e..8edd7426 100644 --- a/server/mappers/baseClientApi/getBaseClient.ts +++ b/server/mappers/baseClientApi/getBaseClient.ts @@ -7,7 +7,7 @@ import { snake } from '../../utils/utils' export default (response: GetBaseClientResponse): BaseClient => { return { baseClientId: response.clientId, - accessTokenValidity: response.accessTokenValidityMinutes ? response.accessTokenValidityMinutes * 60 : 0, + accessTokenValidity: response.accessTokenValiditySeconds ? response.accessTokenValiditySeconds : 0, scopes: response.scopes ? response.scopes : [], grantType: snake(response.grantType), audit: response.jiraNumber ? response.jiraNumber : '', diff --git a/server/mappers/baseClientApi/updateBaseClient.ts b/server/mappers/baseClientApi/updateBaseClient.ts index 21f72a2b..aa8c598f 100644 --- a/server/mappers/baseClientApi/updateBaseClient.ts +++ b/server/mappers/baseClientApi/updateBaseClient.ts @@ -10,7 +10,7 @@ export default (baseClient: BaseClient): UpdateBaseClientRequest => { jiraNumber: baseClient.audit, databaseUserName: baseClient.clientCredentials.databaseUserName, validDays: baseClient.config.expiryDate ? daysRemaining(baseClient.config.expiryDate) : null, - accessTokenValidityMinutes: baseClient.accessTokenValidity ? baseClient.accessTokenValidity / 60 : null, + accessTokenValiditySeconds: baseClient.accessTokenValidity ? baseClient.accessTokenValidity : null, grantType: snakeUpper(baseClient.grantType), mfa: baseClient.authorisationCode.mfa, mfaRememberMe: baseClient.authorisationCode.mfaRememberMe,