14

How do I write the method for user authentication in REST web service? I am beginner with web services.

Olli
  • 1,231
  • 15
  • 31
sudo
  • 1,525
  • 7
  • 34
  • 59
  • 2
    There are different ways to authenticate user in REST web services. You have to give more information to get any meaningful answers. – Olli Apr 03 '11 at 07:45
  • possible duplicate of [how do i authenticate for user in REST web service in web application?](http://stackoverflow.com/questions/5529221/how-do-i-authenticate-for-user-in-rest-web-service-in-web-application) – Donal Fellows Apr 03 '11 at 11:48

1 Answers1

12

Authentication itself should be done in a stateless way, so that the REST paradigm is not broken. This means authentication has to occur on every request. this SO question might provide some further details

the esiest method is using HTTP-Basic AUTH (rfc2617) over SSL encrypted connections (https). here are some java examples:

another method is using nonces so that you dont have to resend the user/pass combo everytime, but they are a bit more challenging:

there are lots and lots of ways to authenticate users but these 2 are the most often used that dont hold session state on the server side.

hope that helped

Community
  • 1
  • 1
fasseg
  • 17,504
  • 8
  • 62
  • 73