Re: [akka-user] How to call a Future-based test from a Route?

2017-01-05 Thread Alan Burlison
On 02/01/17 21:12, Konrad Malawski wrote: How about sharing in a blog or docs about how to go about building such? I think that'd be very interesting to people who're faced similar questions as you were just a few days ago :) Here's what I ended up with: def authBasicHttp: Directive1[Login]

Re: [akka-user] How to call a Future-based test from a Route?

2017-01-02 Thread Alan Burlison
On 02/01/17 21:12, Konrad Malawski wrote: How about sharing in a blog or docs about how to go about building such? I think that'd be very interesting to people who're faced similar questions as you were just a few days ago :) Sure, I'll write something up when I have it polished up :-) -- Al

Re: [akka-user] How to call a Future-based test from a Route?

2017-01-02 Thread Konrad Malawski
Yup, should roll :) How about sharing in a blog or docs about how to go about building such? I think that'd be very interesting to people who're faced similar questions as you were just a few days ago :) -- Konrad `ktoso` Malawski Akka @ Lightbend On 2 Ja

Re: [akka-user] How to call a Future-based test from a Route?

2017-01-02 Thread Alan Burlison
On 02/01/17 12:50, 'Johannes Rudolph' via Akka User List wrote: Yes, right, I forgot that `flatMap` is only defined for Directive1. So, it needs to be headerValueByName("X-Auth-Key").tflatMap { case (user, pass) => instead. def xAuth: Directive1[Session] = (headerValueByName("X-Auth-User")

Re: [akka-user] How to call a Future-based test from a Route?

2017-01-02 Thread 'Johannes Rudolph' via Akka User List
On Monday, January 2, 2017 at 1:42:27 PM UTC+1, Alan Burlison wrote: > > One question: > > headerValueByName("X-Auth-Key")).flatMap { (user, pass) => > // <- user flatMap for custom directives > > doesn't compile as the resulting value of type Directive[(String, > String)] doesn't have a fl

Re: [akka-user] How to call a Future-based test from a Route?

2017-01-02 Thread Alan Burlison
On 02/01/17 11:51, 'Johannes Rudolph' via Akka User List wrote: here are a few steps to get there: [snip] HTH, It does indeed, thank you :-) One question: headerValueByName("X-Auth-Key")).flatMap { (user, pass) => // <- user flatMap for custom directives doesn't compile as the resultin

Re: [akka-user] How to call a Future-based test from a Route?

2017-01-02 Thread 'Johannes Rudolph' via Akka User List
Hi Alan, here are a few steps to get there: * provide all your different authentication directives as values of type `Directive1[T]` with T being the type of the principal found after successful authentication. * To build those, use either one of the existing authentication directives starti

Re: [akka-user] How to call a Future-based test from a Route?

2016-12-31 Thread Alan Burlison
> Have you seen the complete list of directives? > There's many directives with "Async" that means that they work on Futures. I've seen the async authorization directives but none of them fit the header mechanism I'm trying to emulate. authenticateOrRejectWithChallenge() seems to come closest but

Re: [akka-user] How to call a Future-based test from a Route?

2016-12-31 Thread Konrad Malawski
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 @ Lightbend

[akka-user] How to call a Future-based test from a Route?

2016-12-31 Thread Alan Burlison
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 authentic