Brian Duggan > Clustericious-0.9910 > Clustericious::Plugin::PlugAuth

Download:
Clustericious-0.9910.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.01   Source   Latest Release: Clustericious-0.9940_02

NAME ^

Clustericious::Plugin::PlugAuth - Plugin for clustericious to use PlugAuth.

VERSION ^

Version 0.01

SYNOPSIS ^

SimpleApp.conf:

 {"plug_auth":{"url":"http://plugauthserver:3000"}}

Application:

 package SimpleApp;
 
 use base qw( Clustericious::App );
 
 sub startup {
   my $self = shift;
   $self->SUPER::startup(@_);
   # done by default for all clustericious applications.
   #$self->plugin('plug_auth');
 }
 
 package SimpleApp::Routes;
 
 use Clustericious::RouteBuilder;

 # unprotected 
 get '/public' => 'unprotected';
 
 # require PlugAuth username/password
 authenticate; 
 get '/private1' => 'protected';
 
 # protected by PlugAuth an explicit realm
 autheticate 'realm';
 get '/private2' => 'realm protected';
 
 # check for permissions to do $action on $resource
 authorize 'action', 'resource';
 get '/restricted1' => 'authz_restricted';
 
 # check for premissions to do $action on the resource /restricted2
 authorize 'action';
 get '/restricted2';
 
 # HTTP method as the $action and /http_method_get as the resource
 authorize '<method>';
 get '/http_method_get';

 # HTTP method as the $action and "/prefix/http_method_with_prefix"
 # as the resource.
 authorize '<method>', '/myprefix/<path>';
 get '/http_method_with_prefix';

DESCRIPTION ^

This provides authenticate and authorize methods which can be called from your applications Route class.

METHODS ^

authenticate [ $realm ]

Require username and password authentication, optionally with a realm. If a realm is not provided, '' is used.

authorize [$action, [$resource]]

Require the authenticated user have the authorization to perform the given action on the given resource.

skip_auth

 Clustericious::Plugin::PlugAuth->skip_auth(1);

Set this global flag to bypass authentication and authorization, e.g. during a subequest. This flag is reset at the end of the dispatch cycle.

SEE ALSO ^

PlugAuth

syntax highlighting: