Authen::PAAS::LoginModule - a pluggable authentication module


Authen-PAAS documentation Contained in the Authen-PAAS distribution.

Index


Code Index:

NAME

Top

Authen::PAAS::LoginModule - a pluggable authentication module

SYNOPSIS

Top

  use Authen::PAAS::LoginModule;

  my $result = $module->login($subject, \%callbacks);

DESCRIPTION

Top

This module provides the API for authenticating a subject for the purposes of session login. It will be subclassed to provide the implementations of different authentication schemes.

METHODS

Top

my $module = Authen::PAAS::LoginModule->new(flags => $flags, options => \%options);

Creates a new login modules. The flags parameter should be one of the keywords sufficient, requisite, required and optional. The options parameter is a hash reference containing sub-class specific configuration options.

$module->option($name, $default);

Retrieves the value of the configuration option identified by the $name parameter. If the named configuration option is not set, then the $default value is returned.

my $flags = $module->flags;

Retrieves the flags for the module, one of the keywords sufficient, requisite, required and optional.

my $res = $module->login($subject, $callbacks);

Attempt to login using authentication data obtained from the callbacks, if successful, adding principals and credentials to the subject. The $callbacks parameter is a hash reference, whose keys are the names of authentication tokes, and values are instances of th Authen::PAAS::Callback class. If successful, this method must return a true value, otherwise a false value. This method must be implemented by subclasses.

$module->logout($subject);

Attempt to logout a subject, by removing any principals anc credentials added during the login method. This method must be implemented by subclasses.

AUTHORS

Top

Daniel Berrange <dan@berrange.com>

COPYRIGHT

Top

SEE ALSO

Top

Authen::PAAS::Context, Authen::PAAS::Subject, Authen::PAAS::Callback.


Authen-PAAS documentation Contained in the Authen-PAAS distribution.
# -*- perl -*-
#
# Authen::PAAS::LoginModule by Daniel Berrange
#
# Copyright (C) 2004-2006 Dan Berrange
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# $Id: LoginModule.pm,v 1.1 2005/08/21 07:39:37 dan Exp $

package Authen::PAAS::LoginModule;

use warnings;
use strict;

our $VERSION = '1.0.0';


sub new {
    my $proto = shift;
    my $class = ref($proto) || $proto;
    my $self = {};
    my %params = @_;

    $self->{flags} = exists $params{flags} ? $params{flags} : die "flags parameter is required";
    $self->{options} = exists $params{options} ? $params{options} : {};

    bless $self, $class;

    return $self;
}


sub option {
    my $self = shift;
    my $name = shift;
    return exists $self->{options}->{$name} ? $self->{options}->{$name} : shift;
}


sub flags {
    my $self = shift;
    return $self->{flags};
}


sub login {
    my $self = shift;
    die "module " . ref($self) . " forgot to implement login";
}



sub logout {
    my $self = shift;
    die "module " . ref($self) . " forgot to implement logout";
}


1 # So that the require or use succeeds.

__END__