Graham Ollis


PlugAuth::Client::Tiny - Minimal PlugAuth client


version 0.01


 use PlugAuth::Client::Tiny;
 my $client = PlugAuth::Client::Tiny->new( url => "http://localhost:3000/" );
 if($client->auth('primus', 'spark'))
   # authentication succeeded
   # authentication failed


PlugAuth::Client::Tiny is a minimal PlugAuth client. It uses HTTP::Tiny instead of LWP or Mojo::UserAgent. It provides only a mechanism for authenticating and authorizing against a PlugAuth server. If you need to modify the users/groups/authorization on the server through the RESTful API then you will need the heavier PlugAuth::Client which relies on Clustericious::Client and Mojo::UserAgent.

PlugAuth::Client::Tiny should work perfectly with PlugAuth::Lite as well, because it only uses the subset of the PlugAuth API which is implemented by PlugAuth::Lite.


The constructor is (predictably) new:

 use PlugAuth::Client::Tiny->new;
 my $client = PlugAuth::Client::Tiny->new;

PlugAuth::Client::Tiny's constructor accepts one optional option:


The URL of the PlugAuth server. If not specified, http://localhost:3000 is used.

All other options passed to new will be passed on to the constructor of HTTP::Tiny, which allows you to set agent, default_headers, etc. See the documentation of HTTP::Tiny for details.



Returns the URL for the PlugAuth server. This attribute is read-only.


$client->auth( $user, $password )

Attempt to authenticate against the PlugAuth server using the given username and password. Returns 1 on success, 0 on failure and dies on a connection failure.

$client->authz( $user, $action, $resource)

Determine if the given user is authorized to perform the given action on the given resource. Returns 1 on success, 0 on failure and dies on connection failure.


This module depends on HTTP::Tiny, which is a non-core dependency, and by some definitions of ::Tiny, therefore no longer tiny.


Graham Ollis <>


This software is copyright (c) 2012 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.