Catalyst-Plugin-Authentication-Credential-GooglePlus

 view release on metacpan or  search on metacpan

lib/Catalyst/Plugin/Authentication/Credential/GooglePlus.pm  view on Meta::CPAN

=item $authinfo

Optional, authentication info that can contain the token.  If not given, the
token is retrieved from GET or POST parameters.

=back

=head3 RETURNS

User found by calling L<Catalyst::Authentication::Realm/find_user> with the
decoded token's information, if any.

=cut

sub authenticate {
    my ($self, $c, $realm, $authinfo) = @_;

    my $field = $self->{token_field};

    if (my $cache = $self->get_cache($c)) {
        $self->{cache} ||= $cache;

lib/Catalyst/Plugin/Authentication/Credential/GooglePlus.pm  view on Meta::CPAN

            correct? Token was ' . $id_token
        );
    }

    return $realm->find_user($userinfo, $c);
}

=head2 retrieve_certs

Retrieves a pair of JSON-encoded certificates from the given $url (defaults to
Google's public cert url), and returns the decoded JSON object.

If a cache plugin is loaded, the certificate pair is cached; however one of the
certificates is expired, a new pair is fetched from $url.

=head3 ARGUMENTS

=over

=item url

lib/Catalyst/Plugin/Authentication/Credential/GooglePlus.pm  view on Meta::CPAN

sub is_cert_expired {
    my ($self, $x509) = @_;

    my $expiry = str2time($x509->notAfter);

    return time > $expiry;
}

=head2 decode

Returns the decoded information contained in a user's token.

=head3 ARGUMENTS

=over

=item $token

Required. The user's token from Google+.

=item $certs



( run in 0.347 second using v1.01-cache-2.11-cpan-26ccb49234f )