As support for HTTP, basic authentication is already built-in with Play. You can easily access request.user
and request.password
in your controller as using digest authentication is a little bit more complex. To be fair, the whole digest authentication is way more complex.
You can find the source code of this example in the chapter2/digest-auth
directory.
Understanding HTTP authentication in general is quite useful, in order to grasp what is done in this recipe. For every HTTP request the client wants to receive a resource by calling a certain URL. The server checks this request and decides whether it should return either the content or an error code and message telling the client to provide needed authentication. Now the client can re-request the URL using the correct credentials and get its content or just do nothing at all.
When using HTTP basic authentication, the client basically just sends some user/password combination with its request and...