NAME

WeBWorK::Authen - Check user identity, manage session keys.

SYNOPSIS

# get the name of the appropriate Authen class, based on the %authen hash in $ce
my $class_name = WeBWorK::Authen::class($ce, "user_module");

# load that class
require $class_name;

# create an authen object
my $authen = $class_name->new($c);

# verify credentials
$authen->verify or die "Authentication failed";

# verification status is stored for quick retrieval later
my $auth_ok = $authen->was_verified;

# for some reason, you might want to clear that cache
$authen->forget_verification;

DESCRIPTION

WeBWorK::Authen is the base class for all WeBWorK authentication classes. It provides default authentication behavior which can be selectively overridden in subclasses.

FACTORY

class($ce, $type)

This subroutine consults the given WeBWorK::CourseEnvironment object to determine which WeBWorK::Authen subclass should be used. $type can be any key given in the %authen hash in the course environment. If the type is not found in the %authen hash, an exception is thrown.

CONSTRUCTOR

new($c)

Instantiates a new WeBWorK::Authen object for the given WeBWorK::Controller ($c).

METHODS

was_verified()

Returns true if verify() returned true the last time it was called.

forget_verification()

Future calls to was_verified() will return false, until verify() is called again and succeeds.