line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OpenID::Lite::Provider::Discover; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
10
|
use Any::Moose; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
12
|
|
4
|
2
|
|
|
2
|
|
2027
|
use OpenID::Lite::Provider::Discover::Parser; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use OpenID::Lite::RelyingParty::Discover::Fetcher::Yadis; |
6
|
|
|
|
|
|
|
with 'OpenID::Lite::Role::AgentHandler'; |
7
|
|
|
|
|
|
|
with 'OpenID::Lite::Role::ErrorHandler'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has '_fetcher' => ( |
10
|
|
|
|
|
|
|
is => 'ro', |
11
|
|
|
|
|
|
|
lazy_build => 1, |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has '_parser' => ( |
15
|
|
|
|
|
|
|
is => 'ro', |
16
|
|
|
|
|
|
|
lazy_build => 1, |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub discover { |
20
|
|
|
|
|
|
|
my ( $self, $rp_realm_url, $not_allow_redirection ) = @_; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my $result = $self->_fetcher->fetch($rp_realm_url) |
23
|
|
|
|
|
|
|
or return $self->ERROR( $self->_fetcher->errstr ); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# when discovery is carried out for validating realm, |
26
|
|
|
|
|
|
|
# must not allow redirection. |
27
|
|
|
|
|
|
|
return $self->ERROR(q{redirected.}) |
28
|
|
|
|
|
|
|
if ( $not_allow_redirection && $rp_realm_url ne $result->final_url ); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $return_to_urls = $self->_parser->parse($result) |
31
|
|
|
|
|
|
|
or return $self->ERROR( $self->_parser->errstr ); |
32
|
|
|
|
|
|
|
return $return_to_urls; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub _build__fetcher { |
37
|
|
|
|
|
|
|
my $self = shift; |
38
|
|
|
|
|
|
|
my $fetcher = OpenID::Lite::RelyingParty::Discover::Fetcher::Yadis->new( |
39
|
|
|
|
|
|
|
agent => $self->agent ); |
40
|
|
|
|
|
|
|
return $fetcher; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub _build__parser { |
44
|
|
|
|
|
|
|
my $self = shift; |
45
|
|
|
|
|
|
|
my $parser = OpenID::Lite::Provider::Discover::Parser->new; |
46
|
|
|
|
|
|
|
return $parser; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
no Any::Moose; |
50
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|