Role::REST::Client::Auth::Basic

Basic Authentication for REST Client Role
Download

Role::REST::Client::Auth::Basic Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Kaare Rasmussen
  • Publisher web site:
  • http://search.cpan.org/~kaare/

Role::REST::Client::Auth::Basic Tags


Role::REST::Client::Auth::Basic Description

Role::REST::Client::Auth::Basic is a Perl module that adds basic authentication to Role::REST::Client.Just add it to your class and all calls will automatically authenticate.Add an authentication parameter to the arguments if you for some reaon don't want to authenticate.SYNOPSIS { package RESTExample; use Moose; with 'Role::REST::Client'; with 'Role::REST::Client::Auth::Basic'; sub bar { my ($self) = @_; my $res = $self->post('foo/bar/baz', {foo => 'bar'}); my $code = $res->code; my $data = $res->data; return $data if $code == 200; } } my $foo = RESTExample->new( server => 'http://localhost:3000', type => 'application/json', user => 'mee', passwd => 'sekrit', ); $foo->bar; # controller sub foo : Local { my ($self, $c) = @_; # Call w/ basic authentication my $res = $c->model('MyData')->post('foo/bar/baz', {foo => 'bar'}); my $code = $res->code; my $data = $res->data; ... # Call w/o basic authentication my $res = $c->model('MyData')->post('xyzzy', {foo => 'bar'}, {authentication => undef}); }Product's homepage


Role::REST::Client::Auth::Basic Related Software