Doorman

 view release on metacpan or  search on metacpan

lib/Doorman/PlackMiddleware.pm  view on Meta::CPAN

use 5.010;
use parent 'Plack::Middleware';
use Plack::Session;
use Plack::Util::Accessor qw(root_url scope);

use Doorman;
our $VERSION   = $Doorman::VERSION;
our $AUTHORITY = $Doorman::AUTHORITY;

use Doorman::Scope;
use Scalar::Util qw(weaken);

sub prepare_app {
    my $self = shift;
    $self->scope('users') unless $self->scope;
    return $self;
}

sub scope_object {
    my ($self, $obj) = @_;

lib/Doorman/PlackMiddleware.pm  view on Meta::CPAN

            $_[0]->scope_object->$method;
        };
    }
}

sub prepare_call {
    my ($self, $env) = @_;
    my $request = Plack::Request->new($env);

    $self->{env} = $env;
    weaken($self->{env});

    if (!$self->root_url) {
        my $root_uri = $request->uri->clone;
        $root_uri->path("");
        $root_uri->query(undef);
        $self->root_url($root_uri->as_string);
    }

    if ($env->{"doorman." . $self->scope}) {
        $self->scope_object($env->{"doorman." . $self->scope});

lib/Plack/Middleware/DoormanOpenID.pm  view on Meta::CPAN


use feature qw(switch);
use parent 'Doorman::PlackMiddleware';

use Plack::Request;
use Plack::Util::Accessor qw(secret ua);

use Net::OpenID::Consumer;
use LWP::UserAgent;
use URI;
use Scalar::Util qw(weaken);

sub prepare_app {
    my $self = shift;

    $self->SUPER::prepare_app(@_);

    $self->secret(
        'This is the default consumer_secret value for Net::OpenID::Consumer
         that you should provide for your own app. ' . $VERSION
    ) unless $self->secret;

lib/Plack/Middleware/DoormanTwitter.pm  view on Meta::CPAN

use parent 'Doorman::PlackMiddleware';
use strict;

our $VERSION   = "0.06";
our $AUTHORITY = "http://gugod.org";

use feature qw(say);
use Plack::Request;
use Plack::Util::Accessor qw(consumer_key consumer_secret);
use URI;
use Scalar::Util qw(weaken);
use Net::Twitter::Lite;

sub twitter {
    my ($self) = @_;

    my $nt = Net::Twitter::Lite->new(
        consumer_key    => $self->consumer_key,
        consumer_secret => $self->consumer_secret,
        legacy_lists_api => 0,
    );



( run in 1.324 second using v1.01-cache-2.11-cpan-65fba6d93b7 )