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

IMN-616 BFF Tools router #976

Merged
merged 452 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
452 commits
Select commit Hold shift + click to select a range
3bf72b3
Fix errors data
shuyec Sep 11, 2024
facb19c
Refactor
taglioni-r Sep 11, 2024
331b6b1
Merge branch 'IMN-522_client-assertion-validation' of https://github.…
taglioni-r Sep 11, 2024
59f0aa5
Update comment
taglioni-r Sep 11, 2024
c1c4c3e
Fix checks
taglioni-r Sep 11, 2024
b72c5dc
Update test utils
taglioni-r Sep 11, 2024
9ba64f6
Draft tests
taglioni-r Sep 11, 2024
feddfe6
Add errors
shuyec Sep 11, 2024
659d4d1
Fix algorithm error
shuyec Sep 11, 2024
8f774eb
Refactor validateSub
taglioni-r Sep 11, 2024
3991d66
Fix mock
taglioni-r Sep 11, 2024
c97619f
Update tests
taglioni-r Sep 11, 2024
5a49356
Remove printed errors
taglioni-r Sep 11, 2024
b12a6ea
Add errors
shuyec Sep 11, 2024
2060029
Merge branch 'IMN-797_catalog-platformstate-writer-v1' into IMN-522_c…
taglioni-r Sep 12, 2024
e2d2de3
Fix tests
shuyec Sep 12, 2024
c73ddf5
Merge branch 'IMN-522_client-assertion-validation' of https://github.…
shuyec Sep 12, 2024
0105452
Improvements
shuyec Sep 12, 2024
98784fc
Improvements
shuyec Sep 12, 2024
04c7aa4
Fix
taglioni-r Sep 12, 2024
762d65b
Fix import
taglioni-r Sep 12, 2024
8ea2212
Refactor
taglioni-r Sep 12, 2024
2fa65e0
Add check
taglioni-r Sep 12, 2024
1f8aa0e
Fix test
taglioni-r Sep 12, 2024
4784b7c
Merge branch 'IMN-796_catalog-platform-state-writer-scaffold' into IM…
taglioni-r Sep 12, 2024
c3814e1
Merge branch 'IMN-798_catalog-platformstate-writer-v2' into IMN-797_c…
taglioni-r Sep 12, 2024
edcfd79
Merge branch 'IMN-797_catalog-platformstate-writer-v1' into IMN-522_c…
taglioni-r Sep 12, 2024
9a19717
Fix
taglioni-r Sep 12, 2024
6a08e96
Merge branch 'IMN-522_client-assertion-validation' of https://github.…
taglioni-r Sep 12, 2024
d212b09
Refactor
taglioni-r Sep 12, 2024
e2e50a3
Add tests
taglioni-r Sep 12, 2024
8b16304
Remove comment
taglioni-r Sep 12, 2024
4a44eb0
Refactor
taglioni-r Sep 13, 2024
8519e60
Refactor
taglioni-r Sep 13, 2024
9a72065
Add util tests
taglioni-r Sep 13, 2024
f4e37aa
Add test
taglioni-r Sep 13, 2024
7a8205f
Fix
taglioni-r Sep 13, 2024
5f62de0
Remove hardcoded string
taglioni-r Sep 13, 2024
7788383
Update comments
taglioni-r Sep 16, 2024
c27e3ad
Fix
taglioni-r Sep 16, 2024
ba9609f
Refactor
taglioni-r Sep 16, 2024
f9ba9db
Refactor
taglioni-r Sep 16, 2024
fd64528
feat: tools router scaffolding
paologaleotti Sep 17, 2024
59d4b44
refactor: removed unused
paologaleotti Sep 17, 2024
9bdea36
Renaming
taglioni-r Sep 17, 2024
7d5e486
Refactor
taglioni-r Sep 18, 2024
519870b
Fix tests
taglioni-r Sep 18, 2024
1f4879e
Merge branch 'IMN-522_client-assertion-validation' into IMN-616_tools…
paologaleotti Sep 18, 2024
bf36128
Refactor
taglioni-r Sep 18, 2024
0925795
Merge branch 'IMN-522_client-assertion-validation' into IMN-616_tools…
paologaleotti Sep 18, 2024
d8a2dcc
Comment function
taglioni-r Sep 18, 2024
06ac883
Merge branch 'IMN-522_client-assertion-validation' into IMN-616_tools…
paologaleotti Sep 19, 2024
6eaba1d
WIP
paologaleotti Sep 20, 2024
7724295
Fix GSIPK_agreementTimestamp typo
shuyec Sep 20, 2024
c708c3e
refactor: WIP
paologaleotti Sep 20, 2024
97872cd
Merge branch 'IMN-796_catalog-platform-state-writer-scaffold' into IM…
shuyec Sep 20, 2024
db0de47
Revert "Fix GSIPK_agreementTimestamp typo"
shuyec Sep 20, 2024
fd04e3b
Merge branch 'IMN-796_catalog-platform-state-writer-scaffold' into IM…
shuyec Sep 20, 2024
ab66811
feat: add state retrieval
paologaleotti Sep 23, 2024
65d4575
refactor: add purpose state retrieve
paologaleotti Sep 23, 2024
f336635
feat: add errors
paologaleotti Sep 23, 2024
5ef7069
feat: add handle validation errors
paologaleotti Sep 23, 2024
d2ffa44
fix: dockerfile
paologaleotti Sep 23, 2024
29a46d3
fix: resolve todo
paologaleotti Sep 23, 2024
6e40daf
feat: add router implementation
paologaleotti Sep 24, 2024
68e9f32
fix: move error check to the top
paologaleotti Sep 24, 2024
ab92c54
Remove unused line
taglioni-r Sep 24, 2024
2ed47eb
Refactor
taglioni-r Sep 24, 2024
bb0ee8d
Merge branch 'IMN-796_catalog-platform-state-writer-scaffold' into IM…
taglioni-r Sep 24, 2024
1860616
Refactor tables setup
taglioni-r Sep 24, 2024
f6e9a08
Update model
taglioni-r Sep 24, 2024
5dbf0bd
Update platform-states table
taglioni-r Sep 24, 2024
3d9664b
Fix
taglioni-r Sep 24, 2024
4f9904a
Update token-generation-states table
taglioni-r Sep 24, 2024
abc158a
Update aws config
taglioni-r Sep 24, 2024
8b6db83
Rename descriptorStateToItemState function
shuyec Sep 24, 2024
3d12bff
Update key types usage
taglioni-r Sep 24, 2024
fda73c2
Merge branch 'IMN-796_catalog-platform-state-writer-scaffold' into IM…
taglioni-r Sep 24, 2024
7a3fc3e
Merge branch 'IMN-798_catalog-platformstate-writer-v2' of https://git…
taglioni-r Sep 24, 2024
6ad6e6f
Fix
taglioni-r Sep 24, 2024
b9b3c4b
Fix test split
taglioni-r Sep 24, 2024
80fd523
Remove describe utils in test file
shuyec Sep 24, 2024
2061be8
Merge branch 'IMN-798_catalog-platformstate-writer-v2' of https://git…
shuyec Sep 24, 2024
ddd4bdc
Minor fix
taglioni-r Sep 24, 2024
8e58388
Fix test structure
taglioni-r Sep 24, 2024
ab04510
Fix tests
taglioni-r Sep 24, 2024
3e3769f
Fix
taglioni-r Sep 24, 2024
daddb4b
Improve tests
taglioni-r Sep 24, 2024
c875827
Refactor
taglioni-r Sep 24, 2024
b2fe9a8
Merge branch 'IMN-798_catalog-platformstate-writer-v2' into IMN-797_c…
taglioni-r Sep 24, 2024
0b27fbe
Refactor test
taglioni-r Sep 24, 2024
d8a6f37
Rename test file for events V2
shuyec Sep 24, 2024
3d8d605
Merge branch 'IMN-798_catalog-platformstate-writer-v2' into IMN-797_c…
taglioni-r Sep 24, 2024
4c4d753
Fix typo
shuyec Sep 24, 2024
609b392
Fix
taglioni-r Sep 24, 2024
0f51a67
Update tests
taglioni-r Sep 24, 2024
ca4eac5
Merge branch 'IMN-797_catalog-platformstate-writer-v1' into IMN-522_c…
taglioni-r Sep 24, 2024
b0a0be9
Remove api spec
taglioni-r Sep 24, 2024
39e92b4
Merge branch 'IMN-522_client-assertion-validation' into IMN-616_tools…
paologaleotti Sep 24, 2024
1b8b684
Refactor
taglioni-r Sep 24, 2024
0a046dc
Remove comment
taglioni-r Sep 24, 2024
b39d50f
Remove commented code
taglioni-r Sep 24, 2024
2780594
Fix comments
taglioni-r Sep 24, 2024
4bfcfd7
Revert string literal
taglioni-r Sep 24, 2024
b5fff42
Merge branch 'IMN-522_client-assertion-validation' into IMN-616_tools…
paologaleotti Sep 24, 2024
6c445ed
Add env var
taglioni-r Sep 24, 2024
a4fdbfc
Merge branch 'IMN-522_client-assertion-validation' into IMN-616_tools…
paologaleotti Sep 24, 2024
ecb9544
feat: add log
paologaleotti Sep 24, 2024
6917d52
WIP, broken commit
Carminepo2 Sep 24, 2024
87ed88a
feat: add parse in router
paologaleotti Sep 25, 2024
09e27ea
Fix types
Carminepo2 Sep 25, 2024
1bbe00c
Revert "Fix types"
taglioni-r Sep 25, 2024
2b59066
Merge branch 'IMN-798_catalog-platformstate-writer-v2' into IMN-797_c…
taglioni-r Sep 25, 2024
ebb6db9
Revert "WIP, broken commit"
taglioni-r Sep 25, 2024
c745838
Merge branch 'IMN-797_catalog-platformstate-writer-v1' into IMN-522_c…
taglioni-r Sep 25, 2024
5140402
Merge branch 'IMN-522_client-assertion-validation' of https://github.…
paologaleotti Sep 25, 2024
4c6b8ca
cherry-pick: porting splitted generic router
paologaleotti Sep 25, 2024
f05c1c7
Fix model
taglioni-r Sep 25, 2024
386639f
Merge branch 'IMN-796_catalog-platform-state-writer-scaffold' into IM…
taglioni-r Sep 25, 2024
460fc94
Merge branch 'IMN-798_catalog-platformstate-writer-v2' into IMN-797_c…
taglioni-r Sep 25, 2024
f0a2a87
Merge branch 'IMN-797_catalog-platformstate-writer-v1' into IMN-522_c…
taglioni-r Sep 25, 2024
37bf466
Merge branch 'IMN-522_client-assertion-validation' of https://github.…
paologaleotti Sep 25, 2024
905aa06
Fix agreementDescriptorId type
shuyec Sep 25, 2024
b2810da
Merge branch 'IMN-796_catalog-platform-state-writer-scaffold' into IM…
shuyec Sep 25, 2024
03426ba
Merge branch 'IMN-798_catalog-platformstate-writer-v2' into IMN-797_c…
shuyec Sep 25, 2024
ed4cb24
Merge branch 'IMN-797_catalog-platformstate-writer-v1' into IMN-522_c…
shuyec Sep 25, 2024
8772b17
Merge branch 'IMN-522_client-assertion-validation' into IMN-616_tools…
paologaleotti Sep 25, 2024
c3f442d
Update tables setup
taglioni-r Sep 25, 2024
121fdb8
Merge branch 'IMN-798_catalog-platformstate-writer-v2' into IMN-797_c…
taglioni-r Sep 25, 2024
fbb1c7c
Merge branch 'IMN-797_catalog-platformstate-writer-v1' into IMN-522_c…
taglioni-r Sep 25, 2024
9a21d0c
Merge branch 'IMN-522_client-assertion-validation' into IMN-616_tools…
paologaleotti Sep 25, 2024
46f005e
feat: add missing assertion
paologaleotti Sep 26, 2024
7a75b8b
feat: add clientKind and eservice retrieval for validation result
paologaleotti Sep 26, 2024
008edec
refactor: removed json and end
paologaleotti Sep 26, 2024
b492bcf
Merge branch 'feature/IMN-517_authorization-server' into IMN-796_cata…
taglioni-r Sep 26, 2024
0ddcd8e
Move tables definition
taglioni-r Sep 26, 2024
c5ea4c1
Update test utils
taglioni-r Sep 26, 2024
5acb0f4
Merge branch 'IMN-796_catalog-platform-state-writer-scaffold' into IM…
taglioni-r Sep 26, 2024
a38d762
Remove unused error
taglioni-r Sep 26, 2024
ad1dac8
Fix digest type
taglioni-r Sep 26, 2024
fcdb6c0
Fix types in validation request
taglioni-r Sep 26, 2024
4a5c9d6
Remove comments
taglioni-r Sep 26, 2024
ac9b00f
Fix validateSub
taglioni-r Sep 26, 2024
74b2612
Fix check on digest
taglioni-r Sep 26, 2024
1a394e4
Partial revert
taglioni-r Sep 26, 2024
0609f35
Fix digest errors
taglioni-r Sep 26, 2024
b37c400
Remove comment
taglioni-r Sep 26, 2024
1688673
Merge branch 'IMN-522_client-assertion-validation' into IMN-616_tools…
paologaleotti Sep 26, 2024
7c4e32c
Fix check on strings
taglioni-r Sep 26, 2024
0fa7a23
Merge branch 'IMN-522_client-assertion-validation' into IMN-616_tools…
paologaleotti Sep 26, 2024
92972b5
Fix checks
taglioni-r Sep 26, 2024
a02f448
Renaming
taglioni-r Sep 26, 2024
f5a02a1
Merge branch 'IMN-522_client-assertion-validation' into IMN-616_tools…
paologaleotti Sep 26, 2024
207b048
Remove digest from mock
taglioni-r Sep 26, 2024
8edfd7f
Add tests
taglioni-r Sep 26, 2024
33b9ca8
Merge branch 'IMN-522_client-assertion-validation' into IMN-616_tools…
paologaleotti Sep 26, 2024
d4662d4
Update kid regex
taglioni-r Sep 27, 2024
ea45031
Add type checks
taglioni-r Sep 27, 2024
4ddbf76
Merge branch 'IMN-522_client-assertion-validation' into IMN-616_tools…
paologaleotti Sep 27, 2024
8e84a58
Add comment
taglioni-r Sep 27, 2024
58dd973
Add tests
taglioni-r Sep 27, 2024
2896889
Merge similar tests
taglioni-r Sep 27, 2024
263e59c
Update test title
taglioni-r Sep 27, 2024
f369a39
Renaming
taglioni-r Sep 27, 2024
20e5711
Renaming
taglioni-r Sep 27, 2024
98a5387
Renaming
taglioni-r Sep 27, 2024
0e24d73
Improve error
taglioni-r Sep 27, 2024
db141fe
Update error message
taglioni-r Sep 27, 2024
ba8178b
Update signature errors
taglioni-r Sep 27, 2024
294c349
Refactor branded ids
taglioni-r Sep 27, 2024
ce476f0
Fix import
taglioni-r Sep 27, 2024
7d9ca9c
Fix typos
shuyec Sep 27, 2024
c032bcd
Fix GSI names
taglioni-r Sep 27, 2024
28402dc
Update aws region
taglioni-r Sep 27, 2024
86f08e3
Update aws region
taglioni-r Sep 27, 2024
fa46fd7
Merge branch 'IMN-796_catalog-platform-state-writer-scaffold' into IM…
taglioni-r Sep 27, 2024
d5a28bd
Refactor
taglioni-r Sep 27, 2024
7040666
Merge branch 'IMN-798_catalog-platformstate-writer-v2' of https://git…
taglioni-r Sep 27, 2024
7a84286
Fix GSI name
taglioni-r Sep 27, 2024
149a7ec
Remove commented code
taglioni-r Sep 27, 2024
178296c
Fix GSI names
taglioni-r Sep 27, 2024
ccc27d2
Minor improvement
taglioni-r Sep 27, 2024
fd81ebb
Fix mock
taglioni-r Sep 27, 2024
44cc824
Rename tests
taglioni-r Sep 27, 2024
df2b57b
Update aws region
taglioni-r Sep 27, 2024
6dc781a
Update descriptor audience
taglioni-r Sep 27, 2024
3015935
Merge branch 'IMN-798_catalog-platformstate-writer-v2' into IMN-797_c…
taglioni-r Sep 30, 2024
aa2cbfa
Fix
taglioni-r Sep 30, 2024
b52c801
Refactor
taglioni-r Sep 30, 2024
cc0ea48
Rename tests
taglioni-r Sep 30, 2024
f76e677
Merge branch 'IMN-797_catalog-platformstate-writer-v1' into IMN-522_c…
taglioni-r Sep 30, 2024
97fb884
Refactor
taglioni-r Sep 30, 2024
d84473f
Refactor
taglioni-r Sep 30, 2024
b7467cd
Remove types check
taglioni-r Sep 30, 2024
33b1014
Add check
taglioni-r Sep 30, 2024
ca6b288
Add test
taglioni-r Sep 30, 2024
cee7db9
Merge branch 'IMN-798_catalog-platformstate-writer-v2' into IMN-797_c…
taglioni-r Oct 1, 2024
3122d67
Merge branch 'IMN-797_catalog-platformstate-writer-v1' into IMN-522_c…
taglioni-r Oct 1, 2024
0cfd319
Fix
taglioni-r Oct 1, 2024
abf77f0
Merge branch 'IMN-797_catalog-platformstate-writer-v1' into IMN-522_c…
taglioni-r Oct 1, 2024
4e3b338
Remove env vars
taglioni-r Oct 1, 2024
865c4c8
Merge branch 'IMN-796_catalog-platform-state-writer-scaffold' into IM…
taglioni-r Oct 1, 2024
6135980
Fix
taglioni-r Oct 1, 2024
bac370e
Merge branch 'IMN-796_catalog-platform-state-writer-scaffold' into IM…
taglioni-r Oct 1, 2024
e6bbca3
Fix
taglioni-r Oct 1, 2024
6c3d128
Fix
taglioni-r Oct 1, 2024
cc1dccd
Merge branch 'IMN-796_catalog-platform-state-writer-scaffold' into IM…
taglioni-r Oct 1, 2024
f4e3ca0
Remove not needed params
taglioni-r Oct 1, 2024
6b2643e
Rename container
taglioni-r Oct 1, 2024
573ed39
Refactor
taglioni-r Oct 1, 2024
5adc54b
Merge branch 'IMN-798_catalog-platformstate-writer-v2' into IMN-797_c…
taglioni-r Oct 1, 2024
ba7233f
Fix import
taglioni-r Oct 1, 2024
0e8f1b5
Merge branch 'IMN-797_catalog-platformstate-writer-v1' into IMN-522_c…
taglioni-r Oct 1, 2024
f5376ce
Refactor
taglioni-r Oct 1, 2024
c191fd8
Merge branch 'IMN-796_catalog-platform-state-writer-scaffold' into IM…
taglioni-r Oct 1, 2024
2078571
Update error
taglioni-r Oct 1, 2024
497ce62
Improve test
taglioni-r Oct 1, 2024
b71eec3
Merge branch 'IMN-798_catalog-platformstate-writer-v2' into IMN-797_c…
taglioni-r Oct 1, 2024
6353335
Fix
taglioni-r Oct 1, 2024
c23596a
Merge branch 'IMN-797_catalog-platformstate-writer-v1' into IMN-522_c…
taglioni-r Oct 1, 2024
0d35484
Merge branch 'IMN-522_client-assertion-validation' of https://github.…
paologaleotti Oct 3, 2024
8181baf
fix: naming
paologaleotti Oct 3, 2024
182053d
Merge branch 'main' of https://github.com/pagopa/interop-be-monorepo …
paologaleotti Oct 7, 2024
5779742
Merge branch 'main' into IMN-616_tools_router
paologaleotti Oct 7, 2024
6a297be
refactor: getAllAgreements
paologaleotti Oct 7, 2024
7f1fe86
fix: error codes
paologaleotti Oct 7, 2024
4cfc41e
fix: error codes
paologaleotti Oct 7, 2024
9c0d3fb
fix: lint error
paologaleotti Oct 7, 2024
de769c1
Merge branch 'main' into IMN-616_tools_router
paologaleotti Oct 8, 2024
f74cf5f
feat: add invalid types error handling
paologaleotti Oct 8, 2024
2bc1ec7
Merge branch 'main' into IMN-616_tools_router
paologaleotti Oct 8, 2024
5c6d60c
Merge branch 'main' into IMN-616_tools_router
paologaleotti Oct 9, 2024
3d7e1de
fix: removed wrong errors
paologaleotti Oct 9, 2024
b9eaed0
fix: wrong clientId
paologaleotti Oct 9, 2024
d30f9a5
fix: clientId brand
paologaleotti Oct 9, 2024
ff3d98d
feat: add archived agreement on retrieve and priority find
paologaleotti Oct 9, 2024
52d017e
fix: add archived in retrieve purpose state
paologaleotti Oct 9, 2024
3ab816f
Merge branch 'main' into IMN-616_tools_router
paologaleotti Oct 9, 2024
d87ac39
Merge branch 'main' into IMN-616_tools_router
paologaleotti Oct 9, 2024
f98930f
Merge branch 'main' into IMN-616_tools_router
paologaleotti Oct 10, 2024
53ca5f4
refactor: add error handling in get key with client
paologaleotti Oct 10, 2024
06f73b6
refactor: naming
paologaleotti Oct 10, 2024
b7bf3e1
Merge branch 'main' of https://github.com/pagopa/interop-be-monorepo …
paologaleotti Oct 10, 2024
6efabe5
Merge branch 'main' into IMN-616_tools_router
paologaleotti Oct 10, 2024
f76a43f
fix: styling
paologaleotti Oct 10, 2024
b6b035d
Merge branch 'IMN-616_tools_router' of https://github.com/pagopa/inte…
paologaleotti Oct 10, 2024
4b002a5
Merge branch 'main' into IMN-616_tools_router
paologaleotti Oct 10, 2024
9563f2c
Merge branch 'main' into IMN-616_tools_router
paologaleotti Oct 10, 2024
05ad56e
fix: purposeId and algorithm
paologaleotti Oct 11, 2024
bed718d
refactor: eservice retrieve
paologaleotti Oct 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/backend-for-frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ COPY ./packages/commons/package.json /app/packages/commons/package.json
COPY ./packages/models/package.json /app/packages/models/package.json
COPY ./packages/api-clients/package.json /app/packages/api-clients/package.json
COPY ./packages/agreement-lifecycle/package.json /app/packages/agreement-lifecycle/package.json
COPY ./packages/client-assertion-validation/package.json /app/packages/client-assertion-validation/package.json

RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile

Expand All @@ -22,6 +23,7 @@ COPY ./packages/commons /app/packages/commons
COPY ./packages/models /app/packages/models
COPY ./packages/api-clients /app/packages/api-clients
COPY ./packages/agreement-lifecycle /app/packages/agreement-lifecycle
COPY ./packages/client-assertion-validation /app/packages/client-assertion-validation

RUN pnpm build && \
rm -rf /app/node_modules/.modules.yaml && \
Expand All @@ -34,6 +36,7 @@ RUN pnpm build && \
packages/models \
packages/api-clients \
packages/agreement-lifecycle \
packages/client-assertion-validation \
packages/backend-for-frontend/dist && \
find /out -exec touch -h --date=@0 {} \;

Expand Down
1 change: 1 addition & 0 deletions packages/backend-for-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"adm-zip": "0.5.15",
"mime": "4.0.4",
"pagopa-interop-agreement-lifecycle": "workspace:*",
"pagopa-interop-client-assertion-validation": "workspace:*",
"pagopa-interop-api-clients": "workspace:*",
"pagopa-interop-commons": "workspace:*",
"pagopa-interop-models": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/backend-for-frontend/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ app.use(
agreementRouter(zodiosCtx, clients, fileManager),
selfcareRouter(clients, zodiosCtx),
supportRouter(zodiosCtx, clients, redisRateLimiter),
toolRouter(zodiosCtx),
toolRouter(zodiosCtx, clients),
tenantRouter(zodiosCtx, clients),
clientRouter(zodiosCtx, clients),
privacyNoticeRouter(zodiosCtx),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export type AuthorizationProcessClient = {
typeof authorizationApi.createProducerKeychainApiClient
>;
user: ReturnType<typeof authorizationApi.createUserApiClient>;
token: ReturnType<typeof authorizationApi.createTokenGenerationApiClient>;
};

export type SelfcareV2Client = {
Expand Down Expand Up @@ -81,6 +82,9 @@ export function getInteropBeClients(): PagoPAInteropBeClients {
config.authorizationUrl
),
user: authorizationApi.createUserApiClient(config.authorizationUrl),
token: authorizationApi.createTokenGenerationApiClient(
config.authorizationUrl
),
},
selfcareV2Client: {
institution: selfcareV2InstitutionClientBuilder(config),
Expand Down
65 changes: 65 additions & 0 deletions packages/backend-for-frontend/src/model/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ export const errorCodes = {
privacyNoticeNotFoundInConfiguration: "0033",
privacyNoticeNotFound: "0034",
privacyNoticeVersionIsNotTheLatest: "0035",
missingActivePurposeVersion: "0036",
activeAgreementByEserviceAndConsumerNotFound: "0037",
purposeIdNotFoundInClientAssertion: "0038",
clientAssertionPublicKeyNotFound: "0049",
organizationNotAllowed: "0040",
cannotGetKeyWithClient: "0041",
};

export type ErrorCodes = keyof typeof errorCodes;
Expand Down Expand Up @@ -352,3 +358,62 @@ export function invalidZipStructure(description: string): ApiError<ErrorCodes> {
title: "Invalid zip structure",
});
}

export function missingActivePurposeVersion(
purposeId: string
): ApiError<ErrorCodes> {
return new ApiError({
detail: `There is no active version for purpose ${purposeId}`,
code: "missingActivePurposeVersion",
title: "Missing active purpose version",
});
}

export function activeAgreementByEserviceAndConsumerNotFound(
eserviceId: string,
consumerId: string
): ApiError<ErrorCodes> {
return new ApiError({
detail: `Active agreement for Eservice ${eserviceId} and consumer ${consumerId} not found`,
code: "activeAgreementByEserviceAndConsumerNotFound",
title: "Active agreement not found",
});
}

export function purposeIdNotFoundInClientAssertion(): ApiError<ErrorCodes> {
return new ApiError({
detail: `PurposeId not found in client assertion`,
ecamellini marked this conversation as resolved.
Show resolved Hide resolved
code: "purposeIdNotFoundInClientAssertion",
title: "PurposeId not found in client assertion",
});
}

export function clientAssertionPublicKeyNotFound(
kid: string,
clientId: string
): ApiError<ErrorCodes> {
return new ApiError({
detail: `Public key with kid ${kid} not found for client ${clientId}`,
code: "clientAssertionPublicKeyNotFound",
title: "Client assertion public key not found",
});
}

export function organizationNotAllowed(clientId: string): ApiError<ErrorCodes> {
return new ApiError({
detail: `Organization not allowed for client ${clientId}`,
code: "organizationNotAllowed",
title: "Organization not allowed",
});
}

export function cannotGetKeyWithClient(
clientId: string,
keyId: string
): ApiError<ErrorCodes> {
return new ApiError({
detail: `Cannot get key with client ${clientId} and key ${keyId}`,
code: "cannotGetKeyWithClient",
title: "Cannot get key with client",
});
}
39 changes: 34 additions & 5 deletions packages/backend-for-frontend/src/routers/toolRouter.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,51 @@
import { ZodiosEndpointDefinitions } from "@zodios/core";
import { ZodiosRouter } from "@zodios/express";
import { bffApi } from "pagopa-interop-api-clients";
import {
ExpressContext,
ZodiosContext,
zodiosValidationErrorToApiProblem,
} from "pagopa-interop-commons";
import { bffApi } from "pagopa-interop-api-clients";
import { toolsServiceBuilder } from "../services/toolService.js";
import { fromBffAppContext } from "../utilities/context.js";
import { toolsErrorMapper } from "../utilities/errorMappers.js";
import { PagoPAInteropBeClients } from "../clients/clientsProvider.js";
import { makeApiProblem } from "../model/errors.js";

const toolRouter = (
ctx: ZodiosContext
ctx: ZodiosContext,
clients: PagoPAInteropBeClients
): ZodiosRouter<ZodiosEndpointDefinitions, ExpressContext> => {
const toolRouter = ctx.router(bffApi.toolsApi.api, {
validationErrorHandler: zodiosValidationErrorToApiProblem,
});

toolRouter.post("/tools/validateTokenGeneration", async (_req, res) =>
res.status(501).send()
);
const toolsService = toolsServiceBuilder(clients);

toolRouter.post("/tools/validateTokenGeneration", async (req, res) => {
const ctx = fromBffAppContext(req.ctx, req.headers);

try {
const result = await toolsService.validateTokenGeneration(
req.body.client_id,
req.body.client_assertion,
req.body.client_assertion_type,
req.body.grant_type,
ctx
);
return res
.status(200)
.send(bffApi.TokenGenerationValidationResult.parse(result));
} catch (error) {
const errorRes = makeApiProblem(
error,
toolsErrorMapper,
ctx.logger,
"Error validating token generation request"
);
return res.status(errorRes.status).send(errorRes);
}
});

return toolRouter;
};
Expand Down
Loading