PlugAuth::Client::Tiny - (Deprecated) Minimal PlugAuth client
version 0.03
use PlugAuth::Client::Tiny; my $client = PlugAuth::Client::Tiny->new( url => "http://localhost:3000/" ); if($client->auth('primus', 'spark')) { # authentication succeeded } else { # authentication failed }
NOTE: Development for this tool is winding down, and PlugAuth::Client::Tiny and modules that depend on are deprecated. Please contact me ASAP if you depend on this tool. This distribution may be removed from CPAN, but not before june 30, 2018.
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.
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.
http://localhost:3000
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.
new
agent
default_headers
my $url = $client->url;
Returns the URL for the PlugAuth server. This attribute is read-only.
my $bool = $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.
my $bool = $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.
my $version = $client->version;
Returns the version of the PlugAuth server.
Graham Ollis <plicease@cpan.org>
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.
To install PlugAuth::Client::Tiny, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PlugAuth::Client::Tiny
CPAN shell
perl -MCPAN -e shell install PlugAuth::Client::Tiny
For more information on module installation, please visit the detailed CPAN module installation guide.