Have you seen the complete list of directives?
There's many directives with "Async" that means that they work on Futures.

http://doc.akka.io/docs/akka-http/10.0.1/scala/http/routing-dsl/directives/alphabetically.html


-- 
Konrad `ktoso` Malawski
Akka <http://akka.io> @ Lightbend <http://lightbend.com>

On 31 December 2016 at 13:02:42, Alan Burlison (alan.burli...@gmail.com)
wrote:

I need to provide a REST service that provides HTTP header based
authentication as well as standard Basic HTTP authentication. There
are two header-based mechanisms, one uses a user/pass header pair and
the other uses a session header. I'm struggling to figure out how to
combine all three authentication mechanisms so that I have one
directive that provides the authenticated user id on success and a
rejection otherwise. I can extract the headers fine with
headerValueByName() but I need to do the authentication check
asynchronously with a Future as it might block. I can't find any
directives that look like they take a Future, are there any? The
skeleton I have so far is:

authenticateBasic(null, authenticate) { user => complete(s"Basic: $user") }
~
(headerValueByName("X-Auth-User") & headerValueByName("X-Auth-Key")) {
(user, pass) => complete(s"X-Auth: $user") } ~
headerValueByName("X-Auth-Session") { session => complete(s"Session:
$session")

What's missing for the second two is the actual validation of the
user/pass or token.

Thanks,

-- 
Alan Burlison
-- 

-- 
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups
"Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to