简体   繁体   English

Fiori 中的会话超时:SAP UI5 或网关层是否提供在用户会话超时时调用的事件

[英]Session Timeout in Fiori: Does SAP UI5 or the Gateway layer provide an event which gets called when the user's session times out

I'm working on resource locking in SAP Fiori.我正在研究 SAP Fiori 中的资源锁定 To be more elaborate I am trying to lock a resource once a user logs in and opens my application and unlock the resource once he logs out or gets logged out.更详细地说,我试图在用户登录并打开我的应用程序后锁定资源,并在他注销或注销后解锁资源。

I am aware of the onExit() event handler which is located in the main.controller.js and is called if the user performs an action which logs him out.我知道onExit()事件处理程序位于 main.controller.js 中,如果用户执行将他注销的操作,则会调用它。 This handles all scenarios except one: when the user's session is timed out.这可以处理所有情况,除了一种情况:当用户的会话超时时。

Is anyone aware of a method(UI5 / Gateway layer) that is called once the session time's out ?有没有人知道会话超时后调用的方法(UI5/网关层)

As far as I think how this is handled is if a user's session is timed out then nothing happens until the user refreshes the screen.我认为这是如何处理的,如果用户的会话超时,那么在用户刷新屏幕之前什么都不会发生。 At this point an Odata call is made to fetch data.此时会调用 Odata 来获取数据。 Once this hits the Gateway it checks and finds out that the session has timed out and triggers a relogin action.一旦它到达网关,它就会检查并发现会话已超时并触发重新登录操作。

Correct me if I'm wrong.如果我错了纠正我。 If right does anyone know what is the event handler which does that?如果正确,有人知道执行此操作的事件处理程序是什么吗?

Also I have read up quite a bit about this.我也已经阅读了很多关于这个的内容。 This falls under optimistic and pessimistic concurrency .这属于乐观和悲观并发 I would like to try a pessimistic apprach and not a optimistic我想尝试一个悲观的方法而不是一个乐观的方法

approach using etags.使用 etag 的方法。

Thanks in advance for your time .提前感谢您的时间

Also I cant officially post any code as it would be against policy, but if you have any queries please feel free to ask and I will do my best :).此外,我不能正式发布任何代码,因为这会违反政策,但如果您有任何疑问,请随时提出,我会尽我所能:)。 Plus this is more a fact finding mission.此外,这更像是一个事实调查任务。

There is no way you can trust a request to be executed from a browser to signal time out.您无法信任从浏览器执行的请求以发出超时信号。 You will end up with locked resources that shouldn't be locked due to lost connectivity, app crashing, battery drain to name a few.您最终将获得锁定资源,这些资源不应因连接丢失、应用程序崩溃、电池耗尽等原因而被锁定。 A classic problem for web applications! Web 应用程序的经典问题!

Instead, you can construct a lock refresh mechanism.相反,您可以构建一个锁刷新机制。 Refresh the lock every 30 seconds or so in the background.在后台每 30 秒左右刷新一次锁。 Just make sure to fetch the latest version of the resource if the lock was ever released!如果锁定被释放,请确保获取最新版本的资源!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM