Dancer::Plugin::Auth::Basic

Yesterday, I released a YADP (Yet Another Dancer Plugin). It’s called Dancer::Plugin::Auth::Basic, and it adds support for basic HTTP authentication in Dancer apps. It’s a side effect of my work on a project that needed a simple access restriction mechanism — I thought it would be nice to have a HTTP authentication solution for Dancer which is easy to use and universal (meaning it does not rely on Plack or .htaccess/htpasswd files).

Here’s a simple usage example — a fragment of Dancer configuration which restricts access to a specific path (/restricted):

plugins:
  "Auth::Basic":
    paths:
      "/restricted":
        realm: Restricted zone
        user: fmulder
        password: trustno1

And that’s it. If you’d like to try the plugin in your app, it’s up on CPAN and on Github.

This plugin also happens to be the first CPAN module that I’ve built using Module::Build, instead of the rusty ExtUtils::MakeMaker. I’ve had no problems switching, the only thing that was a bit troublesome was creating a README.pod file (which is a good thing to have if you’re publishing your module on Github), but I managed to do that eventually.

Leave a Reply