Servicestack authentication process on each request

时光怂恿深爱的人放手 提交于 2019-12-24 01:44:45

问题


I have been through much of the documentation and examples provided, but Im looking for some inputs for my setup from other users.

I have a some clients (website, iOs/Android apps). These only serves as a shelves and its content will be requested through servicestack, which makes servicestack a central point of my setup. The client will login through servicestack and get a sessionid.

My question here is, how should i setup servicestack to make sure that the user is validated on each request?

I was thinking after login, i save the user in the cache and make sure this expires after some time (unless persisted). Then on each request based on the session id, i check the cache to see if the user exists. If the user exists, the request i authenticated, and if not the user have to login again.

Am i on the right track here, or is there an easier way in servicestack, to support this?


回答1:


I was thinking after login, i save the user in the cache and make sure this expires after some time (unless persisted).

It sounds like you can just use the Authentication/Authorization plugin. Once a user is authenticated (using any of the 'Providers') the user's session is stored in the cache using the key 'urn:iauthsession:[sessionId]' and contains a bool property isAuthenticated. For any Service the requires Authentication you can use the Authenticate attribute.



来源:https://stackoverflow.com/questions/15804582/servicestack-authentication-process-on-each-request

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!