Mojolicious-Plugin-Authorization-1.03.02/ 0000755 0011653 0000310 00000000000 12304671526 017245 5 ustar scolesj dev Mojolicious-Plugin-Authorization-1.03.02/Changes 0000644 0011653 0000310 00000000541 12304671274 020540 0 ustar scolesj dev Revision history for Mojolicious-Plugin-Authorization
Changes in 1.01
Initail version
Changes in 1.02
Fixed the pod
Changes in 1.03
3'rd Times a charm
Changes in 1.03.01
Fix up on some the the tests. No no fall though errors
Changes in 1.03.02
Fix up on some the the tests. Hash keys now sorted from Renee https://github.com/reneeb
Mojolicious-Plugin-Authorization-1.03.02/MANIFEST 0000644 0011653 0000310 00000000451 12304671276 020400 0 ustar scolesj dev Build.PL
Changes
LICENSE
MANIFEST
META.json
META.yml
Makefile.PL
README
README.pod
dist.ini
example/miniauthorfile.pm
example/miniauthorfile.txt
example/showoff-authorization.pl
lib/Mojolicious/Plugin/Authorization.pm
t/00-load.t
t/01-functional.t
t/manifest.t
t/release-cpan-changes.t
weaver.ini
Mojolicious-Plugin-Authorization-1.03.02/example/ 0000755 0011653 0000310 00000000000 12304671526 020700 5 ustar scolesj dev Mojolicious-Plugin-Authorization-1.03.02/example/showoff-authorization.pl 0000644 0011653 0000310 00000013363 12304671301 025603 0 ustar scolesj dev #!/usr/bin/env perl
use strict;
use warnings;
use warnings FATAL => qw{ uninitialized };
use autodie;
# Disable IPv6, epoll and kqueue
BEGIN { $ENV{MOJO_NO_IPV6} = $ENV{MOJO_POLL} = 1 }
use Mojolicious::Lite;
=pod
=head1 Title
showoff-authorization.pl --- an example of the Mojolicious::Plugin::Authorization module by John Scoles
=head1 Invocation
$ perl showoff-authorization.pl daemon
=head1 Notes
My first crack at a Mojo plugin a steal from Ben van Staveren's Authentication so I owe him and some others
a great note of thanks
Like Authentication this is a very a simple application. It supplies the framwork and you have to give it
the guts which this little progam shows.
I did not add in any Authentication as that is up to you to build. In this test I just assume you are
authenticated on the session and that session has a role hash on it.
=head1 Versions
0.1: May 01 2012
=cut
################################################################
### miniauthorfile.pm lays out basic functionality for the miniauthorfile
use miniauthorfile;
my $roles = miniauthorfile->new('miniauthorfile.txt');
################################################################
plugin 'authorization', {
has_priv => sub {
my $self = shift;
my ($priv, $extradata) = @_;
return 0
unless($self->session('role'));
my $role = $self->session('role');
my $privs = $roles->{$role};
return 1
if exists($privs->{$priv});
return 0;
},
is_role => sub {
my $self = shift;
my ($role, $extradata) = @_;
return 0
unless($self->session('role'));
return 1
if ($self->session('role') eq $role);
return 0;
},
user_privs => sub {
my $self = shift;
my ($extradata) = @_;
return []
unless($self->session('role'));
my $role = $self->session('role');
my $privs = $roles->{$role};
return keys(%{$privs});
},
user_role => sub {
my $self = shift;
my ($extradata) = @_;
return $self->session('role');
},
};
################################################################
get '/' => sub {
my $self = shift;
unless($self->session('role')){
$self->session('role'=>'guest');
}
$self->render('index'); ## index needs to be named to match '/'
};
get '/dogshow' => sub {
my $self = shift;
unless ($self->has_priv('view')) {
$self->render('index');
}
else{
$self->stash('role_name'=> $self->role());
$self->render('dogshow');
}
};
get '/change/:role' => sub {
my $self = shift;
my $role = $self->param('role');
$roles->set_role($self->session,$role);
$self->stash('role_name'=> $self->role());
$self->render('dogshow');
# $self->render(template); ## this is called automatically
};
get '/view' => sub {
my $self = shift;
unless ($self->has_priv('view')) {
$self->render('index');
}
# $self->render(template); ## this is called automatically
};
get '/herd' => sub {
my $self = shift;
unless ($self->has_priv('herd')) {
$self->render('not_allowed');
}
};
get '/judge' => sub {
my $self = shift;
$self->render('not_allowed')
unless ($self->has_priv('judge'));
$self->render('all_glory')
if ($self->is("hypnotoad"))
};
############ these two subs can show you what you can do now, based on authenticated status
get '/my_privs/' => sub {
my $self = shift;
$self->render('not_allowed')
unless ($self->session('role'));
my @privs = $self->privileges();
$self->stash('privs'=> \@privs);
};
## /condition/authonly exists as a webpage ONLY after authentication
app->secret('All GLORY to the Hypnotoad!!'); # used for cookies and persistence
app->start();
################################################################
__DATA__
@@ index.html.ep
% layout 'default';
% title 'Root';
Top Index Page
The purpose of this little web app is to show an example of Mojolicious and its Mojolicious::Authorization module by John Scoles.
Go to the trials as a Guest.
Go to the trials as a Dog.
Go the trials as a Judge.
Go the trials as The Hypnotoad.
@@ dogshow.html.ep
% layout 'default';
% title 'Pan Galatic Sheep Dog Trials';
Welcome "<%= $role_name %>" to the the Pan Galatic Sheep Dog Trials.
Go home
View a Trial
Herd some Sheep
Judge a trial
What are my Privleges
@@ view.html.ep
% layout 'default';
% title 'View Trials';
Enjoy the Trials
He's good.
But our real compition is the Hypnotoad
@@ herd.html.ep
% layout 'default';
% title 'Herd Some Sheep';
Heard Some Sheep
Woof, Bow-Wow
eye-ball
run~chase
put sheep in pen
@@ judge.html.ep
% layout 'default';
% title 'Judge a Dog';
Judge a Dog
5.8
5.9
5.8
5.7
and
4.9
from the Russian Judge
@@ my_privs.html.ep
% layout 'default';
% title 'My Privleges';
Privleges
%foreach my $priv (@{$privs}) {
<%==$priv%>
%}
@@ all_glory.html.ep
% layout 'default';
% title 'Judge a Dog';
Judge a Dog
And the winner is
All Gloy to the Hypnotoad
Clap-Clap-Clap
@@ not_allowed.html.ep
% layout 'default';
% title 'Page Unavailable';
I am sorry do to interferance from suicide booths on 'Eminiar VII' you cannot get to this page
@@ layouts/default.html.ep
<%= title %>
Mojolicious: <%= $0 %>: <%= title %>
<%= content %>
Mojolicious-Plugin-Authorization-1.03.02/example/miniauthorfile.txt 0000644 0011653 0000310 00000000230 12304671300 024441 0 ustar scolesj dev ## file format:
## role:privilege1:privilege2:privilege3
## role1:privilege1:privilege3
hypnotoad:view:herd:judge
guest:view
dog:herd
judge:view:judge
Mojolicious-Plugin-Authorization-1.03.02/example/miniauthorfile.pm 0000644 0011653 0000310 00000003236 12304671300 024247 0 ustar scolesj dev package
miniauthorfile; # hide from PAUSE
use strict;
use warnings;
use warnings FATAL => qw{ uninitialized };
use autodie;
use 5.10.0;
################################################################
=pod
=head1 Title
miniautorfile.pm --- mini data base for a role-based access control (RBAC) file.
=head1 Invocation
$ perl miniautorfile.pm
shows off how this module works.
=head1 Versions
0.0: April 11 2012
=cut
################################################################
# file format: role:privilege1:privilege2:privilege3
# role1:privilege1:privilege3
################################################################
sub new {
my $class = shift;
my ($authorfile)= @_;
(-e $authorfile) or die "You must create a user-readable and user-writable authorization file first.\n";
## load persistent role information from an existing authorization file
my %roles;
open(my $FIN, "<", $authorfile);
while (<$FIN>) {
(/^\#/) and next; ## skip comments
(/\w/) or next; ## skip empty lines
(!/([\w :\\])/) and die "Your authorization file has a non-word character ($1), other than : and \\ on line $.: $_\n";
my @values= split(/:/);
my $role = shift(@values);
my $privs;
foreach my $priv (@values){
$priv =~ s/\R//g;
$privs->{$priv} = 1;
}
$roles{$role}= $privs;
}
close($FIN);
return bless({ authorfile => $authorfile, %roles }, $class);
}
################################################################
sub set_role {
my $self = shift;
my ($session,$role) = @_;
#$session->{'role_privs'} = $roles{$role};
$session->{'role'}=$role;
# return ((exists($self->{$_[0]}))?($_[0]):undef);
}
1;
Mojolicious-Plugin-Authorization-1.03.02/t/ 0000755 0011653 0000310 00000000000 12304671526 017510 5 ustar scolesj dev Mojolicious-Plugin-Authorization-1.03.02/t/01-functional.t 0000644 0011653 0000310 00000006427 12304671302 022256 0 ustar scolesj dev #!/usr/bin/env perl
use strict;
use warnings;
# Disable IPv6, epoll and kqueue
BEGIN { $ENV{MOJO_NO_IPV6} = $ENV{MOJO_POLL} = 1 }
use Test::More;
plan tests => 42;
# testing code starts here
use Mojolicious::Lite;
use Test::Mojo;
my %roles = (role1=>{priv1=>1},
role2=>{priv1=>1,priv2=>1});
plugin 'authorization', {
has_priv => sub {
my $self = shift;
my ($priv, $extradata) = @_;
return 0
unless($self->session('role'));
my $role = $self->session('role');
my $privs = $roles{$role};
return 1
if exists($privs->{$priv});
return 0;
},
is_role => sub {
my $self = shift;
my ($role, $extradata) = @_;
return 0
unless($self->session('role'));
return 1
if ($self->session('role') eq $role);
return 0;
},
user_privs => sub {
my $self = shift;
my ($extradata) = @_;
return []
unless($self->session('role'));
my $role = $self->session('role');
my $privs = $roles{$role};
return sort keys(%{$privs});
},
user_role => sub {
my $self = shift;
my ($extradata) = @_;
return $self->session('role');
},
};
get '/' => sub {
my $self = shift;
$self->session('role'=>'role1');
$self->render(text => 'index page');
};
get '/priv1' => sub {
my $self = shift;
$self->render(text=> $self->has_priv('priv1') ? 'Priv 1' : 'fail');
};
get '/priv2' => sub {
my $self = shift;
$self->render(text=> $self->has_priv('priv2') ? 'Priv 2' : 'fail');
};
get '/privilege1' => sub {
my $self = shift;
$self->render(text=> $self->has_privilege('priv1') ? 'Priv 1' : 'fail');
};
get '/privilege2' => sub {
my $self = shift;
$self->render(text=> $self->has_privilege('priv2') ? 'Priv 2' : 'fail');
};
get '/role1' => sub {
my $self = shift;
$self->render(text=> $self->role('role1') ? 'Role 1' : 'fail');
};
get '/role2' => sub {
my $self = shift;
$self->render(text=> $self->role('role2') ? 'Role 2' : 'fail');
};
get '/change/:role' => sub {
my $self = shift;
my $role = $self->param('role');
$self->session('role'=>$role);
my $new_role = $self->role;
$self->render(text=>$new_role);
};
get '/myrole' => sub {
my $self = shift;
my $new_role = $self->role;
$self->render(text=>$new_role);
};
get '/myprivs' => sub {
my $self = shift;
my @privs = $self->privileges();
my $priv = join(':',@privs);
$self->render(text=>$priv);
};
my $t = Test::Mojo->new;
$t->get_ok('/')->status_is(200)->content_is('index page');
$t->get_ok('/priv1')->status_is(200)->content_is('Priv 1');
$t->get_ok('/priv2')->status_is(200)->content_is('fail');
$t->get_ok('/privilege1')->status_is(200)->content_is('Priv 1');
$t->get_ok('/privilege2')->status_is(200)->content_is('fail');
$t->get_ok('/myrole')->status_is(200)->content_is('role1');
$t->get_ok('/myprivs')->status_is(200)->content_is('priv1');
$t->get_ok('/change/role2')->status_is(200)->content_is('role2');
$t->get_ok('/priv1')->status_is(200)->content_is('Priv 1');
$t->get_ok('/priv2')->status_is(200)->content_is('Priv 2');
$t->get_ok('/privilege1')->status_is(200)->content_is('Priv 1');
$t->get_ok('/privilege2')->status_is(200)->content_is('Priv 2');
$t->get_ok('/myrole')->status_is(200)->content_is('role2');
$t->get_ok('/myprivs')->status_is(200)->content_is('priv1:priv2');
Mojolicious-Plugin-Authorization-1.03.02/t/00-load.t 0000644 0011653 0000310 00000000123 12304671302 021015 0 ustar scolesj dev #!perl -T
use Test::More tests => 1;
use_ok('Mojolicious::Plugin::Authorization');
Mojolicious-Plugin-Authorization-1.03.02/t/manifest.t 0000644 0011653 0000310 00000000415 12304671302 021473 0 ustar scolesj dev #!perl -T
use strict;
use warnings;
use Test::More;
unless ( $ENV{RELEASE_TESTING} ) {
plan( skip_all => "Author tests not required for installation" );
}
eval "use Test::CheckManifest 0.9";
plan skip_all => "Test::CheckManifest 0.9 required" if $@;
ok_manifest();
Mojolicious-Plugin-Authorization-1.03.02/t/release-cpan-changes.t 0000644 0011653 0000310 00000000466 12304671302 023640 0 ustar scolesj dev #!perl
BEGIN {
unless ($ENV{RELEASE_TESTING}) {
require Test::More;
Test::More::plan(skip_all => 'these tests are for release candidate testing');
}
}
use Test::More;
eval 'use Test::CPAN::Changes';
plan skip_all => 'Test::CPAN::Changes required for this test' if $@;
changes_ok();
done_testing();
Mojolicious-Plugin-Authorization-1.03.02/README.pod 0000644 0011653 0000310 00000016733 12304671277 020723 0 ustar scolesj dev =pod
=head1 NAME
Mojolicious::Plugin::Authorization - A plugin to make Authorization a bit easier
=head1 VERSION
version 1.03
=head1 SYNOPSIS
use Mojolicious::Plugin::Authorization
$self->plugin('Authorization' => {
'has_priv' => sub { ... },
'is_role' => sub { ... },
'user_privs' => sub { ... },
'user_role' => sub { ... },
});
if ($self->has_priv('delete_all', { optional => 'extra data stuff' })) {
...
}
=head1 DESCRIPTION
A very simple API implementation of role-based access control (RBAC). This plugin is only an API you will
have to do all the work of setting up your roles and privileges and then provide four subs that are used by
the plugin.
The plugin expects that the current session will be used to get the role its privileges. It also assumes that
you have already been authenticated and your role set.
That is about it you are free to implement any system you like.
=head1 METHODS
=head2 has_priv('privilege', $extra_data) or has_privilege('privilege', $extra_data)
'hHas_priv'' and ''has_privilege'' will use the supplied C subroutine ref to check if the current session has the
given privilege. Returns true when the session has the privilege or false otherwise.
You can pass additional data along in the extra_data hashref and it will be passed to your C
subroutine as-is.
=head2 is('role',$extra_data)
'is' will use the supplied C subroutine ref to check if the current session is the
given role. Returns true when the session has privilege or false otherwise.
You can pass additional data along in the extra_data hashref and it will be passed to your C
subroutine as-is.
=head2 privileges($extra_data)
'pPrivileges'' will use the supplied C subroutine ref and return the privileges of the current session.
You can pass additional data along in the extra_data hashref and it will be passed to your C
subroutine as-is. The returned data is dependant on the supplied C subroutine.
=head2 role($extra_data)
'role' will use the supplied C subroutine ref and return the role of the current session.
You can pass additional data along in the extra_data hashref and it will be passed to your C
subroutine as-is. The returned data is dependant on the supplied C subroutine.
=head1 CONFIGURATION
The following options must be set for the plugin:
=over 4
=item has_priv (REQUIRED) A coderef for checking to see if the current session has a privilege (see L"HAS PRIV">).
=item is_role (REQUIRED) A coderef for checking to see if the current session is a certain role (see L"IS ROLE">).
=item user_privs (REQUIRED) A coderef for returning the privileges of the current session (see L"PRIVILEGES">).
=item user_role (REQUIRED) A coderef for retiring the role of the current session (see L"ROLE">).
=back
=head2 HAS PRIV
'has_priv' is used when you need to confirm that the current session has the given privilege.
The coderef you pass to the C configuration key has the following signature:
sub {
my ($app, $privilege,$extradata) = @_;
...
}
You must return either 0 for a fail and 1 for a pass. This allows C to work correctly.
=head2 IS
'is' is used when you need to confirm that the current session is set to the given role.
The coderef you pass to the C configuration key has the following signature:
sub {
my ($app, $role, $extradata) = @_;
...
return $role;
}
You must return either 0 for a fail and 1 for a pass. This allows C to work correctly.
=head2 PRIVILEGES
'privileges' is used when you need to get all the privileges of the current session.
The coderef you pass to the C configuration key has the following signature:
sub {
my ($app,$extradata) = @_;
...
return $privileges;
}
You can return anything you want. It would normally be an arrayref of privileges but you are free to
return a scalar, hashref, arrayref, blessed object, or undef.
=head2 ROLE
'role' is used when you need to get the role of the current session.
The coderef you pass to the C configuration key has the following signature:
sub {
my ($app,$extradata) = @_;
...
return $role;
}
You can return anything you want. It would normally be just a scalar but you are free to
return a scalar, hashref, arrayref, blessed object, or undef.
=head1 EXAMPLES
For a code example using this, see the F test,
it uses L and this plugin.
=head1 ROUTING VIA CONDITION
This plugin also exports a routing condition you can use in order to limit access to certain documents to only
sessions that have a privilege.
$r->route('/delete_all')->over(has_priv => 'delete_all')->to('mycontroller#delete_all');
my $delete_all_only = $r->route('/members')->over(has_priv => 'delete_all')->to('members#delete_all');
$delete_all_only->route('delete')->to('members#delete_all');
If the session does not have the 'delete_all' privilege, these routes will not be considered by the dispatcher and unless you have set up a catch-all route,
a 404 Not Found will be generated instead.
Another condition you can use to limit access to certain documents to only those sessions that
have a role.
$r->route('/view_all')->over(is => 'ADMIN')->to('mycontroller#view_all');
my $view_all_only = $r->route('/members')->over(is => 'view_all')->to('members#view_all');
$view_all_only->route('view')->to('members#view_all');
If the session is not the 'ADMIN' role, these routes will not be considered by the dispatcher and unless you have set up a catch-all route,
a 404 Not Found will be generated instead.
This behavior is similar to the "has" condition.
=head1 ROUTING VIA CALLBACK
It is not recommended to route un-authorized requests to anything but a 404 page. If you do route to some sort
of 'You are not allowed page' you are telling a hacker that the URL was correct while the 404 tells them nothing.
This is just my opinion.
=head1 SEE ALSO
L, L
=head1 AUTHOR
John Scoles, C<< >>
=head1 BUGS / CONTRIBUTING
Please report any bugs or feature requests through the web interface at L.
=head1 SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Mojolicious::Plugin::Authorization
You can also look for information at:
=over 4
=item * AnnoCPAN: Annotated CPAN documentation L
=item * CPAN Ratings L
=item * Search CPAN L
=back
=head1 ACKNOWLEDGEMENTS
Ben van Staveren (madcat)
- For 'Mojolicious::Plugin::Authentication' which I used as a guide in writing up this one.
Chuck Finley
- For staring me off on this.
Abhijit Menon-Sen
- For the routing suggestions
Roland Lammel
- For some other good suggestions
=head1 LICENSE AND COPYRIGHT
Copyright 2012 John Scoles.
This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
=cut Mojolicious-Plugin-Authorization-1.03.02/META.yml 0000644 0011653 0000310 00000001076 12304671526 020522 0 ustar scolesj dev # http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: Mojolicious-Plugin-Authorization
version: 1.03.02
version_from:
installdirs: site
requires:
Module::Build: 0.38
Mojo::Base: 0
Mojolicious::Lite: 0
strict: 0
Test::Mojo: 0
Test::More: 0
warnings: 0
distribution_type: module
generated_by: ExtUtils::MakeMaker version 6.30
Mojolicious-Plugin-Authorization-1.03.02/lib/ 0000755 0011653 0000310 00000000000 12304671526 020013 5 ustar scolesj dev Mojolicious-Plugin-Authorization-1.03.02/lib/Mojolicious/ 0000755 0011653 0000310 00000000000 12304671526 022307 5 ustar scolesj dev Mojolicious-Plugin-Authorization-1.03.02/lib/Mojolicious/Plugin/ 0000755 0011653 0000310 00000000000 12304671526 023545 5 ustar scolesj dev Mojolicious-Plugin-Authorization-1.03.02/lib/Mojolicious/Plugin/Authorization.pm 0000644 0011653 0000310 00000023050 12304671307 026740 0 ustar scolesj dev package Mojolicious::Plugin::Authorization;
BEGIN {
$Mojolicious::Plugin::Authorization::VERSION = '1.0302';
}
use Mojo::Base 'Mojolicious::Plugin';
# The dog is good, but our real competition is the Hypnotoad.
sub register {
my ($self, $app, $args) = @_;
$args ||= {};
die __PACKAGE__, ": missing 'has_priv' subroutine ref in parameters\n"
unless $args->{has_priv} && ref($args->{has_priv}) eq 'CODE';
die __PACKAGE__, ": missing 'is_role' subroutine ref in parameters\n"
unless $args->{is_role} && ref($args->{is_role}) eq 'CODE';
die __PACKAGE__, ": missing 'user_privs' subroutine ref in parameters\n"
unless $args->{user_privs} && ref($args->{user_privs}) eq 'CODE';
die __PACKAGE__, ": missing 'user_role' subroutine ref in parameters\n"
unless $args->{user_role} && ref($args->{user_role}) eq 'CODE';
my $has_priv_cb = $args->{has_priv};
my $is_role_cb = $args->{is_role};
my $user_privs_cb = $args->{user_privs};
my $user_role_cb = $args->{user_role};
$app->routes->add_condition(has_priv => sub {
my ($r, $c, $captures, $priv) = @_;
return ($priv && $has_priv_cb->($c,$priv)) ? 1 : 0;
});
$app->routes->add_condition(is => sub {
my ($r, $c, $captures, $role) = @_;
return ($role && $is_role_cb->($c,$role)) ? 1 : 0;
});
$app->helper(privileges => sub {
my ($c, $user, $extradata) = @_;
return $user_privs_cb->($c, $user, $extradata);
});
$app->helper(has_priv => sub {
my ($c, $priv, $extradata) = @_;
my $has_priv = $has_priv_cb->($c, $priv, $extradata);
return $has_priv;
});
$app->helper(has_privilege => sub {
my ($c, $priv, $extradata) = @_;
my $has_priv = $has_priv_cb->($c, $priv, $extradata);
return $has_priv;
});
$app->helper(is => sub {
my ($c, $role, $extradata) = @_;
return $is_role_cb->($c, $role, $extradata);
});
$app->helper(role => sub {
my ($c, $user, $extradata) = @_;
return $user_role_cb->($c, $user, $extradata);
});
}
1;
__END__
=pod
=head1 NAME
Mojolicious::Plugin::Authorization - A plugin to make Authorization a bit easier
=head1 VERSION
version 1.03
=head1 SYNOPSIS
use Mojolicious::Plugin::Authorization
$self->plugin('Authorization' => {
'has_priv' => sub { ... },
'is_role' => sub { ... },
'user_privs' => sub { ... },
'user_role' => sub { ... },
});
if ($self->has_priv('delete_all', { optional => 'extra data stuff' })) {
...
}
=head1 DESCRIPTION
A very simple API implementation of role-based access control (RBAC). This plugin is only an API you will
have to do all the work of setting up your roles and privileges and then provide four subs that are used by
the plugin.
The plugin expects that the current session will be used to get the role its privileges. It also assumes that
you have already been authenticated and your role set.
That is about it you are free to implement any system you like.
=head1 METHODS
=head2 has_priv('privilege', $extra_data) or has_privilege('privilege', $extra_data)
'has_priv' and 'has_privilege' will use the supplied C subroutine ref to check if the current session has the
given privilege. Returns true when the session has the privilege or false otherwise.
You can pass additional data along in the extra_data hashref and it will be passed to your C
subroutine as-is.
=head2 is('role',$extra_data)
'is' will use the supplied C subroutine ref to check if the current session is the
given role. Returns true when the session has privilege or false otherwise.
You can pass additional data along in the extra_data hashref and it will be passed to your C
subroutine as-is.
=head2 privileges($extra_data)
'privileges' will use the supplied C subroutine ref and return the privileges of the current session.
You can pass additional data along in the extra_data hashref and it will be passed to your C
subroutine as-is. The returned data is dependant on the supplied C subroutine.
=head2 role($extra_data)
'role' will use the supplied C subroutine ref and return the role of the current session.
You can pass additional data along in the extra_data hashref and it will be passed to your C
subroutine as-is. The returned data is dependant on the supplied C subroutine.
=head1 CONFIGURATION
The following options must be set for the plugin:
=over 4
=item has_priv (REQUIRED) A coderef for checking to see if the current session has a privilege (see L"HAS PRIV">).
=item is_role (REQUIRED) A coderef for checking to see if the current session is a certain role (see L"IS ROLE">).
=item user_privs (REQUIRED) A coderef for returning the privileges of the current session (see L"PRIVILEGES">).
=item user_role (REQUIRED) A coderef for retiring the role of the current session (see L"ROLE">).
=back
=head2 HAS PRIV
'has_priv' is used when you need to confirm that the current session has the given privilege.
The coderef you pass to the C configuration key has the following signature:
sub {
my ($app, $privilege,$extradata) = @_;
...
}
You must return either 0 for a fail and 1 for a pass. This allows C to work correctly.
=head2 IS
'is' is used when you need to confirm that the current session is set to the given role.
The coderef you pass to the C configuration key has the following signature:
sub {
my ($app, $role, $extradata) = @_;
...
return $role;
}
You must return either 0 for a fail and 1 for a pass. This allows C to work correctly.
=head2 PRIVILEGES
'privileges' is used when you need to get all the privileges of the current session.
The coderef you pass to the C configuration key has the following signature:
sub {
my ($app,$extradata) = @_;
...
return $privileges;
}
You can return anything you want. It would normally be an arrayref of privileges but you are free to
return a scalar, hashref, arrayref, blessed object, or undef.
=head2 ROLE
'role' is used when you need to get the role of the current session.
The coderef you pass to the C configuration key has the following signature:
sub {
my ($app,$extradata) = @_;
...
return $role;
}
You can return anything you want. It would normally be just a scalar but you are free to
return a scalar, hashref, arrayref, blessed object, or undef.
=head1 EXAMPLES
For a code example using this, see the F test,
it uses L and this plugin.
=head1 ROUTING VIA CONDITION
This plugin also exports a routing condition you can use in order to limit access to certain documents to only
sessions that have a privilege.
$r->route('/delete_all')->over(has_priv => 'delete_all')->to('mycontroller#delete_all');
my $delete_all_only = $r->route('/members')->over(has_priv => 'delete_all')->to('members#delete_all');
$delete_all_only->route('delete')->to('members#delete_all');
If the session does not have the 'delete_all' privilege, these routes will not be considered by the dispatcher and unless you have set up a catch-all route,
a 404 Not Found will be generated instead.
Another condition you can use to limit access to certain documents to only those sessions that
have a role.
$r->route('/view_all')->over(is => 'ADMIN')->to('mycontroller#view_all');
my $view_all_only = $r->route('/members')->over(is => 'view_all')->to('members#view_all');
$view_all_only->route('view')->to('members#view_all');
If the session is not the 'ADMIN' role, these routes will not be considered by the dispatcher and unless you have set up a catch-all route,
a 404 Not Found will be generated instead.
This behavior is similar to the "has" condition.
=head1 ROUTING VIA CALLBACK
It is not recommended to route un-authorized requests to anything but a 404 page. If you do route to some sort
of 'You are not allowed page' you are telling a hacker that the URL was correct while the 404 tells them nothing.
This is just my opinion.
=head1 SEE ALSO
L, L
=head1 AUTHOR
John Scoles, C<< >>
=head1 BUGS / CONTRIBUTING
Please report any bugs or feature requests through the web interface at L.
=head1 SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Mojolicious::Plugin::Authorization
You can also look for information at:
=over 4
=item * AnnoCPAN: Annotated CPAN documentation L
=item * CPAN Ratings L
=item * Search CPAN L
=back
=head1 ACKNOWLEDGEMENTS
Ben van Staveren (madcat)
- For 'Mojolicious::Plugin::Authentication' which I used as a guide in writing up this one.
Chuck Finley
- For staring me off on this.
Abhijit Menon-Sen
- For the routing suggestions
Roland Lammel
- For some other good suggestions
=head1 LICENSE AND COPYRIGHT
Copyright 2012 John Scoles.
This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
=cut
Mojolicious-Plugin-Authorization-1.03.02/weaver.ini 0000644 0011653 0000310 00000000606 12304671277 021244 0 ustar scolesj dev [@CorePrep]
[Name]
[Version]
[Region / prelude]
[Generic / SYNOPSIS]
[Generic / DESCRIPTION]
[Generic / OVERVIEW]
[Collect / METHODS]
command = method
[Collect / PRIVATE_METHODS]
header = PRIVATE METHODS
command = p_method
[Collect / ATTRIBUTES]
command = attr
[Collect / PRIVATE_ATTRIBUTES]
header = PRIVATE ATTRIBUTES
command = p_attr
[Leftovers]
[Region / postlude]
[Authors]
[Legal]
Mojolicious-Plugin-Authorization-1.03.02/META.json 0000644 0011653 0000310 00000002373 12304671276 020675 0 ustar scolesj dev {
"abstract" : "A plugin to make authorization a bit easier",
"author" : [
"John Scoles "
],
"dynamic_config" : 1,
"generated_by" : "Module::Build version 0.38, CPAN::Meta::Converter version 2.110930",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : "2"
},
"name" : "Mojolicious-Plugin-Authorization",
"prereqs" : {
"build" : {
"requires" : {
"Module::Build" : "0.38",
"Mojolicious::Lite" : 0,
"Test::Mojo" : 0,
"Test::More" : 0,
"strict" : 0,
"warnings" : 0
}
},
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "6.30",
"Module::Build" : "0.38"
}
},
"runtime" : {
"requires" : {
"Mojo::Base" : 0
}
}
},
"provides" : {
"Mojolicious::Plugin::Authorization" : {
"file" : "lib/Mojolicious/Plugin/Authorization.pm",
"version" : "1.0302"
}
},
"release_status" : "stable",
"resources" : {
"license" : [
"http://dev.perl.org/licenses/"
]
},
"version" : "1.03"
}
Mojolicious-Plugin-Authorization-1.03.02/dist.ini 0000644 0011653 0000310 00000000667 12304671274 020722 0 ustar scolesj dev name = Mojolicious-Plugin-Authorization
author = John Scoles
license = Perl_5
copyright_holder = John Scoles
[@Git]
tag_format = %v
tag_message = Release: %v
[Git::NextVersion]
first_version = 1.01
version_regexp = ^(.+)$
[@Basic]
[ModuleBuild]
mb_version = 0.38
[NextRelease]
[PkgVersion]
[PodVersion]
[MetaJSON]
[AutoPrereqs]
[GitHub::Update]
cpan = 1
[GitHub::Meta]
[ReadmeFromPod]
[Test::CPAN::Changes:]
Mojolicious-Plugin-Authorization-1.03.02/README 0000644 0011653 0000310 00000016243 12304671277 020136 0 ustar scolesj dev NAME
Mojolicious::Plugin::Authorization - A plugin to make Authorization a bit easier
VERSION
version 1.03
SYNOPSIS
use Mojolicious::Plugin::Authorization
$self->plugin('Authorization' => {
'has_priv' => sub { ... },
'is_role' => sub { ... },
'user_privs' => sub { ... },
'user_role' => sub { ... },
});
if ($self->has('delete_all', { optional => 'extra data stuff' })) {
...
}
DESCRIPTION
A very simple API implementation of role-based access control (RBAC). This plugin is only an API you will
have to do all the work of setting up your roles and privileges and then provide four subs that are used by
the plugin.
The plugin expects that the current session will be used to get the role its privileges. It also assumes that
you have already been authenticated and your role set.
That is about it you are free to implement any system you like.
METHODS
has_priv('privilege', $extra_data) or has_privilege('privilege', $extra_data)
'has_priv' and 'has_privilege' will use the supplied "has_priv" subroutine ref to check if the current session has the
given privilege. It should return true when the session has the privilege or false otherwise.
You can pass additional data along in the extra_data hashref, it will be passed to your "has_priv"
subroutine as-is.
is('role',$extra_data)
'is' will use the supplied "is_role" subroutine ref to check if the current session is the
given role. I should return true when the session has privilege or false otherwise.
You can pass additional data along in the extra_data hashref, it will be passed to your "is_role"
subroutine as-is.
privileges($extra_data)
'privileges' will use the supplied "user_privs" subroutine ref and return the privileges of the current session.
You can pass additional data along in the extra_data hashref, it will be passed to your "user_privs"
subroutine as-is. The returned data is dependant on the supplied "user_privs" subroutine.
role($extra_data)
'role' will use the supplied "user_role" subroutine ref and return the role of the current session.
You can pass additional data along in the extra_data hashref, it will be passed to your "user_role"
subroutine as-is. The returned data is dependant on the supplied "user_privs" subroutine.
CONFIGURATION
The following options must be set for the plugin:
has_priv (REQUIRED) A coderef for checking to see if the current session has a privilege (see "HAS_PRIV").
is_role (REQUIRED) A coderef for checking to see if the current session is a certain role (see "IS").
user_privs (REQUIRED) A coderef for returning the privileges of the current session (see "PRIVILEGES").
user_role (REQUIRED) A coderef for retiring the role of the current session (see "ROLE").
HAS_PRIV
Has_priv is used when you need to confirm that the current session has the given privilege.
The coderef you pass to the "has_priv" configuration key has the following signature:
sub {
my ($app, $privilege,$extradata) = @_;
...
}
You must return either 0 for a fail and 1 for a pass. This allows "ROUTING VIA CONDITION" to work correctly.
IS
Is is used when you need to confirm that the current session is set to the given role.
The coderef you pass to the "is_role" configuration key has the following signature:
sub {
my ($app, $role, $extradata) = @_;
...
return $role;
}
You must return either 0 for a fail and 1 for a pass. This allows "ROUTING VIA CONDITION" to work correctly.
PRIVILEGES
Privileges is used when you need to get all the privileges of the current session.
The coderef you pass to the "user_privs" configuration key has the following signature:
sub {
my ($app,$extradata) = @_;
...
return $privileges;
}
You can return anything you want. It would normally be an arrayref of privileges but you are free to
return a scalar, hashref, arrayref, blessed object, or undef.
ROLE
Role is used when you need to get the role of the current session.
The coderef you pass to the "user_role" configuration key has the following signature:
sub {
my ($app,$extradata) = @_;
...
return $role;
}
You can return anything you want. It would normally be just a scalar but you are free to
return a scalar, hashref, arrayref, blessed object, or undef.
EXAMPLES
For a code example using this, see the t/01-functional.t test,
it uses Mojolicious::Lite and this plugin.
ROUTING VIA CONDITION
This plugin also exports a routing condition you can use in order to limit access to certain documents to only
sessions that have a privilege.
$r->route('/delete_all')->over(has_priv => 'delete_all')->to('mycontroller#delete_all');
my $delete_all_only = $r->route('/members')->over(has_priv => 'delete_all')->to('members#delete_all');
$delete_all_only->route('delete')->to('members#delete_all');
If the session does not have the 'delete_all' privilege, these routes will not be considered by the dispatcher and unless you have set up a catch-all route,
a 404 Not Found will be generated instead.
Another condition you can use to limit access to certain documents to only those sessions that
have a role.
$r->route('/view_all')->over(is => 'ADMIN')->to('mycontroller#view_all');
my $view_all_only = $r->route('/members')->over(is => 'view_all')->to('members#view_all');
$view_all_only->route('view')->to('members#view_all');
If the session is not the 'ADMIN' role, these routes will not be considered by the dispatcher and unless you have set up a catch-all route,
a 404 Not Found will be generated instead.
This behavior is similar to the "has" condition.
ROUTING VIA CALLBACK
It is not recommended to route un-authorized requests to anything but a 404 page. If you do route to some sort
of 'You are not allowed page' you are telling a hacker that the URL was correct while the 404 tells them nothing.
This is just my opinion.
SEE ALSO
Mojolicious::Sessions, Mojocast 3: Authorization
AUTHOR
John Scoles, ""
BUGS / CONTRIBUTING
Please report any bugs or feature requests through the web interface at .
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Mojolicious::Plugin::Authorization
You can also look for information at:
* AnnoCPAN: Annotated CPAN documentation
* CPAN Ratings
* Search CPAN
ACKNOWLEDGEMENTS
Ben van Staveren (madcat)
- For 'Mojolicious::Plugin::Authentication' which I used as a guide in writing up this one.
Chuck Finley
- For staring me off on this.
Abhijit Menon-Sen
- For the routing suggestions
Roland Lammel
- For some other good suggestions
LICENSE AND COPYRIGHT
Copyright 2012 John Scoles.
This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
Mojolicious-Plugin-Authorization-1.03.02/Makefile.PL 0000644 0011653 0000310 00000002505 12304671276 021223 0 ustar scolesj dev use strict;
use warnings;
use ExtUtils::MakeMaker 6.30;
my %WriteMakefileArgs = (
"ABSTRACT" => "A plugin to make authorization a bit easier",
"AUTHOR" => "John Scoles ",
"BUILD_REQUIRES" => {
"Module::Build" => "0.38",
"Mojolicious::Lite" => 0,
"Test::Mojo" => 0,
"Test::More" => 0,
"strict" => 0,
"warnings" => 0
},
"CONFIGURE_REQUIRES" => {
"ExtUtils::MakeMaker" => "6.30",
"Module::Build" => "0.38"
},
"DISTNAME" => "Mojolicious-Plugin-Authorization",
"EXE_FILES" => [],
"LICENSE" => "perl",
"NAME" => "Mojolicious::Plugin::Authorization",
"PREREQ_PM" => {
"Mojo::Base" => 0
},
"VERSION" => "1.03.02",
"test" => {
"TESTS" => "t/*.t"
},
"META_MERGE" => {
"resources" => {
"repository" => 'https://github.com/byterock/mojolicious-plugin-authorization',
},
},
);
unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
my $pp = $WriteMakefileArgs{PREREQ_PM};
for my $mod ( keys %$br ) {
if ( exists $pp->{$mod} ) {
$pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
}
else {
$pp->{$mod} = $br->{$mod};
}
}
}
delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
WriteMakefile(%WriteMakefileArgs);
Mojolicious-Plugin-Authorization-1.03.02/LICENSE 0000644 0011653 0000310 00000043371 12304671275 020263 0 ustar scolesj dev This software is copyright (c) 2012 by John Scoles.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
Terms of the Perl programming language system itself
a) the GNU General Public License as published by the Free
Software Foundation; either version 1, or (at your option) any
later version, or
b) the "Artistic License"
--- The GNU General Public License, Version 1, February 1989 ---
This software is Copyright (c) 2012 by Ben van Staveren.
This is free software, licensed under:
The GNU General Public License, Version 1, February 1989
GNU GENERAL PUBLIC LICENSE
Version 1, February 1989
Copyright (C) 1989 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The license agreements of most software companies try to keep users
at the mercy of those companies. By contrast, our General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. The
General Public License applies to the Free Software Foundation's
software and to any other program whose authors commit to using it.
You can use it for your programs, too.
When we speak of free software, we are referring to freedom, not
price. Specifically, the General Public License is designed to make
sure that you have the freedom to give away or sell copies of free
software, that you receive source code or can get it if you want it,
that you can change the software or use pieces of it in new free
programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of a such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must tell them their rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any program or other work which
contains a notice placed by the copyright holder saying it may be
distributed under the terms of this General Public License. The
"Program", below, refers to any such program or work, and a "work based
on the Program" means either the Program or any work containing the
Program or a portion of it, either verbatim or with modifications. Each
licensee is addressed as "you".
1. You may copy and distribute verbatim copies of the Program's source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and
disclaimer of warranty; keep intact all the notices that refer to this
General Public License and to the absence of any warranty; and give any
other recipients of the Program a copy of this General Public License
along with the Program. You may charge a fee for the physical act of
transferring a copy.
2. You may modify your copy or copies of the Program or any portion of
it, and copy and distribute such modifications under the terms of Paragraph
1 above, provided that you also do the following:
a) cause the modified files to carry prominent notices stating that
you changed the files and the date of any change; and
b) cause the whole of any work that you distribute or publish, that
in whole or in part contains the Program or any part thereof, either
with or without modifications, to be licensed at no charge to all
third parties under the terms of this General Public License (except
that you may choose to grant warranty protection to some or all
third parties, at your option).
c) If the modified program normally reads commands interactively when
run, you must cause it, when started running for such interactive use
in the simplest and most usual way, to print or display an
announcement including an appropriate copyright notice and a notice
that there is no warranty (or else, saying that you provide a
warranty) and that users may redistribute the program under these
conditions, and telling the user how to view a copy of this General
Public License.
d) You may charge a fee for the physical act of transferring a
copy, and you may at your option offer warranty protection in
exchange for a fee.
Mere aggregation of another independent work with the Program (or its
derivative) on a volume of a storage or distribution medium does not bring
the other work under the scope of these terms.
3. You may copy and distribute the Program (or a portion or derivative of
it, under Paragraph 2) in object code or executable form under the terms of
Paragraphs 1 and 2 above provided that you also do one of the following:
a) accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of
Paragraphs 1 and 2 above; or,
b) accompany it with a written offer, valid for at least three
years, to give any third party free (except for a nominal charge
for the cost of distribution) a complete machine-readable copy of the
corresponding source code, to be distributed under the terms of
Paragraphs 1 and 2 above; or,
c) accompany it with the information you received as to where the
corresponding source code may be obtained. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form alone.)
Source code for a work means the preferred form of the work for making
modifications to it. For an executable file, complete source code means
all the source code for all modules it contains; but, as a special
exception, it need not include source code for modules which are standard
libraries that accompany the operating system on which the executable
file runs, or for standard header files or definitions files that
accompany that operating system.
4. You may not copy, modify, sublicense, distribute or transfer the
Program except as expressly provided under this General Public License.
Any attempt otherwise to copy, modify, sublicense, distribute or transfer
the Program is void, and will automatically terminate your rights to use
the Program under this License. However, parties who have received
copies, or rights to use copies, from you under this General Public
License will not have their licenses terminated so long as such parties
remain in full compliance.
5. By copying, distributing or modifying the Program (or any work based
on the Program) you indicate your acceptance of this license to do so,
and all its terms and conditions.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the original
licensor to copy, distribute or modify the Program subject to these
terms and conditions. You may not impose any further restrictions on the
recipients' exercise of the rights granted herein.
7. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of the license which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
the license, you may choose any version ever published by the Free Software
Foundation.
8. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to humanity, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.
To do so, attach the following notices to the program. It is safest to
attach them to the start of each source file to most effectively convey
the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
Copyright (C) 19yy
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19xx name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the
appropriate parts of the General Public License. Of course, the
commands you use may be called something other than `show w' and `show
c'; they could even be mouse-clicks or menu items--whatever suits your
program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
program `Gnomovision' (a program to direct compilers to make passes
at assemblers) written by James Hacker.
, 1 April 1989
Ty Coon, President of Vice
That's all there is to it!
--- The Artistic License 1.0 ---
This software is Copyright (c) 2012 by Ben van Staveren.
This is free software, licensed under:
The Artistic License 1.0
The Artistic License
Preamble
The intent of this document is to state the conditions under which a Package
may be copied, such that the Copyright Holder maintains some semblance of
artistic control over the development of the package, while giving the users of
the package the right to use and distribute the Package in a more-or-less
customary fashion, plus the right to make reasonable modifications.
Definitions:
- "Package" refers to the collection of files distributed by the Copyright
Holder, and derivatives of that collection of files created through
textual modification.
- "Standard Version" refers to such a Package if it has not been modified,
or has been modified in accordance with the wishes of the Copyright
Holder.
- "Copyright Holder" is whoever is named in the copyright or copyrights for
the package.
- "You" is you, if you're thinking about copying or distributing this Package.
- "Reasonable copying fee" is whatever you can justify on the basis of media
cost, duplication charges, time of people involved, and so on. (You will
not be required to justify it to the Copyright Holder, but only to the
computing community at large as a market that must bear the fee.)
- "Freely Available" means that no fee is charged for the item itself, though
there may be fees involved in handling the item. It also means that
recipients of the item may redistribute it under the same conditions they
received it.
1. You may make and give away verbatim copies of the source form of the
Standard Version of this Package without restriction, provided that you
duplicate all of the original copyright notices and associated disclaimers.
2. You may apply bug fixes, portability fixes and other modifications derived
from the Public Domain or from the Copyright Holder. A Package modified in such
a way shall still be considered the Standard Version.
3. You may otherwise modify your copy of this Package in any way, provided that
you insert a prominent notice in each changed file stating how and when you
changed that file, and provided that you do at least ONE of the following:
a) place your modifications in the Public Domain or otherwise make them
Freely Available, such as by posting said modifications to Usenet or an
equivalent medium, or placing the modifications on a major archive site
such as ftp.uu.net, or by allowing the Copyright Holder to include your
modifications in the Standard Version of the Package.
b) use the modified Package only within your corporation or organization.
c) rename any non-standard executables so the names do not conflict with
standard executables, which must also be provided, and provide a separate
manual page for each non-standard executable that clearly documents how it
differs from the Standard Version.
d) make other distribution arrangements with the Copyright Holder.
4. You may distribute the programs of this Package in object code or executable
form, provided that you do at least ONE of the following:
a) distribute a Standard Version of the executables and library files,
together with instructions (in the manual page or equivalent) on where to
get the Standard Version.
b) accompany the distribution with the machine-readable source of the Package
with your modifications.
c) accompany any non-standard executables with their corresponding Standard
Version executables, giving the non-standard executables non-standard
names, and clearly documenting the differences in manual pages (or
equivalent), together with instructions on where to get the Standard
Version.
d) make other distribution arrangements with the Copyright Holder.
5. You may charge a reasonable copying fee for any distribution of this
Package. You may charge any fee you choose for support of this Package. You
may not charge a fee for this Package itself. However, you may distribute this
Package in aggregate with other (possibly commercial) programs as part of a
larger (possibly commercial) software distribution provided that you do not
advertise this Package as a product of your own.
6. The scripts and library files supplied as input to or produced as output
from the programs of this Package do not automatically fall under the copyright
of this Package, but belong to whomever generated them, and may be sold
commercially, and may be aggregated with this Package.
7. C or perl subroutines supplied by you and linked into this Package shall not
be considered part of this Package.
8. The name of the Copyright Holder may not be used to endorse or promote
products derived from this software without specific prior written permission.
9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
The End
Mojolicious-Plugin-Authorization-1.03.02/Build.PL 0000644 0011653 0000310 00000001742 12304671274 020545 0 ustar scolesj dev use strict;
use warnings;
use Module::Build 0.38;
my %module_build_args = (
"build_requires" => {
"Module::Build" => "0.38",
"Mojolicious::Lite" => 0,
"Test::Mojo" => 0,
"Test::More" => 0,
"strict" => 0,
"warnings" => 0
},
"configure_requires" => {
"ExtUtils::MakeMaker" => "6.30",
"Module::Build" => "0.38"
},
"dist_abstract" => "A plugin to make authorization a bit easier",
"dist_author" => [
"John Scoles "
],
"dist_name" => "Mojolicious-Plugin-Authorization",
"dist_version" => "1.03.01",
"license" => "perl",
"module_name" => "Mojolicious::Plugin::Authorization",
"recommends" => {},
"recursive_test_files" => 1,
"requires" => {
"Mojo::Base" => 0
},
"script_files" => [],
"meta_merge" => {
"resources" => {
"repository" => 'https://github.com/byterock/mojolicious-plugin-authorization'
}
},
);
my $build = Module::Build->new(%module_build_args);
$build->create_build_script;