benvanstaveren / Mojolicious-Plugin-Authentication

A plugin to make authentication a bit easier
http://search.cpan.org/dist/Mojolicious-Plugin-Authentication/
Other
20 stars 17 forks source link

fail_cb option #19

Closed mche closed 7 years ago

mche commented 8 years ago

Hi!

About config options.

Good option fail_render=>{...}.

But the option failcb => sub {my ($r, $c, $captures, $arg) = @; ....} will be more powerfull.

Isn`t it?

jjatria commented 7 years ago

7b9809ca9 in the fail_sub branch implement something that does this. It makes it so that the fail_render option can take either a hash ref, or a sub ref that itself returns a hash ref.

The subroutine would only be called when there is no valid response, and the return value would be discarded unless it was true. If valid, the returned hash reference would be dereferenced and passed to $c->render, to keep the current interface.

What do you think?

mche commented 7 years ago

Ok, could be closed