Auth-Kokolores

 view release on metacpan or  search on metacpan

lib/Auth/Kokolores/Config.pm  view on Meta::CPAN

# prefork engine options
has 'min_servers' => ( is => 'rw', isa => 'Int', default => '4' );
has 'min_spare_servers' => ( is => 'rw', isa => 'Int', default => '4' );
has 'max_spare_servers' => ( is => 'rw', isa => 'Int', default => '12' );
has 'max_servers' => ( is => 'rw', isa => 'Int', default => '25' );
has 'max_requests' => ( is => 'rw', isa => 'Int', default => '1000' );

has 'satisfy' => ( is => 'rw', isa => 'Str', default => 'all' );

has 'overwrittable_attributes' => (
  is => 'ro', isa => 'ArrayRef[Str]', default => sub { [
    'log_level', 'log_file'
  ] },
);
has 'net_server_attributes' => (
  is => 'ro', isa => 'ArrayRef[Str]', default => sub { [
    'syslog_ident', 'syslog_facility', 'user', 'group',
    'min_servers', 'min_spare_servers', 'max_spare_servers', 'max_servers',
    'max_requests', 'pid_file',
  ] },
);
has 'kokolores_attributes' => (
  is => 'ro', isa => 'ArrayRef[Str]', default => sub { [
    'socket_path', 'socket_mode', 'satisfy', 'protocol',
  ] },
);

has 'Plugin' => ( is => 'rw', isa => 'HashRef', default => sub { {} } );

sub new_from_file {
  my ( $class, $file ) = @_;

  if( ! -f $file ) {

lib/Auth/Kokolores/ConnectionPool.pm  view on Meta::CPAN

package Auth::Kokolores::ConnectionPool;

use strict;
use MooseX::Singleton;

# ABSTRACT: connection cache to hold connection handles
our $VERSION = '1.01'; # VERSION

has 'handles' => (
  is => 'ro', isa => 'HashRef', lazy => 1,
  default => sub { {} },
  traits => [ 'Hash' ],
  handles => {
    'add_handle' => 'set',
    'get_handle' => 'get',
    'clear_handle' => 'delete',
    'reset' => 'clear',
  }
);

lib/Auth/Kokolores/Plugin/CheckPassword.pm  view on Meta::CPAN

has 'salt_from' => ( is => 'ro', isa => 'Maybe[Str]' );
sub get_salt {
  my ( $self, $r ) = @_;
  if( defined $self->salt_from ) {
    return $r->get_info( $self->salt_from );
  }
  return $self->salt;
}

has 'supported_methods' => (
  is => 'ro', isa => 'ArrayRef[Str]',
  default => sub { [ 'plain' ] },
  traits => [ 'Array' ],
  handles => {
    add_supported_method => 'push',
  },
);

sub is_supported_method {
  my ( $self, $method ) = @_;
  if( grep { $method eq $_ } @{$self->supported_methods} ) {
    return 1;
  }
  return 0;
}

has 'additional_methods' => (
  is => 'ro', isa => 'HashRef[Str]',
  default => sub { {
    pbkdf2 => 'Crypt::PBKDF2',
    bcrypt => 'Crypt::Eksblowfish::Bcrypt',
    bcrypt_fields => 'Digest::Bcrypt',
  } },
);

sub load_additional_methods {
  my $self = shift;
  my $am = $self->additional_methods;

lib/Auth/Kokolores/Plugin/FileRetrieve.pm  view on Meta::CPAN

    my $self = shift;
    my $str = $self->seperator;
    my $regex = eval { qr/$str/ };
    if( $@ ) { die("invalid regex in seperator: $@") }
    return $regex;
  },
);

has 'fields' => ( is => 'ro', isa => 'Str', default => 'username,password');
has '_fields' => (
  is => 'ro', isa => 'ArrayRef[Str]', lazy => 1,
  default => sub { [ split(/\s*,\s*/, shift->fields ) ] },
  traits => [ 'Array' ],
  handles => { 
    'num_fields' => 'count',
  }
);

has 'file' => ( is => 'ro', isa => 'Str', required => 1 );

has 'fh' => (

lib/Auth/Kokolores/Plugin/MemcachedConnection.pm  view on Meta::CPAN

extends 'Auth::Kokolores::Plugin';

use Auth::Kokolores::ConnectionPool;


has 'servers' => ( is => 'ro', isa => 'Str', default => '127.0.0.1:11211');
has 'namespace' => ( is => 'ro', isa => 'Str', default => 'auth-');
has 'handle' => ( is => 'rw', isa => 'Str', default => 'memcached' );

has _servers => (
  is => 'ro', isa => 'ArrayRef[Str]', lazy => 1,
  default => sub {
    return [ split( /\s*,\s*/, shift->servers ) ]; 
  },
);

has 'memcached' => (
  is => 'ro', isa => 'Cache::Memcached',
  lazy => 1,
  default => sub {
    my $self = shift;

lib/Auth/Kokolores/Protocol/DovecotAuth.pm  view on Meta::CPAN

  return;
}

sub shutdown_connection {
  my ( $self ) = @_;
  $self->last_auth_id(0);
  return:
}

has 'mechanisms' => (
  is => 'ro', isa => 'HashRef', lazy => 1,
  default => sub { {
    'LOGIN' => {
      parameters => [ 'plaintext '],
      handler => \&handle_login,
    },
    'PLAIN' => {
      parameters => [ 'plaintext '],
      handler => \&handle_plain,
    },
  } },

lib/Auth/Kokolores/Request.pm  view on Meta::CPAN


has 'fingerprint' => (
  is => 'ro', isa => 'Str', lazy => 1,
  default => sub {
    my $self = shift;
    return md5_base64( $self->username.':'.$self->password );
  },
);

has 'parameters' => (
  is => 'ro', isa => 'HashRef',
  default => sub { {} },
  traits => [ 'Hash' ],
  handles => {
    set_param => 'set',
    get_param => 'get',
  },
);


has 'server' => (
  is => 'ro',
  isa => 'Net::Server',
  required => 1,
  handles => {
    log => 'log',
  },
);


has 'userinfo' => (
  is => 'ro', isa => 'HashRef', lazy => 1,
  default => sub { {} },
  traits => [ 'Hash' ],
  handles => {
    get_info => 'get',
    set_info => 'set',
  },
);


1;



( run in 0.396 second using v1.01-cache-2.11-cpan-5f2e87ce722 )