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

Pin 5687: Verify tenant certified attributes for agreement creation #1224

Open
wants to merge 12 commits into
base: feature/incaricato
Choose a base branch
from

Conversation

AsterITA
Copy link
Contributor

@AsterITA AsterITA commented Nov 22, 2024

Closes PIN-5607

This route will check the tenant attributes against the selected descriptor when creating an agreement for itself or for a delegator

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this router the endpoints were declared always as agreementRouter.post instead of doing only .post like we do in other routers; so I refactored it in order to align it to the others

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would avoid this refactor in this PR because it will conflict with every other change to this agreement router. Git sees the entire file as changed, so it will be hard to solve conflicts, and we have many parallel activities involving the agreement (capofila, the new agreement contracts, further changes in this feature, etc.).

Maybe we can track this as a small activity, to be done on develop after merging these two big features...

Copy link
Collaborator

@ecamellini ecamellini left a comment

Choose a reason for hiding this comment

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

Do we need to implement this logic in the agreement process?
I think we have everything we need already in the BFF, the call is named /agreements/verify but it doesn't seem to be related to agreements since an agreement does not yet exist (unless I am missing something).

I think we can do everything in the BFF, doing something similar to what @MalpenZibo did in #1218, but simpler:

  1. We GET the delegation
  2. We GET the delegator from the delegation
  3. We use the hasCertifiedAttributes utility (already implemented in BFF) and return true if it's true for at least one of these tenants

Let me know what you think. I would also consider renaming the call since it is not related to agreements but just to the verification of attributes given a descriptor and a delegation

@@ -13079,7 +13256,6 @@ components:
- dailyCallsPerConsumer
- dailyCallsTotal
- agreementApprovalPolicy
- hasCertifiedAttributes
Copy link
Collaborator

Choose a reason for hiding this comment

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

Was this unused?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was this unused?

Yes, in fact it was only present in the required but not in the actual properties

packages/api-clients/open-api/bffApi.yml Outdated Show resolved Hide resolved
packages/api-clients/open-api/bffApi.yml Show resolved Hide resolved
packages/api-clients/open-api/bffApi.yml Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would avoid this refactor in this PR because it will conflict with every other change to this agreement router. Git sees the entire file as changed, so it will be hard to solve conflicts, and we have many parallel activities involving the agreement (capofila, the new agreement contracts, further changes in this feature, etc.).

Maybe we can track this as a small activity, to be done on develop after merging these two big features...

emptyErrorMapper,
ctx.logger,
ctx.correlationId,
`Error verifying agreement`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
`Error verifying agreement`
`Error verifying certified attributes for agreement`

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I opted for Error verifying certified attributes since there isn't an agreement yet

@AsterITA
Copy link
Contributor Author

Do we need to implement this logic in the agreement process? I think we have everything we need already in the BFF, the call is named /agreements/verify but it doesn't seem to be related to agreements since an agreement does not yet exist (unless I am missing something).

I think we can do everything in the BFF, doing something similar to what @MalpenZibo did in #1218, but simpler:

1. We GET the delegation

2. We GET the delegator from the delegation

3. We use the hasCertifiedAttributes utility (already implemented in BFF) and return true if  it's true for at least one of these tenants

Let me know what you think. I would also consider renaming the call since it is not related to agreements but just to the verification of attributes given a descriptor and a delegation

As discussed in sync, it's better to keep the route implemented in the process rather than the BFF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants