Reenabling support for digest based authentication

Reordered the authentication flow so as to check for digest based
authentication before using the specified callback in the controller
Merge pull request #139 from sergiocampama/digest

Reenabling support for digest based authentication