| 1 | package Net::Google::FederatedLogin::Gmail::Discoverer; | ||
| 2 | { | ||
| 3 | 2 | $Net::Google::FederatedLogin::Gmail::Discoverer::VERSION = '0.8.0'; | |
| 4 | } | ||
| 5 | # ABSTRACT: Find the OpenID endpoint for standard gmail accounts | ||
| 6 | |||
| 7 | 2 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 2 | with 'Net::Google::FederatedLogin::Role::Discoverer'; | |
| 10 | |||
| 11 | 2 | my $DISCOVERY_URL = 'https://www.google.com/accounts/o8/id'; | |
| 12 | |||
| 13 | |||
| 14 | 2 | ▶ | sub perform_discovery { |
|
Subroutine
perform_discovery: called CC=1 SCAR=0.8
Pod
documented
| |||
| 15 | 2 | my $self = shift; | |
| 16 | |||
| 17 | 2 | my $ua = $self->ua; | |
| 18 | 2 | my $response = $ua->get($DISCOVERY_URL, | |
| 19 | Accept => 'application/xrds+xml'); | ||
| 20 | |||
| 21 | 2 | my $open_id_endpoint; | |
| 22 | |||
| 23 | 2 | require XML::Twig; | |
| 24 | my $xt = XML::Twig->new( | ||
| 25 | 0 | ▶ | twig_handlers => { URI => sub {$open_id_endpoint = $_->text}}, |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 26 | 0 | ); | |
| 27 | 0 | $xt->parse($response->decoded_content); | |
| 28 | |||
| 29 | 0 | return $open_id_endpoint; | |
| 30 | } | ||
| 31 | |||
| 32 | 2 | ▶ | no Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 33 | 2 | __PACKAGE__->meta->make_immutable; | |
| 34 | 2 | 1; | |
| 35 | |||
| 36 | __END__ | ||