Authentication in Play! and RestEasy

[亡魂溺海] 提交于 2019-12-11 00:45:58

问题


I have a small application written in Play! which allows user registration and adding some content for registered users which other registered users can view. I'd like to add some REST API to my application with [resteasy] module, and my question is: are there any best practices or known solutions for performing authentication with rest to allow users managing their own content using resteasy in Play! ?

What I'm thinking about now, are two solutions:

  1. Client sends data and also sends his password and user name in some hashed or encoded form and this data is checked with credentials in database. If there is a match, request action occurs.
  2. Client authenticates in the first place and is returned sessionId or something which he has to add to all requests (cookie?).

Any help is appreciated.


回答1:


You have some related answers on how to approach security here and here.

Personally I would try to create some OAuth 2 authentication if the API is to be used by 3rd parties. If it is private usage (only your apps will call it) other methods plus SSL should suffice.



来源:https://stackoverflow.com/questions/6296740/authentication-in-play-and-resteasy

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