As support for HTTP, basic authentication is already built-in with Play. You can easily access
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
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. ...