No description, website, or topics provided.
Perl
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib/PlugAuth/Client
t
.gitignore
.travis.yml
Changes
README.md
dist.ini

README.md

PlugAuth::Client::Tiny Build Status

(Deprecated) Minimal PlugAuth client

SYNOPSIS

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

DESCRIPTION

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.

CONSTRUCTOR

new

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

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

  • url

    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.

ATTRIBUTES

url

my $url = $client->url;

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

METHODS

auth

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.

authz

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.

version

my $version = $client->version;

Returns the version of the PlugAuth server.

AUTHOR

Graham Ollis plicease@cpan.org

COPYRIGHT AND LICENSE

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.