NAME

Net::Google::FederatedLogin - Google Federated Login module - see http://code.google.com/apis/accounts/docs/OpenID.html

VERSION

version 0.8.0

SYNOPSIS

Sending user to be authenticated:

my $claimed = 'example@gmail.com';
# or, where example.com is a Google Apps domain
# 'example.com' (bare domain)
# or 'user@example.com' (email address)
# or 'http://example.com/openid?id=[id]' (already known id)

my $g = Net::Google::FederatedLogin->new(claimed_id => $claimed, return_to => 'https://example.com/auth');
my $auth_url = $g->get_auth_url();

Verifying the user was correctly authenticated:

my $g = Net::Google::FederatedLogin->new(cgi => $cgi, return_to => 'https://example.com/auth');
my $id = $g->verify_auth();
# $id is the verified identity, or false if it wasn't verified (eg by the user handcrafting the url, or disallowing access)

ATTRIBUTES

claimed_id

Required for "get_auth_url": The email address, or an OpenID URL of the identity to be checked.

realm

Optional field that is used to populate the openid.realm parameter. If not provided the parameter will not be used (as opposed to being calculated from the "return_to"" value).

ua

The useragent internally used for communications that the module needs to do. If not provided, a new LWP::UserAgent will be instantiated.

return_to

Required for "get_auth_url" and "verify_auth": The URL the user should be returned to after verifying their identity.

cgi

Required for "verify_auth": A CGI-like object (same param() method behaviour) that is used to access the parameters that assert the identity has been verified. May optionally be replaced by "cgi_params".

cgi_params

Required for "verify_auth" unless "cgi" is supplied: A hashref containing the cgi parameters for verifying the identity.

extensions

Hashref of Net::Google::FederatedLogin::Extension objects (keyed off the extension type URI).

METHODS

get_auth_url

Gets the URL to send the user to where they can verify their identity.

get_openid_endpoint

Gets the unadorned OpenID authentication URL (like "get_auth_url", but doesn't contain values specific to this request (return_to, mode etc))

verify_auth

Checks if the user has been validated based on the parameters in the "cgi" object, and checks that these parameters do come from the correct OpenID provider (rather than having been hand-crafted to appear to validate the identity). If the id is successfully verified, it is returned (otherwise a false value is returned).

get_extension

Retrieve a single Net::Google::FederatedLogin::Extension object, based on the type URI provided. This method is most likely to be useful for handling the response to an OpenID request.

set_extension

Save an extension into the list of extensions for this login object

AUTHOR

Glenn Fowler <cebjyre@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Glenn Fowler.

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