Graham Ollis > PlugAuth-Lite-0.07 > PlugAuth::Lite

Download:
PlugAuth-Lite-0.07.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.07   Source  

NAME ^

PlugAuth::Lite - Pluggable (lite) authentication and authorization server.

VERSION ^

version 0.07

SYNOPSIS ^

command line:

 % plugauthlite

Mojolicious Plugin:

 use Mojolicious::Lite;
 
 plugin 'plug_auth_lite', 
   auth => sub {
     my($user, $pass) = @_;
     if($user eq 'optimus' && $pass eq 'matrix')
     { return 1; }
     else
     { return 0; }
   },
   authz => sub {
     my($user, $action, $resource) = @_;
     if($user eq 'optimus && $action eq 'open' && $resource =~ m{^/matrix})
     { return 1 }
     else
     { return 0 }
   };

Mojolicious App:

 use PlugAuth::Lite;
 my $app = PlugAuth::Lite->new({
   auth => sub {
     my($user, $pass) = @_;
     if($user eq 'optimus' && $pass eq 'matrix')
     { return 1; }
     else
     { return 0; }
   },
   authz => sub {
     my($user, $action, $resource) = @_;
     if($user eq 'optimus && $action eq 'open' && $resource =~ m{^/matrix})
     { return 1 }
     else
     { return 0 }
   },
 });

DESCRIPTION ^

This distribution provides

plugauthlite

PlugAuth compatible server in the form of a Mojolicious::Lite application.

Mojolicious::Plugin::PlugAuthLite

Mojolicious plugin that adds PlugAuth compatible routes to a new or existing Mojolicious application.

PlugAuth::Lite

Mojolicious application with PlugAuth compatible routes that can be spawned from within a perl application.

In the future it will also contain a testing interface for testing authentication and authorization rules in Clustericious applications.

It has fewer prerequisites that the full fledged PlugAuth server (simply Mojolicious and perl itself) but also fewer features (it notably lacks the management interface).

ATTRIBUTES ^

auth

Subroutine reference to call to check authentication. Passes in ($user, $pass) should return true for authenticated, false otherwise.

If not provided, all authentications fail.

authz

Subroutine reference to call to check authorization. Passes in ($user, $action, $resource) and should return true for authorized, false otherwise.

If not provided, all authorizations succeed.

host

Subroutine reference to call to check host information.

SEE ALSO ^

plugauthlite, Mojolicious::Plugin::PlugAuthLite, Test::PlugAuth, Clustericious

AUTHOR ^

Graham Ollis <plicease@cpan.org>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2013 by Graham Ollis.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: