[dancer-users] Dancer2::Plugin::Auth::Extensible wrong login page

Jeff Boes jeff at endpoint.com
Wed Aug 19 19:35:50 BST 2015

On 2015-08-19 09:35, Jeff Boes wrote:
> I am using the ::Provider::Config setup, with very little
> customization (for now; the plan is to move to a ::Database or ::DBIC
> provider eventually).
> I have a route that looks like this:
> get '/locale/:param' =>  require_any_role [qw( admin editor voter )] => 
> sub {
> ...
> };
> My application is running under Plack via:
> builder {
>     mount '/'    => Qbank::App->to_app;
>     mount '/api' => Qbank::API->to_app;
> };

Just to close the loop here:

When a route requires authentication via DPAE, and fails to 
authenticate, a URL is generated via uri_for(). This is evaluated in the 
context of the application you are in, which means the /api prefix is 
exactly correct. Thus, if you want '/' and '/api' to both require 
authentication this way, they will have to share an authentication 
handler and coordinate their sessions.

What I was trying to do was have route handlers in the API.pm (prefix: 
/api) application send unauthenticated requests over to /login in the 
App.pm (prefix: /) application, and that appears to be impossible or at 
least very difficult.

Jeff Boes <><
jeff at endpoint.com
(269) 408-0811

More information about the dancer-users mailing list