Bug 1508403 - VM Portal logs out due to missing session refresh
Summary: VM Portal logs out due to missing session refresh
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: AAA
Version: 4.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ovirt-4.2.0
: ---
Assignee: Ravi Nori
QA Contact: Lucie Leistnerova
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-11-01 11:58 UTC by Michal Skrivanek
Modified: 2017-12-20 11:01 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2017-12-20 11:01:20 UTC
oVirt Team: Infra
Embargoed:
rule-engine: ovirt-4.2+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 83549 0 master MERGED aaa: VM Portal logs out due to missing session refresh 2017-11-07 14:38:18 UTC

Description Michal Skrivanek 2017-11-01 11:58:26 UTC
VM Portal requires to refresh the API session when there is some activity in the UI. The current state is still not sufficient as there is no way for ovirt-web-ui to trigger the refresh on user actions.

See more details in: 
https://gerrit.ovirt.org/#/c/74848/
https://gerrit.ovirt.org/#/c/74470/
https://github.com/oVirt/ovirt-web-ui/issues/308

Comment 1 Martin Perina 2017-11-01 12:26:10 UTC
Ravi could you please describe how ovirt-web-ui could specify which RESTAPI queries should refresh session and which not?

Comment 2 Ravi Nori 2017-11-01 14:49:37 UTC
VM portal should acquire the token with ovirt-app-api scope. This refreshes the session on VM portal usage. 

The session can also be refreshed by passing QueryParametersBase.refresh as true.

Comment 3 Martin Perina 2017-11-01 19:04:22 UTC
(In reply to Ravi Nori from comment #2)
> VM portal should acquire the token with ovirt-app-api scope. This refreshes
> the session on VM portal usage. 
> 
> The session can also be refreshed by passing QueryParametersBase.refresh as
> true.

Is this enough for ovirt-web-ui usage or something is still missing ?

Comment 4 Michal Skrivanek 2017-11-01 19:34:35 UTC
the ovirt-app-api scope refreshes session on each call? That's not really desired as for inactive users the background data refreshes shouldn't refresh session.
That QueryParametersBase.refresh is a header in API?

Comment 5 Ravi Nori 2017-11-02 02:45:55 UTC
Yes ovirt-app-api scope refreshes session on each call. Currently I don't think restapi sets/exposes the QueryParametersBase.refresh parameter. 

Calls from webadmin set the value to false for background data refreshes. 

Adding need info on Juan

Comment 6 Juan Hernández 2017-11-02 09:11:05 UTC
The API doesn't currently allow the user to control the refresh parameter. And I think it shouldn't. Instead of having the API controlling the duration of the session of the UI it should be the other way around: the UI controlling the duration of the session of the API. The UI can keep track of when it sent the last request that was not interactive. It can then close the API session and log-out the user when it considers it convenient. Can we do that?

Anyhow, if I understand correctly the description of the bug, the issue is that the API session is expiring when there is still activity in the client side. Is that reproducible?

Comment 7 Michal Skrivanek 2017-11-02 09:15:44 UTC
It is fine if UI controls the duration. The UI logic can indeed track when to refresh, but there needs to be a way how to do that.

> Anyhow, if I understand correctly the description of the bug, the issue is that the API session is expiring when there is still activity in the client side. Is that reproducible?

Yes, that's correct. See bug description for links.

Comment 8 Martin Perina 2017-11-02 09:47:45 UTC
Ravi, can UI sent a request with token and specify different scope to control if session should be refreshed or not? If not, any suggestion to enable client to control session refresh?

Comment 9 Juan Hernández 2017-11-02 10:08:43 UTC
Can the web-ui use the ovirt-app-api scope, like other API clients do? How? That would make sure that the session is refreshed with every request.

Comment 10 Ravi Nori 2017-11-02 13:52:32 UTC
(In reply to Martin Perina from comment #8)
> Ravi, can UI sent a request with token and specify different scope to
> control if session should be refreshed or not? If not, any suggestion to
> enable client to control session refresh?

Scope is obtained when the token is obtained and stays the same for the session. So we cannot use scope to control if a session needs to refreshed.

Comment 11 Ravi Nori 2017-11-02 15:05:21 UTC
(In reply to Juan Hernández from comment #9)
> Can the web-ui use the ovirt-app-api scope, like other API clients do? How?
> That would make sure that the session is refreshed with every request.

On current master it is not possible to specify a separate scope for web-ui since we are using unified login and both webadmin and web-ui will inherit the same scope. 

I can submit a patch to use app-scope. The app-scope can be "ovirt-app-api" for web-ui and "ovirt-app-admin" for web-admin. The app-scope can used to determine if the session is refreshed. Nothing should change as far as restapi is concerned.

Comment 12 Ravi Nori 2017-11-07 15:07:14 UTC
The patch adds a new context init parameter "app-scope" which can be configured in web.xml of vm portal. This scope is different from the SSO scope used to obtain the token. The new scope is used internally to determine the scope of the app. 

The app-scope of "ovirt-app-api" would refresh the session on each query. UI can perform queries using restapi as usual nothing changes there. The UI can keep track of when it sent the last request that was not interactive. It can then close the API session and log-out when session times out. 


So all that needs to be done is.

1. Add new context init parameter in web.xml
2. Keep track of requests
3. invoke logout on timeout

Comment 13 Lucie Leistnerova 2017-11-22 12:18:28 UTC
VM portal does not log out while working with it. So this issue is fixed, but side effect is now, that it doesn't log out at all.

See https://github.com/oVirt/ovirt-web-ui/issues/436

verified in ovirt-engine-4.2.0-0.5.master.el7.noarch,
ovirt-engine-extension-aaa-jdbc-1.1.6-1.el7ev.noarch,
ovirt-web-ui-1.3.2-1.el7ev.noarch

Comment 14 Sandro Bonazzola 2017-12-20 11:01:20 UTC
This bugzilla is included in oVirt 4.2.0 release, published on Dec 20th 2017.

Since the problem described in this bug report should be
resolved in oVirt 4.2.0 release, published on Dec 20th 2017, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.