| Authen-Simple documentation | Contained in the Authen-Simple distribution. |
Authen::Simple - Simple Authentication
use Authen::Simple;
use Authen::Simple::Kerberos;
use Authen::Simple::SMB;
my $simple = Authen::Simple->new(
Authen::Simple::Kerberos->new( realm => 'REALM.COMPANY.COM' ),
Authen::Simple::SMB->new( domain => 'DOMAIN', pdc => 'PDC' )
);
if ( $simple->authenticate( $username, $password ) ) {
# successfull authentication
}
Simple and consistent framework for authentication.
This method takes an array of Authen::Simple adapters. Required.
Returns true on success and false on failure.
Christian Hansen ch@ngmedia.com
This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
| Authen-Simple documentation | Contained in the Authen-Simple distribution. |
package Authen::Simple; use strict; use warnings; use Params::Validate qw[]; our $VERSION = 0.4; sub new { my $class = shift; my %adapter = ( isa => 'Authen::Simple::Adapter', type => Params::Validate::OBJECT, optional => 1 ); my @spec = ( { %adapter, optional => 0 }, ( \%adapter ) x @_ ); my $adapters = Params::Validate::validate_pos( @_, @spec ); return bless( $adapters, $class ); } sub authenticate { my ( $self, $username, $password ) = @_; foreach ( $username, $password ) { return 0 unless defined($_) && !ref($_) && length($_); } foreach my $adapter ( @{$self} ) { return 1 if $adapter->authenticate( $username, $password ); } return 0; } 1; __END__