CatalystX-OAuth2

 view release on metacpan or  search on metacpan

t/lib/ClientApp/Controller/Root.pm  view on Meta::CPAN

package ClientApp::Controller::Root;
use Moose;
use namespace::autoclean;
use HTTP::Request;

BEGIN { extends 'Catalyst::Controller' }

__PACKAGE__->config( namespace => '' );

sub auth : Local Args(0) {
  my ( $self, $c ) = @_;
  $c->res->body('auth ok') if $c->authenticate();
}

sub lead : Local Args(0) {
  my ( $self, $c ) = @_;
  $c->res->body('ok');
}

sub gold : Local Args(0) {
  my ( $self, $c ) = @_;
  return unless $c->user_exists;
  my $res = $c->user->oauth2->request(
    HTTP::Request->new( GET => 'http://resourceserver/gold' )
  );

  $c->res->body( $res->content );
}

1;



( run in 1.094 second using v1.01-cache-2.11-cpan-437f7b0c052 )