Catalyst-Authentication-Store-Crowd

 view release on metacpan or  search on metacpan

META.yml  view on Meta::CPAN

  ExtUtils::MakeMaker: 6.30
dynamic_config: 0
generated_by: 'Dist::Zilla version 4.300020, CPAN::Meta::Converter version 2.120921'
license: perl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: 1.4
name: Catalyst-Authentication-Store-Crowd
requires:
  Catalyst::Authentication::User: 0
  HTTP::Request: 0
  JSON: 0
  LWP::UserAgent: 0
  Moose: 0
  warnings: 0
version: 0.04

Makefile.PL  view on Meta::CPAN

  },
  "CONFIGURE_REQUIRES" => {
    "ExtUtils::MakeMaker" => "6.30"
  },
  "DISTNAME" => "Catalyst-Authentication-Store-Crowd",
  "EXE_FILES" => [],
  "LICENSE" => "perl",
  "NAME" => "Catalyst::Authentication::Store::Crowd",
  "PREREQ_PM" => {
    "Catalyst::Authentication::User" => 0,
    "HTTP::Request" => 0,
    "JSON" => 0,
    "LWP::UserAgent" => 0,
    "Moose" => 0,
    "warnings" => 0
  },
  "VERSION" => "0.04",
  "test" => {
    "TESTS" => "t/*.t"
  }
);

lib/Catalyst/Authentication/Store/Crowd.pm  view on Meta::CPAN

package Catalyst::Authentication::Store::Crowd;

our $VERSION = 0.04;

use warnings;
use Moose;

use LWP::UserAgent;
use HTTP::Request;
use JSON;

use Catalyst::Authentication::Store::Crowd::User;

has 'find_user_url' => (
    is => 'ro',
    isa => 'Str',
    required => '1',
    default => sub {
        'http://localhost';

lib/Catalyst/Authentication/Store/Crowd.pm  view on Meta::CPAN


sub user_supports {
    my $self = shift;
    Catalyst::Authentication::Store::Crowd::User->supports(@_);
}

sub _crowd_get_user {
    my ( $self, $username ) = @_;
    my $ua = LWP::UserAgent->new;
    my $uri = $self->find_user_url."?username=$username";
    my $req = HTTP::Request->new( 'GET',  $uri );
    $req->authorization_basic(
        $self->app->{app_name},
        $self->app->{password}
    );
    $req->header('Accept' => 'application/json');

    my $response = $ua->request( $req );
    return $response;
}



( run in 0.360 second using v1.01-cache-2.11-cpan-de7293f3b23 )