Author image Benjamin Trott
and 1 contributors

NAME

Authen::TypeKey - TypeKey authentication verification

SYNOPSIS

    use CGI;
    use Authen::TypeKey;
    my $q = CGI->new;
    my $tk = Authen::TypeKey->new;
    my $res = $tk->verify($q) or die $tk->errstr;

DESCRIPTION

Authen::TypeKey is an implementation of verification for signatures generated by TypeKey authentication. For information on the TypeKey protocol and using TypeKey in other applications, see http://www.movabletype.org/docs/tk-apps.html.

USAGE

Authen::TypeKey->new

Create a new Authen::TypeKey object.

$tk->verify($query)

Verify a TypeKey signature based on the other parameters given. The signature and other parameters are found in the $query object, which should be any object that supports a param method--for example, a CGI or Apache::Request object.

If the signature is successfully verified, verify returns a reference to a hash containing the following values.

  • name

    The unique username of the TypeKey user.

  • nick

    The user's display name.

  • email

    The user's email address. If the user has chosen not to pass his/her email address, this will contain the SHA-1 hash of the string mailto:<email>.

  • ts

    The timestamp at which the signature was generated, expressed as seconds since the epoch.

If verification is unsuccessful, verify will return undef, and the error message can be found in $tk->errstr.

$tk->key_cache([ $cache_file ])

Get/set the path to a local file where the TypeKey public key (at $tk->key_url) should be cached/mirrored. If this is unset, the key is not cached. By default, this is set to the empty string.

$tk->skip_expiry_check([ $boolean ])

Get/set a value indicating whether verify should check the expiration date and time in the TypeKey parameters. The default is to check the expiration date and time.

$tk->expires([ $secs ])

Get/set the amount of time at which a TypeKey signature is intended to expire. The default value is 600 seconds, i.e. 10 minutes.

$tk->key_url([ $url ])

Get/set the URL from which the TypeKey public key can be obtained. The default URL is http://www.typekey.com/extras/regkeys.txt.

LICENSE

Authen::TypeKey is free software; you may redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR & COPYRIGHT

Except where otherwise noted, Authen::TypeKey is Copyright 2004 Six Apart Ltd, cpan@sixapart.com. All rights reserved.