Michael Schout

NAME

Apache::AuthTicket::Base - Common methods for all Apache::AuthTicket versions.

VERSION

version 0.93

SYNOPSIS

 # This module is internal to Apache::AuthTicket.  you should never use this
 # module directly.

DESCRIPTION

This module is a base class providing common methods for Apache::AuthTicket and Apache2::AuthTicket.

METHODS

configure

 Apache2::AuthTicket->configure(AuthName =>
    TicketUserTable => 'users:user_name:pass',
    TicketLoginHandler => '/login',
    ...
 );

This sets configuration values for a given AuthName. This is an alternative to using PerlSetVar's to specify all of the configuration settings.

parse_ticket

 my $ok = $self->parse_ticket($ticket_string)

Verify the ticket string. If the ticket is invalid or tampered, the AuthTicketReason subprocess_env setting will be set to one of the following:

  • malformed_ticket

    Ticket does not contain the required fields

  • invalid_hash

    Ticket hash is not found in the database

  • expired_ticket

    Ticket has expired

  • missing_secret

    Secret that signed this ticket was not found

  • idle_timeout

    Ticket idle timeout exceeded

  • tampered_hash

    Ticket has been tampered with. The checksum does not match the checksum in the ticket

sql

Get the SQL::Abstract object.

get_config

 my $value = $self->get_config($name)

Get a configuration value, or its default value if the setting is not configured.

make_login_screen

 my $result = $self->make_login_screen($r, $action, $destination)

Print out the login screen html, and return an Apache status code.

dbh

Get the database handle

dbi_connect

 my $dbh = $self->dbi_connect

Returns a new connection to the database

check_credentials

 my $ok = $self->check_credentials($username, $password)

Return true if the credentials are valid

fetch_secret

 my ($value, $version) = $self->fetch_secret;
 my ($value) = $self->fetch_secret($version)

Return the secret and version of the secret. if the version argument is present, return that specific version of the secret instead of the most recent one.

secret_version

Returns the version of the current (most-recent) secret

make_ticket

 my $string = $self->make_ticket($username)

Creates a ticket string for the given username

serialize_ticket

 my $data = $self->serialize_ticket($hashref)

Encode the hashref in a format suitable for sending in a HTTP cookie

unserialize_ticket

 my $hashref = $self->unserialize_ticket($data)

Decode cookie data into hashref. This is the opposite of serialize_ticket()

new_ticket_for

 my $hashref = $self->new_ticket_for($username)

Creates new ticket hashref for the given username. You could overload this to append extra fields to the ticket.

delete_ticket

 $self->delete_ticket($r)

Invalidates the ticket by expiring the cookie and deletes the hash from the database

save_hash

 $self->save_hash($hash)

save the hash value/checksum in the database

delete_hash

 $self->delete_hash($hash)

Remove the given hash from the database.

is_hash_valid

 my $ok = $self->is_hash_valid($hash)

Return true if the given hash is in the local database

hash_for

 my $hash = $self->hash_for(@values)

Compute a hash for the given values

user_agent

 my $agent = $self->user_agent

Get the request client's user agent string

compare_password

 my $ok = $self->compare_password($style, $entered, $actual)

Check a password and return true if entered matches actual. style specifys what type of password is in actual, and is one of the following:

  • crypt

    standard UNIX crypt() value

  • cleartext

    plain text password

  • md5

    MD5 hash of password

str_config_value

 my $val = $self->str_config_value($name)

Get a configuration value. This converts things like yes,on,true to 1, and no,off,false to 0. Multiple name values may be given and the first defined value will be returned. If no config value is defined matching any of the given name's, then undef is returned.

ticket_table

 my ($name, $hash_col, $timestamp_col) = $self->ticket_table

Unpacks the config value TicketTable into its components.

user_table

 my ($name, $hash_col, $timestamp_col) = $self->ticket_table

Unpacks the config value TicketUserTable into its components.

secret_table

 my ($name, $hash_col, $timestamp_col) = $self->ticket_table

Unpacks the config value TicketSecretTable into its components.

push_handler

 $class->push_handler($name => sub { ... });

Subclass Must Implement This. Push the given subroutine as a mod_perl handler

set_user

 $self->set_user($username)

Subclass Must Implement This. Set the username for this request.

apache_const

 my $const = $self->apache_const($name)

Subclass Must Implement This. Return the given apache constant.

SOURCE

The development version is on github at http://github.com/mschout/apache-authticket and may be cloned from git://github.com/mschout/apache-authticket.git

BUGS

Please report any bugs or feature requests to bug-apache-authticket@rt.cpan.org or through the web interface at: http://rt.cpan.org/Public/Dist/Display.html?Name=Apache-AuthTicket

AUTHOR

Michael Schout <mschout@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2000 by Michael Schout.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.