PlugAuth::Routes - routes for plugauth
version 0.28
This module defines the HTTP URL routes provided by PlugAuth. This document uses Mojolicious conventions to describe routes, see Mojolicious::Guides::Routing for details.
These routes work for unauthenticated and unauthorized users.
Returns the string "welcome to plug auth"
if username and password provided using BASIC authentication and are correct
Return 200 ok
if username and password provided using BASIC authentication but are not correct
Return 403 not ok
if username and password are not provided using BASIC authentication
Return 401 please authenticate
if the given user (#user) is permitted to perform the given action (#action) on the given resource (*resource)
otherwise
Return 403 "unauthorized : $user cannot $action $resource"
Returns a list of resources that the given user (#user) is permitted to perform action (#action) on. The regex is used to filter the results (*resourceregex).
Return a list of actions that PlugAuth knows about.
Return a list of groups that the given user (#user) belongs to.
Returns 404 not ok if the user does not exist.
if the given host (#host) has the given tag (:tag)
return 200 ok
return 403 not ok
Returns a list of all users that PlugAuth knows about.
Returns a list of all groups that PlugAuth knows about.
Returns the list of users that belong to the given group (:group)
These routes are available to users authenticates and authorized to perform the 'accounts' action. They will return
401
If no credentials are provided
403
If the user is unauthorized.
503
If the PlugAuth server cannot reach itself or the delegated PlugAuth server.
Create a user. The username and password are provided autodata arguments (JSON, YAML, form data, etc).
username
password
If supported by your authentication plugin (requires create_user_cb to be implemented see PlugAuth::Plugin::Auth for details) You may also optionally include groups as an autodata argument, which specifies the list of groups to which the new user should belong. groups should be a comma separated list stored as a string.
create_user_cb
groups
Emits event 'create_user' on success
$app->on(create_user => sub { my($event, $hash) = @_; my $admin = $hash->{admin}; # user who created the group my $user = $hash->{user}; });
Delete the given user (#user). Returns 200 ok on success, 404 not ok on failure.
Emits event 'delete_user' on success
$app->on(delete_user => sub { my($event, $hash) = @_; my $admin = $hash->{admin}; # user who created the group my $user = $hash->{user}; });
Create a group. The group name and list of users are provided as autodata arguments (JSON, YAML, form data etc). Returns 200 ok on success, 403 not ok on failure.
group
users
Emits event 'create_group' on success
$app->on(create_group => sub { my($event, $hash) = @_; my $admin = $hash->{admin}; # user who created the group my $group = $hash->{group}; my $users = $hash->{users}; });
Delete the given group (:group). Returns 200 ok on success, 403 not ok on failure.
Emits event 'delete_group' on success
$app->on(delete_group => sub { my($event, $hash) = @_; my $admin = $hash->{admin}; # user who deleted the group my $group = $hash->{group}; });
Update the list of users belonging to the given group (:group). The list of users is provided as an autodata argument (JSON, YAML, form data etc.). Returns 200 ok on success, 404 not ok on failure.
Emits event 'update_group' on success
$app->on(update_group => sub { my($event, $hash) = @_; my $admin = $hash->{admin}; # user who updated the group my $group = $hash->{group}; my $users = $hash->{users}; });
Add the given user (#username) to the given group (:group). Returns 200 ok on success, 404 not ok on failure.
Emits event 'update_group' (see route for POST /group/:group for an example).
Remove the given user (#username) from the given group (:group). Returns 200 ok on success, 404 not ok on failure.
Grant access to the given group (#group) so they can perform the given action (:action1) on the given resource (*resource). Returns 200 ok on success, 404 not ok on failure.
Emits event 'grant' on success
$app->on(grant => sub { my($event, $hash) = @_; my $admin = $hash->{admin}; # user who did the granting my $group = $hash->{group}; my $action = $hash->{action}; my $resource = $hash->{resource}; });
Revoke permission to the given group (#group) to perform the given action (:action1) on the given resource (*resource). Returns 200 ok on success, 404 not ok on failure.
(the action is specified in the route as action1 because action is reserved by Mojolicious).
Emits event 'revoke' on success
$app->on(revoke => sub { my($event, $hash) = @_; my $admin = $hash->{admin}; # user who did the revoking my $group = $hash->{group}; my $action = $hash->{action}; my $resource = $hash->{resource}; });
Get the list of granted permissions.
These routes are available to users authenticates and authorized to perform the 'change_password' action. They will return
Change the password of the given user (#user). The password is provided as an autodata argument (JSON, YAML, form data, etc.). Returns 200 ok on success, 403 not ok on failure.
Emits event 'change_password' on success
$app->on(change_password => sub { my($event, $hash) = @_; my $admin = $hash->{admin}; # user who changed the password my $user = $hash->{user}; # user whos password is changed });
PlugAuth
Graham Ollis <gollis@sesda3.com>
This software is copyright (c) 2012 by NASA GSFC.
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, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PlugAuth
CPAN shell
perl -MCPAN -e shell install PlugAuth
For more information on module installation, please visit the detailed CPAN module installation guide.