-
Notifications
You must be signed in to change notification settings - Fork 24
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
Sim swap subscriptions alignement with commonalities 0.5 #179
Conversation
Align sim-swap-subscriptions.yaml with comm 0.5
Align sim-swap-subscriptions.feature with comm 0.5
🦙 MegaLinter status: ✅ SUCCESS
See detailed report in MegaLinter reports |
Mega-Linter - remove trailing spaces
Try to fix examples for subscriptionDetail
Hello @rartych Megalinter is unhappy because in the 3LEGS examples the I tried but neither work. Any idea? Thanks for you help. |
Co-authored-by: Rafal Artych <[email protected]>
Co-authored-by: Rafal Artych <[email protected]>
Co-authored-by: Rafal Artych <[email protected]>
@@ -1194,3 +1351,17 @@ components: | |||
startsAt: '2024-06-07T16:10:15.302Z' | |||
expiresAt: '2024-06-07T16:10:15.302Z' | |||
status: ACTIVATION_REQUESTED | |||
SUBSCRIPTIONS_3LEGS: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How one is expected to use a 3-legged token to read all subscriptions? A 3-legged token is valid for a single phon number only.
Therefore,
- either the response must include only subscription for this exactly phone number, what creates an implicit filtering functionality AND reading subscription without specifying an ID must also support 2-legged token to really read all subscriptions
- or reading subscription without specifying an ID must support 2-legged auth only .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good comment. I propose to update the documentation part:
These rules apply for subscription:
If 3-legged access token is used:
- For POST and GET{id} request & responses must not provide any device identifier
phoneNumber
. - For GET (list) only subscription for this exactly phone number is retrieved (implicit filtering)
If 2-legged access token is used:
- For POST and GET{id} the presence of a device identifier
phoneNumber
in the request t& response is mandatory. - For GET (list) the
phoneNumber
could be used as filtering criteria.
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense for me.
But
- for usual operation it is up to the MNO to decide if it wants/can support 3-legged or 2-legged option.
- meanwhile for GET (list) MNO must always support client credentials (with or without 3-legged option in addition), because otherwise this API is hardly usable - one cannot get a complete list of subscription it has created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got your point for the GET (list) but I'm wondering if we have to strictly enforce that MNO must support client credential. I will prefer to keep it as a recommandation and probably waiting for live implementation to get feedbacks. If we enforce it now it will be tough from a certification perspective.
@@ -63,7 +63,7 @@ Feature: CAMARA sim swap subscriptions API, v0.1.1 | |||
Scenario: Check existing subscription is retreived in list | |||
Given valid subscriptions are existing | |||
And use BaseURL | |||
When get sim swap subscription | |||
When the HTTP "GET" request is sent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PQ makes response depending on the token type. As a result statement "And the response body complies with an array of OAS schema defined at "#/components/schemas/Subscription"" does not describe the expected result clearly enough anymore. Separate test cases are needed for 2 and 3 legged requests.
And for 3-legged case one need to specify which exactly subscriptions must be returned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes make sense
I've reworked the proposal with @sim_swap_subscription_retrieve_04_retrieve_list_2legs, @sim_swap_subscription_retrieve_07_retrieve_list_3legs and @sim_swap_subscription_retrieve_08_retrieve_empty_list_3legs
Specify distinct TC for GET (list) in 2 or 3 legs
Clarify in API presence of phoneNumber in 2 or 3 legs
@fernandopradocabrillo @gregory1g @rartych Following camaraproject/Commonalities#369 discussion I think it's fair to remove 403 INVALID_TOKEN_CONTEXT example in the yaml. May I ask you to review this new proposal soon as we have to prepare the RC candidate before Jan17th. We can still modify after but we have to achieve the milestone. |
#### phoneNumber presence: | ||
These rules apply for subscription: | ||
|
||
- If 3-legged access token is used, the POST and GET{id} requests & responses must not provide any device identifier (``phoneNumber``). For GET (list) only subscription(s) for this exactly phone number is/are retrieved (implicit filtering). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"any device identifier": what other device identifiers are supported and again an API targets subscription (MISDN), not a device. Even if the API would accept device ID in input, it will have to find target MSISDN using provided Device ID first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. I will fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
These rules apply for subscription: | ||
|
||
- If 3-legged access token is used, the POST and GET{id} requests & responses must not provide any device identifier (``phoneNumber``). For GET (list) only subscription(s) for this exactly phone number is/are retrieved (implicit filtering). | ||
- If 2-legged access token is used, for POST and GET{id}, the presence of a device identifier (``phoneNumber``) in the request & response is mandatory. For GET (list) the device identifier (``phoneNumber``) could be used as filtering criteria. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very short description and it keeps some questions opened.
for example:
- it says that one can use phoneNumber filtering criteria. But the GET "/subscriptions" specification does not support filtering.
- what GET subscription returns if one does not use filtering criteria in 2-legged token case?
- what happens if one uses 3-legged token for "GET /subscriptions/{subscriptionId}", where the target subscription which is not associated with a phoneNumber from the token?
- what happens if one tries to use 2-legged token towards a subscription created by another API invoker?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gregory1g Fair questions. We have added a piece in commonalities here to target your questions 2. 3. & 4.
For question 1. this should be here.
As these questions are not specific to this API I suggest to park them to block the merging.
Then the response property "$.status" is 200 | ||
And the response header "Content-Type" is "application/json" | ||
And the response header "x-correlator" has same value as the request header "x-correlator" | ||
And the response body complies with an array of OAS schema defined at "#/components/schemas/Subscription" | ||
And all valid subscriptions are listed | ||
|
||
@sim_swap_subscription_retrieve_07_retrieve_list_3legs | ||
Scenario: Check existing subscriptions are retrieved in list | ||
Given valid subscription is existing for a phoneNumber |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How "valid subscription" is defined and how one can list "not valid" subscription to, for example, delete them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this 'valid' wording is not defined and could be confusing as we are not supposed to store/manage not valid subscription. I removed this unnecessary valid wording & make some ajustements in the wording.
@@ -306,39 +331,24 @@ Feature: CAMARA sim swap subscriptions API, v0.1.1 | |||
# Error Code 403 | |||
################## | |||
|
|||
@sim_swap_subscription_creation_60_phone_number_token_mismatch | |||
@sim_swap_subscription_retrieval_61_phone_number_token_mismatch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bigludo7 I checked with Pedro regarding the SUBSCRIPTION_MISMATCH error because I wasn't fully sure if were right about the meaning. And spoiler: we weren't.
So this error is designed to cover the scenario where an API Client requests the creation of an event subscription for an event type for which it does not have permission. The token is valid and the client can consume the endpoint, but only for the events that were requested in the authentication.
Maybe with an example for device status this is clearer. There we have a scope for roaming on and another one for roaming off. If the token was generated for roaming on and the client requests the creation of a subscription for roaming off, there we should return the SUBSCRIPTION_MISMATCH error.
And this is why it is only present in the POST for creation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fernandopradocabrillo Whaou got it ! now I remind ! - Kudos to Pedro
So I remove the tests for GET & DELETE
I'm not sure we need a Test for POST as we have only one event type.
What type of PR is this?
Add one of the following kinds:
What this PR does / why we need it:
Alignement of sim_swap-subscriptions.yaml & sim_swap-subscriptions.feature with commonalities 0.5 rules.
See detail in release note.
Which issue(s) this PR fixes:
Fixes #161
Special notes for reviewers:
This is breaking change.
Changelog input
Additional documentation
This section can be blank.