line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OpenID::Lite::RelyingParty::IDResHandler; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use Any::Moose; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
4
|
|
|
|
|
|
|
with 'OpenID::Lite::Role::ErrorHandler'; |
5
|
|
|
|
|
|
|
with 'OpenID::Lite::Role::AgentHandler'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
2502
|
use Params::Validate; |
|
1
|
|
|
|
|
26743
|
|
|
1
|
|
|
|
|
86
|
|
8
|
1
|
|
|
1
|
|
848
|
use OpenID::Lite::RelyingParty::CheckID::Result; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
11
|
|
9
|
1
|
|
|
1
|
|
949
|
use OpenID::Lite::RelyingParty::IDResHandler::Verifier; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use OpenID::Lite::Constants::ModeType qw(ID_RES SETUP_NEEDED CANCEL ERROR_MODE); |
11
|
|
|
|
|
|
|
use OpenID::Lite::Constants::CheckIDResponse qw(:all); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has 'store' => ( |
14
|
|
|
|
|
|
|
is => 'ro', |
15
|
|
|
|
|
|
|
does => 'OpenID::Lite::Role::Storable', |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub idres { |
19
|
|
|
|
|
|
|
my $self = shift; |
20
|
|
|
|
|
|
|
my %args = Params::Validate::validate( |
21
|
|
|
|
|
|
|
@_, |
22
|
|
|
|
|
|
|
{ current_url => 1, |
23
|
|
|
|
|
|
|
params => { |
24
|
|
|
|
|
|
|
isa => 'OpenID::Lite::Message', |
25
|
|
|
|
|
|
|
}, |
26
|
|
|
|
|
|
|
service => { |
27
|
|
|
|
|
|
|
isa => 'OpenID::Lite::RelyingParty::Discover::Service', |
28
|
|
|
|
|
|
|
optional => 1 |
29
|
|
|
|
|
|
|
}, |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my $params = $args{params}; |
34
|
|
|
|
|
|
|
my $service = $args{service}; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $mode = $params->get('mode'); |
37
|
|
|
|
|
|
|
if ( !$mode ) { |
38
|
|
|
|
|
|
|
return OpenID::Lite::RelyingParty::CheckID::Result->new( |
39
|
|
|
|
|
|
|
type => IS_NOT_OPENID, |
40
|
|
|
|
|
|
|
params => $params, |
41
|
|
|
|
|
|
|
message => sprintf(q{Unknown mode, "%s"}, $mode), |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
elsif ( $mode eq ID_RES ) { |
45
|
|
|
|
|
|
|
if ( $params->is_openid1 && $params->get('user_setup_url') ) { |
46
|
|
|
|
|
|
|
return OpenID::Lite::RelyingParty::CheckID::Result->new( |
47
|
|
|
|
|
|
|
type => IS_SETUP_NEEDED, |
48
|
|
|
|
|
|
|
params => $params, |
49
|
|
|
|
|
|
|
url => $params->get('user_setup_url'), |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
$args{agent} = $self->agent; |
53
|
|
|
|
|
|
|
$args{store} = $self->store if $self->store; |
54
|
|
|
|
|
|
|
my $verifier = OpenID::Lite::RelyingParty::IDResHandler::Verifier->new(%args); |
55
|
|
|
|
|
|
|
if ( $verifier->verify() ) { |
56
|
|
|
|
|
|
|
return OpenID::Lite::RelyingParty::CheckID::Result->new( |
57
|
|
|
|
|
|
|
type => IS_SUCCESS, |
58
|
|
|
|
|
|
|
params => $params, |
59
|
|
|
|
|
|
|
service => $verifier->service, |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
} else { |
62
|
|
|
|
|
|
|
return OpenID::Lite::RelyingParty::CheckID::Result->new( |
63
|
|
|
|
|
|
|
type => IS_INVALID, |
64
|
|
|
|
|
|
|
params => $params, |
65
|
|
|
|
|
|
|
message => $verifier->errstr, |
66
|
|
|
|
|
|
|
); |
67
|
|
|
|
|
|
|
}; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
elsif ( $mode eq SETUP_NEEDED ) { |
70
|
|
|
|
|
|
|
unless ( $params->is_openid1 ) { |
71
|
|
|
|
|
|
|
return OpenID::Lite::RelyingParty::CheckID::Result->new( |
72
|
|
|
|
|
|
|
type => IS_SETUP_NEEDED, |
73
|
|
|
|
|
|
|
params => $params, |
74
|
|
|
|
|
|
|
url => $params->get('user_setup_url') || '', |
75
|
|
|
|
|
|
|
); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
elsif ( $mode eq CANCEL ) { |
79
|
|
|
|
|
|
|
return OpenID::Lite::RelyingParty::CheckID::Result->new( |
80
|
|
|
|
|
|
|
type => IS_CANCELED, |
81
|
|
|
|
|
|
|
params => $params, |
82
|
|
|
|
|
|
|
); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
elsif ( $mode eq ERROR_MODE ) { |
85
|
|
|
|
|
|
|
my $error = $params->get('error') || ''; |
86
|
|
|
|
|
|
|
my $contact = $params->get('contact') || ''; |
87
|
|
|
|
|
|
|
my $reference = $params->get('reference') || ''; |
88
|
|
|
|
|
|
|
return OpenID::Lite::RelyingParty::CheckID::Result->new( |
89
|
|
|
|
|
|
|
type => IS_ERROR, |
90
|
|
|
|
|
|
|
message => $error, |
91
|
|
|
|
|
|
|
contact => $contact, |
92
|
|
|
|
|
|
|
reference => $reference, |
93
|
|
|
|
|
|
|
params => $params, |
94
|
|
|
|
|
|
|
); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
return OpenID::Lite::RelyingParty::CheckID::Result->new( |
97
|
|
|
|
|
|
|
type => IS_INVALID, |
98
|
|
|
|
|
|
|
params => $params, |
99
|
|
|
|
|
|
|
message => sprintf(q{Unknown mode, "%s"}, $mode), |
100
|
|
|
|
|
|
|
); |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
no Any::Moose; |
104
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
105
|
|
|
|
|
|
|
1; |
106
|
|
|
|
|
|
|
|