The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Auth::Sticky

Copyright (c)2005 Bryce Porter

LICENSE

Released under the terms of the General Public License

FUNCTIONS

new()

Creates a blessed self object reference

Takes a hashref of configuration parameters: use_prior_db: Optional previously defined DBI object reference use_prior_cgi: Optional previously defined CGI object reference dbtype: The type of database we will be connecting to (mysql, etc) NOTE: Must be supported by DBI dbname: The name of the database we are authenticating with dbuser: The www_user on that database that has SELECT,UPDATE,INSERT,DELETE privileges dbpass: The password for that user

Returns object reference on success; nothing on failure

has_auth()

Checks to see if www_user is currently authenticated and valid. Takes one optional argument of the SQL unique sequential auth number (as opposed to getting it from cookie) Returns 1 on success (true). Upon failure, returns nothing and sets $self->{ERRSTR}

get_auth_token()

Gets the authentication token from the client's cookie. Takes no arguments. Returns token number on success. Upon failure, returns nothing and sets $self->{ERRSTR}

is_valid_token()

Verifies that the given token is valid. Takes the token unique number as an argument. On success, sets $self->{token} to the token number (UID), and returns 1. Returns nothing on failure.

get_priv()

Gets the priveledge level from the www_users table associated with the given token. Takes no arguments. Returns priveledge level on success; sets $self->{ERRSTR} and returns nothing on failure.

set_auth()

This function sets up the www_auth table to say that our client is authorized. Takes user's unique SQL id as argument (see validate()). Returns a cookie on success; sets $self->{ERRSTR} and returns nothing on error.

unset_auth()

This method must be called to unset someone's login in the database, as well as trump the cookie on thier browser. Takes no arguments (automatically grabs the authentication token regarding the current session) Returns a trump cookie on success; sets $self->{ERRSTR} and returns nothing on failure.

validate()

This function validates a username and password. Takes a username and password as arguments. Returns user's unique SQL id on success; sets $self->{ERRSTR} and returns nothing on error.

Terminator()

This method must be called to properly shutdown all objects and do final cleanup. Takes no arguments. Returns 1 on success; sets $self->{ERRSTR} and returns nothing on failure.