Kaare Rasmussen > Role-REST-Client-Auth-Basic > Role::REST::Client::Auth::Basic

Download:
Role-REST-Client-Auth-Basic-0.05.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.05   Source  

NAME ^

Role::REST::Client::Auth::Basic - Basic Authentication for REST Client Role

VERSION ^

version 0.05

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});
        }

DESCRIPTION ^

This role 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

NAME ^

Role::REST::Client::Auth::Basic - Basic Authentication for REST Client Role

AUTHOR ^

Kaare Rasmussen, <kaare at cpan dot com>

CONTRIBUTORS ^

Aran Deltac, (cpan:BLUEFEET) <bluefeet@gmail.com>

BUGS ^

Please report any bugs or feature requests to bug-role-rest-client-auth-basic at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Role-REST-Client-Auth-Basic.

COPYRIGHT & LICENSE ^

Copyright 2014 Kaare Rasmussen, all rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.

AUTHOR ^

Kaare Rasmussen <kaare at cpan dot net>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2014 by Kaare Rasmussen.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: