-
Notifications
You must be signed in to change notification settings - Fork 60
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
List endpoint for active sessions of authenticated user #101
Comments
It is true that without the session id it is not possible to get info about or delete a session, and there is no way currently to discover it, so an GET /sessions endpoint would make sense. With client_credentials, a client may have many sessions and in that case pagination would make sense, or alternative some support for filtering (for example based on ueId), or both. There are some guidelines proposed, but they may require some refinement as I think no CAMARA API has added these type of parameters yet. If the main driver is to delete sessions without knowing the session id, another possibility is to allow a DELETE /sessions with filtering support to delete only a subset of sessions for that client, for example by ueId. |
Thank you for the feedback. I think it is a great idea to refine the suggestion to use the pagination parameters as specified by the guidelines, but I am not sure if those guidelines are finalized and ready to go, or if they are still in development. For me the main driver would be to be able to determine which sessions are currently running, with the side effect of being able to delete them. This means that a |
A GET /sessions endpoint makes all sense to me. We can elaborate on the paging and/or filtering parameters. Guidelines are a start point but probably the first API needing them will lead the way. This new endpoint add new requirements on implementations as sessions have to be associated to an owner in order to only provide "their" sessions, that is the 2-legged client_id or 3-legged user_id. So far the concept of ownership is not mentioned explicitly, and relying on the knowledge of a non guessable session_id could have served for short term. But for this new endpoint I think we should address it. |
Due to the requirements this new endpoint would imply for implementations we propose to move the proposal into the backlog. Also as this endpoint would be only relevant in dev/lab/test ... the main issue can be circumvented with setting a (short) duration for the QoS session. |
Thanks for the update. Would implementing the |
My view: Setting the default value for duration to a low value can e.g. be done locally in lab/test environments. And developers can always set it in their session create calls if they like. If we set it in general to a low value we are essentially make the parameter mandatory, at least before we have a /put or /patch method (#47). Therefore I'm not in favor of a short default duration to circumvent these issue in dev/test/lab. But open for other thoughts on it. |
Hi, I have received recently some internal feedback to work on this functionality, to allow customers to "look for" active sessions in scenarios where sessionId is not known. I think that this functionality makes all sense in a CRUD model, but as mention before we must elaborate well the requirements around which sessions are allowed to be discovered by certain client, which filters may apply to that query, e.g. searching for sessions for certain MSISDN, etc. TEF can work on a more detailed proposal for this |
Could we add parameters to filter this to include different session status? Do we have a list of session statuses? Active, completed, failed? |
I don't think a We already have a I thought that was the RESTful way to do it anyway. |
What @eric-murray mentions is something we have to define properly. In any case, the requester must have access rights to the requested information. That means that the access token must be checked in order to identify which specific sessions are associated to it. Even if we only returned sessionIds, we cannot return those corresponding to sessions not created by the requester. In case of three-legged authentication the check must include also that sessions belong to the user identified by the token. So functionality must always be: "Get me the sessions I'm allowed to discover with this access token". |
I'm concerned that you are saying all that matters for this use case is which API consumer (identified by Whatever logic is used to implement the If that is the case, a 2-legged token is then fine for session retrieval and the Identity & Consent technical ruleset is wrong. But if 3-legged authorisation is required, what does the API consumer ( |
I'm not meaning at all that client_id is the only part of the access token to be checked. For sure, consent has to be checked for 3-legged scenarios which require it. The consent would be check before an access token with scope My point was that returning only sessionId, if we have an endpoint to get the additional details from that sessionId, does not change the situation regarding privacy. |
@jlurien How do you handle a situation where a client have created 100s or more sessions? Would you list them all in one GET /sessions? This could make an endpoint susceptible to heavy read request, or possible denial of service attack if not implemented correctly. |
This is related to which type of token we use. I agree that with 2-legged tokens, a client_id may own hundreds of sessions. An alternative to paging would be to add filters by device, but I'm not against considering paging for these scenarios. For 3-legged tokens. it may not be that necessary as an individual user will likely not have hundreds of sessions. The ultimate question is which kind of tokens are we going to use here. This is connected to the ongoing discussions in Identity and Consent Management WG. The general guideline is that "Every time personal user data is processed by an API and the user can exercise their rights either via opt-in and/or opt-out, 3-legged access tokens must be used.". For the API definition, we could consider paging in any case, as it is optional, but it is more important to define the rules about which sessions are to be returned. |
From the discussions on the QoD Call on Friday: The PR is stil (optional) considered for v0.10.0. Potentially the discussions can be not be closed for v0.10.0, in this case the feature will be postponed to the next release. Discussions which are open:
@RandyLevensalor @jlurien @eric-murray ... please add your thoughts on the points. |
|
Thanks @patrice-conil for your comments on the four points ... I agree with all of them. @RandyLevensalor @jlurien @eric-murray I would like to get your opinion if we can go today with the PR #228 as is, which means:
Let me know if If there are no approvals for the PR until end of day, I'm going for b) to get the rc v0.10.0 done. |
I'm not a fan to only support mobile networks. Especially when we have discussed wireline networks supporting more concurrent sessions. Why can't we we search on for a match on the device schema that's used to create the session and further refine it in a larger pr, if needed? |
We couldn't simply filter by whole device object - it would require changing the method from GET to POST and delivering the request body as a device object parameters to filter. Instead I'm here with @jlurien:
And that can be done step by step in later releases, in line with any redefinition of |
This is something that we should clarify at WG level, The scope of the subproject as stated in the README says:
There is also another subproject dedicated to Home Devices QoD, which target home networks. |
From the API Design Guidelines:
So MSISDN should not be passed as a query parameter, and certainly that is not allowed by Vodafone's own API security rules. Filtering by MSISDN (or, indeed, any device identifier) needs to be achieved using a 3-legged access token. Indeed, the CAMARA APIs Access and User Consent Management Guidelines say that a 3-legged access token should ALWAYS be used for such endpoints, though I agree this is unworkable when the API is processing personal data for multiple end users. So the On the other points:
|
I agree with your points. However, for GET /sessions I still think that returning the list of sessions with all data is more useful than returning just the list of Ids. Probably, in a 3-legged scenario it will be typical to have just one session. In summary, if we go for complex filters, I would suggest a POST operation to list or search for sessions, returning a list of matched sessions info. |
@jlurien We should fix this. This is the first time that I've seen any pushback in any working group to supping wireline networks. This was added to commonalities to avoid being telco specific.
But this can be a home network behind a FWA network and I think that is where most of the use cases are coming from, not home devices connected to wireline network. |
If you have to call |
@patrice-conil
So 3-legged token it is. |
Hi @eric-murray, |
Yes, I agree, but the session information still contains personal data (IP address or phone number), and returning those details is "processing". So the token still needs to be associated with all the end users for which the API consumer has active sessions. That may just be one, or it may be many, or it may be very very many. Thing is, when the session is created, the API consumer will have a 3-legged token valid for the resulting But if they need a 3-legged token valid for multiple end users, well, they need to request that specifically. Ignoring the complexity of getting a valid token for now, if the list is long, then it will need to be paginated. So that will increase complexity whereas the So my feeling is that, if one single list of session details is required, then we should mandate filtering by end user identifier. That way, we get a shorter list, and can use a "normal" 3-legged token for that end user, which the API consumer will already have. This could still be But my preference remains that |
These personal data are already known to the client_id who provided them when creating the session... so no problem for me.
It's not my idea ... they will use the same token for create and list operations.
Totally agree with you.
|
OK, I can live with that. A
Both could be used. 2-legged token for |
This is long thread but summarizing the open points, I think we should decide on: FilteringTaking into account that we should avoid disclosing sensible data in paths and query parameters, I think we should choose a POST method for this operation, so it would be We have to device if device is always required, or some minProperties are required, or even if an empty body would be allowed indicating no filters. security & securitySchemes for the operationDesigning the operation as a POST simplifies a lot this point, as this new operation would be conceptually similar to the operation for session creation regarding security. Same considerations should apply to both. A client allowed to create a session for certain device should be allowed as well to retrieve the session info for that device. In 3-legged tokens are required for that, same token would be required to get the session data. In case that we allow a retrieveSession operation without filters, we should rely only on the access token content to decide which sessions are authorized by the access token. In case of 3-legged tokens, this implies looking into the response bodyHere I would return an array of SessionInfo, again similar to the createSession operation but allowing several items to be returned, as a device may have several sessions. I think paging will not be necessary for 3-legged scenarios. Draft proposalSo in summary, I would propose an operation that could be drafted as:
|
I don't think a POST is necessary in this case because:
Regarding identifying the device from the OAuth token:
Filtering by parameters other than As the list must be filtered by end user (i.e. |
To me the decision for GET vs POST is the result of deciding on the filters to apply for the method. I agree with you that without |
@eric-murray @jlurien The agreed text within CAMARA-API-access-and-user-consent.md which we will have to include also in our API specification (after it is released):
That does not exclude that the QoD API can be used with Client Credentials. Even if most local legislations would require 3-legged for all purposes, there would be still deployment scenarios where the QoD API will be used with Client Credentials (e.g. in lab deployments or private networks). Therefore we can't get completely rid of the device parameter but should keep it at least optional. But as @jlurien rightly recognized, that is going beyond this issue. |
With @hdamker remarks, I tend to think that probably the most safe approach is to consider Apart from the hypothetical 2-legged possibility in some environment or geography, there is also a possible 3-legged scenario where a token is granted for a user (sub) which may have several lines, for example using user/pass credentials, and in that case it may be necessary to indicate which of the user devices is requested. |
@jlurien @hdamker I'm not convinced that multi-user tokens are feasible - it already takes too long to generate and process a token for one end user. But that is indeed not a topic for this issue. |
To propose a PR we should have some prior consensus on how to model the endpoint. The options I see: a) GET /sessions -> No explicit input parameters. All input has to be taken from the access token b) POST /sessions/retrieve { device required } -> Similar behaviour of current createSessions c) POST /sessions/retrieve { device optional } -> If device is included, similar behaviour of current createSessions. If device is not included, all input has to be taken from the access token. The implications can be extended to the current endpoints. There are some questions that are not yet resolved:
|
To proceed with this functionality, which is in the backlog for v0.11, I propose to align the new endpoint as much as possible to the current consensus in v0.10. That would imply modelling the endpoint as option B above (POST /sessions/retrieve { device required } ). In parallel, there is an ongoing discussion in camaraproject/Commonalities#171 to consider the input device as optional, and rely on the access token when is possible (which would be the option C above). If there is a final decision in Commonalities to make device optional, then we would have to align both the current createSession and the new retrieveSessions. If this is OK, I can model a PR with the proposal. |
My concern is that I don't see anything that would limit the three-legged token to just on device, but a set of devices. While I can see expanding this to retrieve all sessions associated within the scope of the token, I think that we'll still need to support the device id. Added this comment to the commonalities issue as well. camaraproject/Commonalities#171 (comment) For the device ID, what about embedding the json from the #/components/schemas/Device schema in the requestbody. Then if we need to update the Device schema to comply with commonalities, we'll only have to do it in the QoD schema. |
The debate is in Commonalities, but there are many cases where a 3-legged token will identify a single device, such as in a network-based auth flow launched from the device. In any case, this will not be a universal case and device has to be supported anyway, optional or required. The proposal is exactly that, to reuse the same device schema in the request body, modeling an operation POST /sessions/retrieve { device } |
In the PR #299 there is a proposal for an equivalent operation: retrieveProvisions, which could be adapted to the quality-on-demand API |
Should / could we add a limitation to this endpoint the the 3-legged token would be limited to a single device? I could see an enterprise customer having a single token to manage QoD on all of their devices. Otherwise enterprise users would have to manage separate token for each device under the same account. If we go with the limitation in the API or add error handling for multiple devices, then the three legged solution would work. |
I understand your question is in the context of making device optional, right? Depending on the authentication scenario it may be possible that an access token grants management of several devices. e.g. using user/password credentials for a user with several devices. In those cases, an operation like "retrieveSessions" may return all sessions associated to any of the devices associated to the token. We could add a limitation to the operation deciding that only one device is allowed as input, but it's debatible if we should do that. So the 3-legged solution would work for the retrieveSessions operation, which is able to return an array of SessionInfo, as long as at least one device can be determined from the access token. It wouldn't work for a a createSession operation that is only able to create a session for a single device, if none or more than one devices are associated to the access token. In the PR for QoD provision API I opted to make device required, as in quality-on-demand APIS, to skip by now the decision about the device being optional. |
As agreed on last meeting, I will propose a PR with the operation modeled with POST. I have not make device optional in the request body yet, as I think it is better to align this new endpoint with all others in the same way (wording, etc), once we create a PR for issue #313. fyi @hdamker |
Summary
Create a
/get
endpoint offering a paginated response of all sessions that the currently authenticated user created and are still active.Context
While testing the APIs it might happen that the
session id
from a successful create request will get lost. In that case, there is no way to retrieve the created sessions: The/get
endpoint only returns sessions whose ids are known, but not all active ones for the authenticated user.Proposal
Add a variant of the
/get
endpoint that takes optionally page information to return all sessions for the authenticated user. We optionally need pagination information, since more sessions might be available then we can return (think response size limits etc). Therefore this endpoint must be paginated.The default values for the paginated parameters current page would be set to 0 and the size of a page to 100. So on average no page information is needed, but for heavy users, it is available.
The sorting of the response could be by it's
startedAt
field: sessions created early should appear before later sessions.cURL example
This is an example of the proposed endpoint:
A call like
would return
Alternatives
A) One of the main reason for this proposal is the inability to find created sessions. This mostly stems from testing and due to user error the session id cannot be retrieved from the initial create request. In order to not block the ue and only create the needed amount of sessions, the default of the
duration
parameter could be set to a very low value: a 10 seconds duration would be deleting the session after 10 seconds, without the need to delete a session without the session id.B) A second alternative could be to add a delete all endpoint: With this endpoint, we would not give out the session information, but could guarantee in an error case, there is the ability to delete existing sessions.
Initial Specification Proposal
Under #100 you can find an initial draft of a proposal on how the specification would need to change. (closed now, till a decisions on this issue is found)
The text was updated successfully, but these errors were encountered: