From 921c1e85f4de29c62e47d1cf7b94a8049f3b573f Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 14 Nov 2022 09:43:14 -0600 Subject: [PATCH 1/9] feat: add support for expiring applications --- src/types/models/applications.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/types/models/applications.ts b/src/types/models/applications.ts index 628c0723..0a759d12 100644 --- a/src/types/models/applications.ts +++ b/src/types/models/applications.ts @@ -19,6 +19,8 @@ interface Application extends Auditable { type: ApplicationType; permissions?: string[]; rules?: AccessRule[]; + canCreateExpiringApplications?: boolean; + expiresAt?: string; } interface AccessRule { From 5889fb68c6be902c91bb1c0f29b349fb49ddccde Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 15 Nov 2022 16:11:32 -0600 Subject: [PATCH 2/9] test(application): update mocks --- test/applications.test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/applications.test.ts b/test/applications.test.ts index 0a7ee7d1..5766c95d 100644 --- a/test/applications.test.ts +++ b/test/applications.test.ts @@ -37,6 +37,8 @@ describe('Applications', () => { name: chance.string(), type: chance.string() as ApplicationType, permissions: [chance.string()], + canCreateExpiringApplications: chance.bool(), + expiresAt: chance.date().toString(), }, updatePayload: { name: chance.string(), @@ -65,6 +67,8 @@ describe('Applications', () => { permissions: [chance.string()], }, ], + canCreateExpiringApplications: chance.bool(), + expiresAt: chance.date().toString(), }, updatePayload: { name: chance.string(), From 47f7e17c4dd3cfdd51c16731818d310d07ea818c Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 15 Nov 2022 16:12:12 -0600 Subject: [PATCH 3/9] feat(application): make name optional to support expiring apps --- src/types/models/applications.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/models/applications.ts b/src/types/models/applications.ts index 0a759d12..9271091e 100644 --- a/src/types/models/applications.ts +++ b/src/types/models/applications.ts @@ -14,7 +14,7 @@ type TransformType = typeof TRANSFORM_TYPES[number]; interface Application extends Auditable { id: string; tenantId: string; - name: string; + name?: string; key?: string; type: ApplicationType; permissions?: string[]; From 095f5fa2f9d0420371fa5eb954012cf47284723b Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 15 Nov 2022 16:13:00 -0600 Subject: [PATCH 4/9] feat(tokens): add expiresAt to update token request --- src/types/models/tokens.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/types/models/tokens.ts b/src/types/models/tokens.ts index f2fff00a..b5eb62e3 100644 --- a/src/types/models/tokens.ts +++ b/src/types/models/tokens.ts @@ -82,6 +82,7 @@ type UpdateToken = Partial< | 'searchIndexes' | 'fingerprintExpression' | 'mask' + | 'expiresAt' > & { privacy: Omit; deduplicateToken: boolean; From 16c6636e38cd63e81d1661f5b2e83282506139c7 Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 15 Nov 2022 16:13:24 -0600 Subject: [PATCH 5/9] test(tokens): add expiresAt to mocks --- test/tokens.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/tokens.test.ts b/test/tokens.test.ts index 96d3114b..323c5420 100644 --- a/test/tokens.test.ts +++ b/test/tokens.test.ts @@ -646,6 +646,7 @@ describe('Tokens', () => { alg: _chance.string(), }, }, + expiresAt: _chance.date().toString(), metadata: { camelCaseParameter: _chance.string(), snake_case_parameter: _chance.string(), @@ -709,6 +710,7 @@ describe('Tokens', () => { }, searchIndexes: [_chance.string(), _chance.string()], fingerprintExpression: _chance.string(), + expiresAt: _chance.date().toString(), }; /* eslint-enable camelcase */ From 4a2b7f67410ddec6ab36ded45734e991babea3dc Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 15 Nov 2022 16:32:25 -0600 Subject: [PATCH 6/9] feat(applications): add conditions to access rules --- src/types/models/applications.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/types/models/applications.ts b/src/types/models/applications.ts index 9271091e..3066682b 100644 --- a/src/types/models/applications.ts +++ b/src/types/models/applications.ts @@ -29,8 +29,15 @@ interface AccessRule { container: string; transform: TransformType; permissions: string[]; + conditions: Condition[]; } +type Condition = { + attribute: string; + operator: string; + value: string; +}; + type CreateApplication = Pick & Partial>; From 6d5fe293bfcef2fe995311cde9c796498b48b0be Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 15 Nov 2022 16:34:04 -0600 Subject: [PATCH 7/9] test(applications): add conditions to access rules mocks --- test/applications.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/applications.test.ts b/test/applications.test.ts index 5766c95d..99eb9957 100644 --- a/test/applications.test.ts +++ b/test/applications.test.ts @@ -65,6 +65,13 @@ describe('Applications', () => { 'reveal', ]), permissions: [chance.string()], + conditions: [ + { + attribute: chance.string(), + operator: chance.string(), + value: chance.string(), + }, + ], }, ], canCreateExpiringApplications: chance.bool(), @@ -83,6 +90,7 @@ describe('Applications', () => { 'reveal', ]), permissions: [chance.string()], + conditions: [], }, ], }, From 6660d35054319250ebc29890f1335b9f8bd8bc09 Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 16 Nov 2022 10:12:25 -0600 Subject: [PATCH 8/9] feat(applications): make access rules' conditions optional --- src/types/models/applications.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/models/applications.ts b/src/types/models/applications.ts index 3066682b..c3863845 100644 --- a/src/types/models/applications.ts +++ b/src/types/models/applications.ts @@ -29,7 +29,7 @@ interface AccessRule { container: string; transform: TransformType; permissions: string[]; - conditions: Condition[]; + conditions?: Condition[]; } type Condition = { From 295734b5a0118078c212c4cad3ebae059fe49df8 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 17 Nov 2022 09:55:25 -0600 Subject: [PATCH 9/9] feat(applications): make access rule's container optional --- src/types/models/applications.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/models/applications.ts b/src/types/models/applications.ts index c3863845..34839ada 100644 --- a/src/types/models/applications.ts +++ b/src/types/models/applications.ts @@ -26,7 +26,7 @@ interface Application extends Auditable { interface AccessRule { description: string; priority: number; - container: string; + container?: string; transform: TransformType; permissions: string[]; conditions?: Condition[];