How do I stack Plack authentication handlers?
Posted
by
Schwern
on Stack Overflow
See other posts from Stack Overflow
or by Schwern
Published on 2011-01-11T04:23:13Z
Indexed on
2011/01/11
4:54 UTC
Read the original article
Hit count: 196
I would like to have my Plack app try several different means of authorizing the user. Specifically, check if the user is already authorized via a session cookie, then check for Digest authentication and then fall back to Basic.
I figured I could just enable a bunch of Auth handlers in the order I wanted them to be checked (Session, Digest, Basic). Unfortunately, the way that Plack::Middleware::Auth::Digest and Plack::Middleware::Auth::Basic are written they both return 401 if digest or basic auth doesn't exist, respectively.
How is this normally dealt with in Plack?
© Stack Overflow or respective owner