Alex Rivera | Logout

RESTful Service Authentication

Asked 2012-02-08T21:31:04.057
8

As per REST spec, the service is supposed to be stateless; but then it becomes difficult to enable authentication. Some of the stuff I have read said "making REST stateful is not end of the world". But that's not the point, the point is to follow the spec and be consistent.

So, I am asking this question here in a hope someone could guide me in the right direction. I am working with Spring MVC to create a REST Service. I do not have views. It is a true REST Service which consumes/produces JSON. I need to have authentication (and authorization down the road) mechanism for this application that is stateless and follows REST specification. The client will be written in JavaScript (Backbone.js, CoffeeScript) and will accept username/password from a User. Then it will post that information to the server.

How can I achieve true stateless authentication (and authorization) in a Spring based application?

Digest Authentication over SSL - Is this the way to go?

Edit
Report

1 Answer

2

Session management is different from the state management.

You server side during the handshake can generate a token and every time the client makes call it will have to add that token either to the head or else where for your server to be able to analyze and decide if you can allow the call to continue on.

Server does not need to maintain any state to check the validity of that token that can be done using some algorithm .

answered 2012-02-08T22:14:20.603

Your Answer