Hi Andrew,

here's a general idea at how it could work:

If you model each authentication method as a `Directive1[Session]` that 
returns the session (or user, principal, etc.) for that authentication 
method and all of the directive return the a value of the same type or a 
type with a common supertype then you can combine each of those directives 
with `|`:


def authentication: Directive1[Session] = cookieAuthentication | 
tokenAuthentication | basicAuthentication

The first one will be used with highest precedence and the other ones will 
only be tried if all the previous once have rejected the request.

Is that what you are looking for?

Johannes

On Saturday, May 20, 2017 at 12:47:03 AM UTC+2, Andrew Norman wrote:
>
> This would be for a system that services requests from users directly and 
> also with other systems. Users would have a session cookie and non-user 
> systems a token. 
>
> The idea / paradigm here is the old java interceptor authentication 
> approach where authentication was attempted a number of ways before the 
> action is handled. If any of the various types of authentication was 
> successful then the action can be invoked (provided the authenticated 
> entity is authorized to invoke the target action).
>
> So looking at the akka-http setup, I'm seeing that there is cookie 
> handling directive and there are authentication directive (that look like 
> they are wired to handle usernames and passwords). Is there some sort of 
> directive that resembles or can work with the multi-source auth paradigm?
>

-- 
>>>>>>>>>>      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