5.4. Authentication

The RESTful architecture doesn't have too much to say about authentication, and (at the time of writing) there are no supplementary standards to define how authentication should be implemented. And because REST runs over HTTP we don't get any particular support from the network stack either. In fact, because HTTP is stateless we don't even get the notion of a session or a connection.

Restful Objects therefore uses Naked Objects' authentication mechanism, with authentication performed for each RESTful call. What this means depends on the deploymentType:

Note

You can if you want run in EXPLORATION (or PROTOTYPE) mode rather than SERVER_EXPLORATION (or SERVER_PROTOTYPE) mode. The difference is that former only support single-users, while SERVER_* supports multiple concurrent users.

Calling Restful Objects in SERVER mode with no credentials will result in an exception:

On the other hand, if user and password parameters are supplied, then we can login:

This behaviour is pluggable however, at two levels:

In the future there will doubtless be standardized (WS-* style) approaches for RESTful authenticatication, but the above should provide enough flexibility in the meantime.