line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OpenID::Lite::Extension::SREG; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
40
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
5
|
1
|
|
|
1
|
|
4
|
use base 'Exporter'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
145
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @EXPORT_OK = qw(SREG_NS_1_0 SREG_NS_1_1 SREG_NS_ALIAS); |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
5
|
use constant SREG_NS_1_0 => q{http://openid.net/sreg/1.0}; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
75
|
|
12
|
1
|
|
|
1
|
|
4
|
use constant SREG_NS_1_1 => q{http://openid.net/extensions/sreg/1.1}; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
45
|
|
13
|
1
|
|
|
1
|
|
4
|
use constant SREG_NS_ALIAS => q{sreg}; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
55
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
1; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 NAME |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
OpenID::Lite::Extension::SREG - SREG extension plugin for OpenID::Lite |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
RP side |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub login { |
26
|
|
|
|
|
|
|
... |
27
|
|
|
|
|
|
|
my $checkid_req = $rp->begin( $identifier ) |
28
|
|
|
|
|
|
|
or $your_app->error( $rp->errstr ); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$sreg_req = OpenID::Lite::Extension::SREG::Request->new; |
31
|
|
|
|
|
|
|
$sreg_req->request_field('nickname'); |
32
|
|
|
|
|
|
|
$sreg_req->request_field('fullname'); |
33
|
|
|
|
|
|
|
$sreg_req->policy_url( $policy_url ); |
34
|
|
|
|
|
|
|
$checkid_req->add_extension( $sreg_req ); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
$your_app->redirect_to( $checkid_req->redirect_url( ... ) ); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub complete { |
40
|
|
|
|
|
|
|
... |
41
|
|
|
|
|
|
|
my $result = $rp->complete( $your_app->request ) |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
if ( $result->is_success ) { |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
... |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my $sreg_res = OpenID::Lite::Extension::SREG::Response->from_success_response( $result ); |
48
|
|
|
|
|
|
|
my $data = $sreg_res->data; |
49
|
|
|
|
|
|
|
say $data->{nickname}; |
50
|
|
|
|
|
|
|
say $data->{fullname}; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
... |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
} elsif ( ... ) { |
55
|
|
|
|
|
|
|
... |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
OP side |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
my $res = $op->handle_request( $your_app->request ); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
if ( $res->is_positive_assertion ) { |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my $sreg_req = OpenID::Lite::Extension::SREG::Request->from_provider_response($res); |
67
|
|
|
|
|
|
|
my $policy_url = $sreg_req->policy_url; |
68
|
|
|
|
|
|
|
if ( $sreg_res ) { |
69
|
|
|
|
|
|
|
my $sreg_data = { |
70
|
|
|
|
|
|
|
nickname => $user->nickname, |
71
|
|
|
|
|
|
|
fullname => $user->fullname, |
72
|
|
|
|
|
|
|
email => $user->email, |
73
|
|
|
|
|
|
|
}; |
74
|
|
|
|
|
|
|
my $sreg_res = OpenID::Lite::Extension::SREG::Response->extract_response($sreg_req, $sreg_data); |
75
|
|
|
|
|
|
|
$res->add_extension( $sreg_res ); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
$your_app->redirect_to( $res->make_signed_url() ); |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
} elsif ( $res->is_for_setup ) { |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
my $message = ''; |
83
|
|
|
|
|
|
|
my $sreg_req = OpenID::Lite::Extension::SREG::Request->from_provider_response($res); |
84
|
|
|
|
|
|
|
if ($sreg_req) { |
85
|
|
|
|
|
|
|
my $fields = $sreg_req->all_requested_fields(); |
86
|
|
|
|
|
|
|
$message .= sprintf(q{RP requested %s}, join(', ', @$fields)); |
87
|
|
|
|
|
|
|
$your_app->render( message => $message ); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
}... |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 DESCRIPTION |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
This module is plugin for OpenID::Lite to acomplish SREG extension flow on easy way. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
http://openid.net/specs/openid-simple-registration-extension-1_0.html |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
http://openid.net/specs/openid-simple-registration-extension-1_1-01.html |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 SEE ALSO |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
L |
103
|
|
|
|
|
|
|
L |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
L |
106
|
|
|
|
|
|
|
L |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 AUTHOR |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Lyo Kato, Elyo.kato@gmail.comE |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Copyright (C) 2009 by Lyo Kato |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
117
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.8.8 or, |
118
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=cut |