line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OpenID::Lite::RelyingParty::CheckID::Request; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use Any::Moose; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
4
|
1
|
|
|
1
|
|
510
|
use URI; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
5
|
1
|
|
|
1
|
|
33
|
use OpenID::Lite::Message; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
6
|
1
|
|
|
1
|
|
33
|
use OpenID::Lite::Constants::Namespace qw(SPEC_2_0 IDENTIFIER_SELECT); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
78
|
|
7
|
1
|
|
|
1
|
|
5
|
use OpenID::Lite::Constants::ModeType qw(CHECKID_SETUP CHECKID_IMMEDIATE); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
56
|
|
8
|
1
|
|
|
1
|
|
6
|
use OpenID::Lite::Nonce; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has 'anonymous' => ( |
11
|
|
|
|
|
|
|
is => 'rw', |
12
|
|
|
|
|
|
|
isa => 'Bool', |
13
|
|
|
|
|
|
|
default => 0, |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has 'service' => ( |
17
|
|
|
|
|
|
|
is => 'ro', |
18
|
|
|
|
|
|
|
isa => 'OpenID::Lite::RelyingParty::Discover::Service', |
19
|
|
|
|
|
|
|
required => 1, |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has 'association' => ( |
23
|
|
|
|
|
|
|
is => 'ro', |
24
|
|
|
|
|
|
|
isa => 'OpenID::Lite::Association', |
25
|
|
|
|
|
|
|
predicate => 'has_association', |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has '_params' => ( |
29
|
|
|
|
|
|
|
is => 'ro', |
30
|
|
|
|
|
|
|
lazy_build => 1, |
31
|
|
|
|
|
|
|
handles => { |
32
|
|
|
|
|
|
|
_set_param => 'set', |
33
|
|
|
|
|
|
|
_get_param => 'get', |
34
|
|
|
|
|
|
|
}, |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub add_extension { |
38
|
0
|
|
|
0
|
0
|
|
my ( $self, $extension ) = @_; |
39
|
|
|
|
|
|
|
# XXX: check service endpoint includes proper Type element for indicated |
40
|
|
|
|
|
|
|
# extension. |
41
|
|
|
|
|
|
|
# if ( $self->service->can_handle_extension($extension) ) { |
42
|
0
|
|
|
|
|
|
$extension->append_to_params($self->_params); |
43
|
|
|
|
|
|
|
# } |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub redirect_url { |
47
|
0
|
|
|
0
|
0
|
|
my ( $self, %args ) = @_; |
48
|
0
|
|
|
|
|
|
$self->gen_params(%args); |
49
|
0
|
|
|
|
|
|
my $url = $self->_params->to_url( $self->service->url ); |
50
|
0
|
|
|
|
|
|
return $url; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub gen_params { |
54
|
0
|
|
|
0
|
0
|
|
my ( $self, %args ) = @_; |
55
|
|
|
|
|
|
|
|
56
|
0
|
0
|
|
|
|
|
my $mode |
57
|
|
|
|
|
|
|
= $args{immediate} |
58
|
|
|
|
|
|
|
? CHECKID_IMMEDIATE |
59
|
|
|
|
|
|
|
: CHECKID_SETUP; |
60
|
0
|
|
|
|
|
|
$self->_set_param( mode => $mode ); |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
my $realm = $args{realm}; |
63
|
0
|
0
|
|
|
|
|
my $realm_key |
64
|
|
|
|
|
|
|
= $self->service->requires_compatibility_mode |
65
|
|
|
|
|
|
|
? 'trust_root' |
66
|
|
|
|
|
|
|
: 'realm'; |
67
|
0
|
|
|
|
|
|
$self->_set_param( $realm_key, $realm ); |
68
|
|
|
|
|
|
|
|
69
|
0
|
0
|
|
|
|
|
if ( exists $args{return_to} ) { |
70
|
0
|
|
|
|
|
|
my $return_to = URI->new( $args{return_to} ); |
71
|
0
|
0
|
|
|
|
|
if ( $self->service->requires_compatibility_mode ) { |
72
|
0
|
|
|
|
|
|
$return_to->query_form( |
73
|
|
|
|
|
|
|
rp_nonce => OpenID::Lite::Nonce->gen_nonce(), |
74
|
|
|
|
|
|
|
openid1_claimed_id => $self->service->claimed_identifier, |
75
|
|
|
|
|
|
|
); |
76
|
|
|
|
|
|
|
} |
77
|
0
|
|
|
|
|
|
$self->_set_param( return_to => $return_to->as_string ); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# identity setting |
81
|
0
|
0
|
|
|
|
|
unless ( $self->anonymous ) { |
82
|
0
|
|
|
|
|
|
my ( $identity, $claimed_id ); |
83
|
0
|
0
|
|
|
|
|
if ( $self->service->is_op_identifier ) { |
84
|
0
|
|
|
|
|
|
$identity = $claimed_id = IDENTIFIER_SELECT; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
else { |
87
|
0
|
|
|
|
|
|
$identity = $self->service->find_local_identifier; |
88
|
0
|
|
|
|
|
|
$claimed_id = $self->service->claimed_identifier; |
89
|
|
|
|
|
|
|
} |
90
|
0
|
|
|
|
|
|
$self->_set_param( identity => $identity ); |
91
|
0
|
0
|
|
|
|
|
unless ( $self->service->requires_compatibility_mode ) { |
92
|
0
|
|
|
|
|
|
$self->_set_param( claimed_id => $claimed_id ); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
# association setting |
97
|
0
|
0
|
|
|
|
|
if ( $self->has_association ) { |
98
|
0
|
|
|
|
|
|
$self->_set_param( assoc_handle => $self->association->handle ); |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub should_send_redirect { |
104
|
0
|
|
|
0
|
0
|
|
my ( $self, %args ) = @_; |
105
|
0
|
0
|
|
|
|
|
return 1 if $self->service->requires_compatibility_mode; |
106
|
0
|
|
|
|
|
|
my $url = $self->redirect_url(%args); |
107
|
0
|
|
|
|
|
|
return length($url) < 2048; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub _build__params { |
111
|
0
|
|
|
0
|
|
|
my $self = shift; |
112
|
0
|
|
|
|
|
|
my $params = OpenID::Lite::Message->new; |
113
|
0
|
|
|
|
|
|
$params->set( ns => $self->service->preferred_namespace ); |
114
|
0
|
|
|
|
|
|
return $params; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
1
|
|
|
1
|
|
676
|
no Any::Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
118
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
119
|
|
|
|
|
|
|
1; |