Authen-Simple-Net-0.2/0040755000076500007650000000000010356745477014432 5ustar chansenchansenAuthen-Simple-Net-0.2/Build.PL0100644000076500007650000000114410356745304015710 0ustar chansenchansenuse strict; use Module::Build; my $build = Module::Build->new( license => 'perl', module_name => 'Authen::Simple::Net', dist_name => 'Authen-Simple-Net', dist_version => 0.2, dist_author => 'Christian Hansen ', dist_abstract => 'libnet Authen::Simple adapters', requires => { 'Authen::Simple' => 0, 'Net::FTP' => 0, 'Net::POP3' => 0, 'Net::SMTP' => 0 }, create_makefile_pl => 'traditional', create_readme => 1 ); $build->create_build_script; Authen-Simple-Net-0.2/Changes0100644000076500007650000000022110356726472015707 0ustar chansenchansenRevision history for Perl extension Authen::Simple::Net 0.02 2006-01-04 00:00 - fixed pod errors 0.01 2006-01-03 00:00 - first release Authen-Simple-Net-0.2/lib/0040755000076500007650000000000010356745476015177 5ustar chansenchansenAuthen-Simple-Net-0.2/lib/Authen/0040755000076500007650000000000010356745476016423 5ustar chansenchansenAuthen-Simple-Net-0.2/lib/Authen/Simple/0040755000076500007650000000000010356745476017654 5ustar chansenchansenAuthen-Simple-Net-0.2/lib/Authen/Simple/FTP.pm0100644000076500007650000000571110356744236020635 0ustar chansenchansenpackage Authen::Simple::FTP; use strict; use warnings; use base 'Authen::Simple::Adapter'; use Net::FTP; use Params::Validate qw[]; our $VERSION = 0.2; __PACKAGE__->options({ host => { type => Params::Validate::SCALAR, default => 'localhost', optional => 1 }, port => { type => Params::Validate::SCALAR, default => 21, optional => 1 }, timeout => { type => Params::Validate::SCALAR, default => 60, optional => 1 } }); sub check { my ( $self, $username, $password ) = @_; my $connection = Net::FTP->new( Host => $self->host, Port => $self->port, Timeout => $self->timeout ); unless ( defined $connection ) { my $host = $self->host; my $reason = $@ || $! || 'Unknown reason'; $self->log->error( qq/Failed to connect to '$host'. Reason: '$reason'/ ) if $self->log; return 0; } unless ( $connection->login( $username, $password ) ) { chomp( my $message = $connection->message || 'Unknown reason' ); $self->log->debug( qq/Failed to authenticate user '$username'. Reason: '$message'/ ) if $self->log; return 0; } $self->log->debug( qq/Successfully authenticated user '$username'./ ) if $self->log; return 1; } 1; __END__ =head1 NAME Authen::Simple::FTP - Simple FTP authentication =head1 SYNOPSIS use Authen::Simple::FTP; my $ftp = Authen::Simple::FTP->new( host => 'ftp.company.com' ); if ( $ftp->authenticate( $username, $password ) ) { # successfull authentication } # or as a mod_perl Authen handler PerlModule Authen::Simple::Apache PerlModule Authen::Simple::FTP PerlSetVar AuthenSimpleFTP_host "ftp.company.com" PerlAuthenHandler Authen::Simple::FTP AuthType Basic AuthName "Protected Area" Require valid-user =head1 DESCRIPTION Authenticate against a FTP service. =head1 METHODS =over 4 =item * new This method takes a hash of parameters. The following options are valid: =over 8 =item * host Connection host, can be a hostname or IP number. Defaults to C. host => 'ftp.company.com' host => '10.0.0.1' =item * port Connection port, default to C<21>. port => 21 =item * timeout Connection timeout, defaults to 60. timeout => 60 =item * log Any object that supports C, C, C and C. log => Log::Log4perl->get_logger('Authen::Simple::FTP') =back =item * authenticate( $username, $password ) Returns true on success and false on failure. =back =head1 SEE ALSO L. L. =head1 AUTHOR Christian Hansen C =head1 COPYRIGHT This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself. =cut Authen-Simple-Net-0.2/lib/Authen/Simple/POP3.pm0100644000076500007650000000723610356744242020726 0ustar chansenchansenpackage Authen::Simple::POP3; use strict; use warnings; use base 'Authen::Simple::Adapter'; use Net::POP3; use Params::Validate qw[]; our $VERSION = 0.2; __PACKAGE__->options({ host => { type => Params::Validate::SCALAR, default => 'localhost', optional => 1 }, port => { type => Params::Validate::SCALAR, default => 110, optional => 1 }, timeout => { type => Params::Validate::SCALAR, default => 60, optional => 1 }, method => { type => Params::Validate::SCALAR, default => 'plain', optional => 1, callbacks => { 'valid option' => sub { $_[0] =~ /^apop|plain|sasl$/; } } } }); sub check { my ( $self, $username, $password ) = @_; my $connection = Net::POP3->new( Host => $self->host, Port => $self->port, Timeout => $self->timeout ); unless ( defined $connection ) { my $host = $self->host; my $reason = $@ || $! || 'Unknown reason'; $self->log->error( qq/Failed to connect to '$host'. Reason: '$reason'/ ) if $self->log; return 0; } my $success = 0; if ( $self->method eq 'plain' ) { $success++ if $connection->login( $username, $password ); } if ( $self->method eq 'sasl' ) { $success++ if $connection->auth( $username, $password ); } if ( $self->method eq 'apop' ) { $success++ if $connection->apop( $username, $password ); } unless ( $success ) { chomp( my $message = $connection->message || 'Unknown reason' ); $self->log->debug( qq/Failed to authenticate user '$username'. Reason: '$message'/ ) if $self->log; return 0; } $self->log->debug( qq/Successfully authenticated user '$username'./ ) if $self->log; return 1; } 1; __END__ =head1 NAME Authen::Simple::POP3 - Simple POP3 authentication =head1 SYNOPSIS use Authen::Simple::POP3; my $pop3 = Authen::Simple::POP3->new( host => 'pop3.company.com' ); if ( $pop3->authenticate( $username, $password ) ) { # successfull authentication } # or as a mod_perl Authen handler PerlModule Authen::Simple::Apache PerlModule Authen::Simple::POP3 PerlSetVar AuthenSimplePOP3_host "pop3.company.com" PerlAuthenHandler Authen::Simple::POP3 AuthType Basic AuthName "Protected Area" Require valid-user =head1 DESCRIPTION Authenticate against a POP3 service. =head1 METHODS =over 4 =item * new This method takes a hash of parameters. The following options are valid: =over 8 =item * host Connection host, can be a hostname or IP number. Defaults to C. host => 'ftp.company.com' host => '10.0.0.1' =item * port Connection port, defaults to C<110>. port => 110 =item * timeout Connection timeout, defaults to 60. timeout => 60 =item * method Authentication method, defaults to C. Valid options are C, C, C. method => 'plain' =item * log Any object that supports C, C, C and C. log => Log::Log4perl->get_logger('Authen::Simple::POP3') =back =item * authenticate( $username, $password ) Returns true on success and false on failure. =back =head1 SEE ALSO L. L. =head1 AUTHOR Christian Hansen C =head1 COPYRIGHT This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself. =cut Authen-Simple-Net-0.2/lib/Authen/Simple/SMTP.pm0100644000076500007650000000572010356744250020763 0ustar chansenchansenpackage Authen::Simple::SMTP; use strict; use warnings; use base 'Authen::Simple::Adapter'; use Net::SMTP; use Params::Validate qw[]; our $VERSION = 0.2; __PACKAGE__->options({ host => { type => Params::Validate::SCALAR, default => 'localhost', optional => 1 }, port => { type => Params::Validate::SCALAR, default => 25, optional => 1 }, timeout => { type => Params::Validate::SCALAR, default => 60, optional => 1 } }); sub check { my ( $self, $username, $password ) = @_; my $connection = Net::SMTP->new( Host => $self->host, Port => $self->port, Timeout => $self->timeout ); unless ( defined $connection ) { my $host = $self->host; my $reason = $@ || $! || 'Unknown reason'; $self->log->error( qq/Failed to connect to '$host'. Reason: '$reason'/ ) if $self->log; return 0; } unless ( $connection->auth( $username, $password ) ) { chomp( my $message = $connection->message || 'Unknown reason' ); $self->log->debug( qq/Failed to authenticate user '$username'. Reason: '$message'/ ) if $self->log; return 0; } $self->log->debug( qq/Successfully authenticated user '$username'./ ) if $self->log; return 1; } 1; __END__ =head1 NAME Authen::Simple::SMTP - Simple SMTP authentication =head1 SYNOPSIS use Authen::Simple::SMTP; my $smtp = Authen::Simple::FTP->new( host => 'smtp.company.com' ); if ( $smtp->authenticate( $username, $password ) ) { # successfull authentication } # or as a mod_perl Authen handler PerlModule Authen::Simple::Apache PerlModule Authen::Simple::SMTP PerlSetVar AuthenSimpleSMTP_host "smtp.company.com" PerlAuthenHandler Authen::Simple::SMTP AuthType Basic AuthName "Protected Area" Require valid-user =head1 DESCRIPTION Authenticate against a SMTP service. =head1 METHODS =over 4 =item * new This method takes a hash of parameters. The following options are valid: =over 8 =item * host Connection host, can be a hostname or IP number. Defaults to C. host => 'ftp.company.com' host => '10.0.0.1' =item * port Connection port, default to C<25>. port => 25 =item * timeout Connection timeout, defaults to 60. timeout => 60 =item * log Any object that supports C, C, C and C. log => Log::Log4perl->get_logger('Authen::Simple::SMTP') =back =item * authenticate( $username, $password ) Returns true on success and false on failure. =back =head1 SEE ALSO L. L. =head1 AUTHOR Christian Hansen C =head1 COPYRIGHT This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself. =cut Authen-Simple-Net-0.2/Makefile.PL0100644000076500007650000000077510356745355016405 0ustar chansenchansen# Note: this file was auto-generated by Module::Build::Compat version 0.03 use ExtUtils::MakeMaker; WriteMakefile ( 'NAME' => 'Authen::Simple::Net', 'VERSION' => '0.2', 'PREREQ_PM' => { 'Authen::Simple' => '0', 'Net::FTP' => '0', 'Net::POP3' => '0', 'Net::SMTP' => '0' }, 'INSTALLDIRS' => 'site', 'PL_FILES' => {} ) ; Authen-Simple-Net-0.2/MANIFEST0100644000076500007650000000027610356745337015560 0ustar chansenchansenBuild.PL Changes lib/Authen/Simple/FTP.pm lib/Authen/Simple/POP3.pm lib/Authen/Simple/SMTP.pm Makefile.PL MANIFEST This list of files META.yml README t/01use.t t/02pod.t t/03podcoverage.t Authen-Simple-Net-0.2/META.yml0100644000076500007650000000067110356745477015704 0ustar chansenchansen# http://module-build.sourceforge.net/META-spec.html #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# name: Authen-Simple-Net version: 0.2 version_from: installdirs: site requires: Authen::Simple: 0 Net::FTP: 0 Net::POP3: 0 Net::SMTP: 0 distribution_type: module generated_by: ExtUtils::MakeMaker version 6.30 Authen-Simple-Net-0.2/README0100644000076500007650000000000010356612735015263 0ustar chansenchansenAuthen-Simple-Net-0.2/t/0040755000076500007650000000000010356745476014674 5ustar chansenchansenAuthen-Simple-Net-0.2/t/01use.t0100644000076500007650000000017410356547074016007 0ustar chansenchansenuse Test::More tests => 3; use_ok('Authen::Simple::FTP'); use_ok('Authen::Simple::POP3'); use_ok('Authen::Simple::SMTP'); Authen-Simple-Net-0.2/t/02pod.t0100644000076500007650000000027610356546747016007 0ustar chansenchansenuse Test::More; eval "use Test::Pod 1.14"; plan skip_all => 'Test::Pod 1.14 required' if $@; plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD}; all_pod_files_ok(); Authen-Simple-Net-0.2/t/03podcoverage.t0100644000076500007650000000036510356546747017523 0ustar chansenchansenuse Test::More; eval "use Test::Pod::Coverage 1.04"; plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@; plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD}; all_pod_coverage_ok( { trustme => [ qr/^check$/ ] } );