NAME

CGI::Auth::FOAF_SSL - Authentication using FOAF+SSL.

VERSION

0.01

SYNOPSIS

use CGI qw(:all);
use CGI::Auth::FOAF_SSL;

my $cgi    = CGI->new;
my $person = CGI::Auth::FOAF_SSL->new_from_cgi($cgi);

print header("text/html");

if (defined $person && $person->is_secure)
{
	printf("<p>Hello <a href='%s'>%s</a>! You are logged on with FOAF+SSL.</p>\n",
		escapeHTML($person->homepage),
		escapeHTML($person->name));
}
else
{
	print "<p>Greetings stranger. You are unknown in these parts.</p>\n";
}

DESCRIPTION

FOAF+SSL is a simple authentication scheme described at http://esw.w3.org/topic/foaf+ssl. This module provides FOAF+SSL authentication for CGI scripts.

This requires the web server to be using HTTPS and to be configured to request client certificates. If you are using Apache, this means that you want to set the "SSLVerifyClient" directive to "require".

CONSTRUCTORS

$person = CGI::Auth::FOAF_SSL->new($pem_encoded);

Performs FOAF+SSL authentication on a PEM-encoded key. If authentication is completely unsuccessful, returns undef. Otherwise, returns a CGI::Auth::FOAF_SSL object. Use is_secure to check if authentication was completely successful.

You probably want to use new_from_cgi instead.

$person = CGI::Auth::FOAF_SSL->new_from_cgi($cgi_object);

Performs FOAF+SSL authentication on a CGI object. This is a wrapper around new which extracts the PEM-encoded client certificate from the CGI request. It has the same return values as new.

PUBLIC METHODS

$person->is_secure;

Returns true iff the authentication process was completely successful.

$person->identity;

Returns an identifying URI for the agent (person, organisation, robot) making the authenticated HTTP request. This URI is a URI in the RDF sense of the word. It is not their homepage.

$person->redland;

Returns an RDF::Redland::Model which should contain some data about the agent making the authenticated HTTP request.

$person->name;

Returns the name of the agent making the authenticated HTTP request. That is, if the agent is a person, this will tell you what the person's name is.

Returns undef if unable to determine the name.

$person->homepage;

Returns the homepage of the agent making the authenticated HTTP request.

Returns undef if unable to determine the homepage.

SEE ALSO

CGI

http://esw.w3.org/topic/foaf+ssl

AUTHOR

Toby Inkster, <mail@tobyinkster.co.uk>

COPYRIGHT AND LICENSE

Copyright (C) 2009 by Toby Inkster

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.