Clustericious::Plugin::SimpleAuth - Plugin for clustericious to use simpleauth.
Version 0.01
SimpleApp.conf:
{"simple_auth":{"url":"http://simpleauthserver: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('simple_auth'); } package SimpleApp::Routes; use Clustericious::RouteBuilder; # unprotected get '/public' => 'unprotected'; # requires simpleauth username/password authenticate; get '/private1' => 'protected'; # protected by simple auth using 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';
This provides authenticate and authorize methods which can be called from your applications Route class.
Require username and password authentication, optionally with a realm. If a realm is not provided, '' is used.
Require the authenticated user have the authorization to perform the given action on the given resource.
Clustericious::Plugin::SimpleAuth->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.