line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OIDC::Lite::Server::DataHandler; |
2
|
5
|
|
|
5
|
|
272545
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
147
|
|
3
|
5
|
|
|
5
|
|
18
|
use warnings; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
106
|
|
4
|
5
|
|
|
5
|
|
449
|
use parent 'OAuth::Lite2::Server::DataHandler'; |
|
5
|
|
|
|
|
330
|
|
|
5
|
|
|
|
|
37
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub validate_client_for_authorization { |
7
|
|
|
|
|
|
|
my ($self, $client_id, $response_type) = @_; |
8
|
|
|
|
|
|
|
die "abstract method"; |
9
|
|
|
|
|
|
|
} |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub validate_redirect_uri { |
12
|
|
|
|
|
|
|
my ($self, $client_id, $redirect_uri) = @_; |
13
|
|
|
|
|
|
|
die "abstract method"; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub validate_scope { |
17
|
|
|
|
|
|
|
my ($self, $client_id, $scope) = @_; |
18
|
|
|
|
|
|
|
die "abstract method"; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub validate_display { |
22
|
|
|
|
|
|
|
my ($self, $display) = @_; |
23
|
|
|
|
|
|
|
die "abstract method"; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub validate_prompt { |
27
|
|
|
|
|
|
|
my ($self, $prompt) = @_; |
28
|
|
|
|
|
|
|
die "abstract method"; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub validate_max_age { |
32
|
|
|
|
|
|
|
my ($self, $param) = @_; |
33
|
|
|
|
|
|
|
die "abstract method"; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub validate_ui_locales { |
37
|
|
|
|
|
|
|
my ($self, $ui_locales) = @_; |
38
|
|
|
|
|
|
|
die "abstract method"; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub validate_claims_locales { |
42
|
|
|
|
|
|
|
my ($self, $claims_locales) = @_; |
43
|
|
|
|
|
|
|
die "abstract method"; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub validate_id_token_hint { |
47
|
|
|
|
|
|
|
my ($self, $param) = @_; |
48
|
|
|
|
|
|
|
die "abstract method"; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub validate_login_hint { |
52
|
|
|
|
|
|
|
my ($self, $param) = @_; |
53
|
|
|
|
|
|
|
die "abstract method"; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub validate_acr_values { |
57
|
|
|
|
|
|
|
my ($self, $param) = @_; |
58
|
|
|
|
|
|
|
die "abstract method"; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub validate_request { |
62
|
|
|
|
|
|
|
my ($self, $param) = @_; |
63
|
|
|
|
|
|
|
die "abstract method"; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub validate_request_uri { |
67
|
|
|
|
|
|
|
my ($self, $param) = @_; |
68
|
|
|
|
|
|
|
die "abstract method"; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub get_user_id_for_authorization { |
72
|
|
|
|
|
|
|
my ($self) = @_; |
73
|
|
|
|
|
|
|
die "abstract method"; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub create_id_token { |
77
|
|
|
|
|
|
|
my ($self) = @_; |
78
|
|
|
|
|
|
|
die "abstract method"; |
79
|
|
|
|
|
|
|
# need another param? |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub create_or_update_auth_info { |
83
|
|
|
|
|
|
|
my ($self, %args) = @_; |
84
|
|
|
|
|
|
|
die "abstract method"; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# Because it is a method added later and optional, this must not die |
88
|
|
|
|
|
|
|
sub validate_server_state { |
89
|
|
|
|
|
|
|
my ($self, $server_state, $client_id) = @_; |
90
|
|
|
|
|
|
|
return 0; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub require_server_state { |
94
|
|
|
|
|
|
|
my ($self, $scope) = @_; |
95
|
|
|
|
|
|
|
return 0; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 NAME |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
OIDC::Lite::Server::DataHandler - Base class that specifies interface for data handler for your service. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 DESCRIPTION |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This specifies interface to handle data stored on your application. |
105
|
|
|
|
|
|
|
You have to inherit this, and implements subroutines according to the interface contract. |
106
|
|
|
|
|
|
|
This is proxy or adapter that connects OIDC::Lite library to your service. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 SYNOPSIS |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
package YourDataHandler; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
use strict; |
113
|
|
|
|
|
|
|
use warnings; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
use parent 'OIDC::Lite::Server::DataHandler'; |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub validate_scope { |
118
|
|
|
|
|
|
|
my ($self, $client_id, $scope) = @_; |
119
|
|
|
|
|
|
|
# your logic |
120
|
|
|
|
|
|
|
return 1; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 METHODS |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head2 init |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
If your subclass need some initiation, implement in this method. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 INTERFACES |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head2 request |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Returns object. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head2 validate_client_for_authorization( $client_id, $response_type ) |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Validation of client and allowed response_type. |
138
|
|
|
|
|
|
|
If it's OK, return 1. Return 0 if not. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head2 validate_redirect_uri( $client_id, $redirect_uri ) |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Validation of redirect_uri param. |
143
|
|
|
|
|
|
|
If it's OK, return 1. Return 0 if not. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head2 validate_scope( $client_id, $scope ) |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Validation of scope param. |
148
|
|
|
|
|
|
|
If it's OK, return 1. Return 0 if not. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head2 validate_display( $display ) |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Validation of display param. |
153
|
|
|
|
|
|
|
If it's OK, return 1. Return 0 if not. |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head2 validate_prompt( $prompt ) |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Validation of prompt param. |
158
|
|
|
|
|
|
|
If it's OK, return 1. Return 0 if not. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head2 validate_max_age( $aram ) |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Validation of max_age param. |
163
|
|
|
|
|
|
|
If it's OK, return 1. Return 0 if not. |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head2 validate_ui_locales_( $ui_locales ) |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
Validation of ui_locales param. |
168
|
|
|
|
|
|
|
If it's OK, return 1. Return 0 if not. |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head2 validate_claims_locales_( $claims_locales ) |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Validation of claims_locales param. |
173
|
|
|
|
|
|
|
If it's OK, return 1. Return 0 if not. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head2 validate_id_token_hint( $param ) |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Validation of id_token_hint param. |
178
|
|
|
|
|
|
|
If it's OK, return 1. Return 0 if not. |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=head2 validate_login_hint( $param ) |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
Validation of login_hint param. |
183
|
|
|
|
|
|
|
If it's OK, return 1. Return 0 if not. |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head2 validate_acr_values( $param ) |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
Validation of acr_values param. |
188
|
|
|
|
|
|
|
If it's OK, return 1. Return 0 if not. |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head2 validate_request( $param ) |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
Validation of request param. |
193
|
|
|
|
|
|
|
If it's OK, return 1. Return 0 if not. |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=head2 validate_request_uri( $param ) |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
Validation of request_uri param. |
198
|
|
|
|
|
|
|
If it's OK, return 1. Return 0 if not. |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=head2 get_user_id_for_authorization() |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
Return current user_id string. |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=head2 create_id_token() |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
Return OIDC::Lite::Model::IDToken object. |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=head2 create_or_update_auth_info(%args) |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
Return OIDC::Lite::Model::AuthInfo object. |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=head2 validate_server_state($server_state, $client_id) |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
Return whether server_state is valid or not |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=head2 require_server_state($scope) |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
Return whether scope requires server_state |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=head1 AUTHOR |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
Ryo Ito, Eritou.06@gmail.comE |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
Copyright (C) 2012 by Ryo Ito |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
229
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.8.8 or, |
230
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=cut |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
1; |