NAME

Apache2::Controller::Auth::OpenID - OpenID base for Apache2::Controller::Dispatch

SYNOPSIS

# vhost.conf
<Perl>
   my $openid_cache = '/dev/shm/myapp_openid_cache';
   mkdir $openid_cache if !-d $openid_cache;
   chown $EUID, $EGID, $open_id_cache
       || die "failed to `chown $EUID $EGID $openid_cache`";
</Perl>

<Location /myapp>
    SetHandler modperl
    PerlOptions +SetupEnv
    PerlInitHandler MyApp::Dispatch
</Location>

# lib/MyApp/Dispatch:
package MyApp::Dispatch;

use base qw(
    Apache2::Controller::Dispatch
    Apache2::Controller::Session::Cookie
    Apache2::Controller::Auth::OpenID
);

our %dispatch_map = (
    foo        => 'MyApp::C::Foo',
    login      => 'MyApp::C::Login',  # 'login' url required
);

# implement the following methods in your dispatch class.

# get_openid_url(): get the openid_url of user.
# this example gets it out of a cookie, but you may have another
# mechanism, for instance, maybe you have it stashed in the
# session database store

sub get_openid_url {
    my ($self) = @_;
    my $cookies = $self->get_cookies();
    my $cookie_openid_url = $cookies->{'openid_url'};
    my $openid_url = $cookie_openid_url ? $cookie_openid_url->value : undef;
    return $openid_url;
}

# is_logged_in(): is the user logged in?

sub is_logged_in

1;

DESCRIPTION

Implements a verify_auth() method for Apache2::Controller::Dispatch that uses OpenID.

METHODS

verfiy_auth

verify_auth() implements the auth check for a module based on Apache2::Controller::Dispatch.

AUTHOR

Mark Hedges, <hedges at scriptdolphin.org>

COPYRIGHT & LICENSE

Copyright 2008 Mark Hedges, all rights reserved.

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