I am trying to build a web app using scalatra, and am working on the authentication. I successfully used scentry with an userpassword strategy. However, to do that, I had to "await" on my database requests: some of the scentry methods (authenticate, fromSession) expect a non-future return type . Is there a way to do async authentication in scalatra?
No. As you correctly noticed, the validate
method doesn't return a future in its signature, so we have to await
.
The rational behind this is that you need to know "right now" if the user is authenticated, before you start doing other calculations or operations.