kennedy 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/.yardoc +0 -0
- data/LICENSE +20 -0
- data/MAIN.rdoc +23 -0
- data/README.markdown +17 -0
- data/Rakefile +52 -0
- data/VERSION +1 -0
- data/bin/kennedy-gen +13 -0
- data/doc/Kennedy.html +98 -0
- data/doc/Kennedy/Backends.html +94 -0
- data/doc/Kennedy/Backends/LDAP.html +471 -0
- data/doc/Kennedy/BadTicketException.html +92 -0
- data/doc/Kennedy/Granter.html +570 -0
- data/doc/Kennedy/Server.html +258 -0
- data/doc/Kennedy/Ticket.html +875 -0
- data/doc/_index.html +170 -0
- data/doc/class_list.html +97 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +23 -0
- data/doc/css/style.css +261 -0
- data/doc/file.README.html +69 -0
- data/doc/file_list.html +29 -0
- data/doc/index.html +69 -0
- data/doc/js/app.js +91 -0
- data/doc/js/full_list.js +39 -0
- data/doc/js/jquery.js +19 -0
- data/doc/method_list.html +152 -0
- data/doc/top-level-namespace.html +80 -0
- data/kennedy.gemspec +114 -0
- data/lib/kennedy.rb +2 -0
- data/lib/kennedy/backends/ldap.rb +35 -0
- data/lib/kennedy/generator.rb +69 -0
- data/lib/kennedy/granter.rb +52 -0
- data/lib/kennedy/instance_configuration.rb +58 -0
- data/lib/kennedy/server.rb +164 -0
- data/lib/kennedy/ticket.rb +97 -0
- data/logo.png +0 -0
- data/template/config.ru.erb +22 -0
- data/template/config/api_keys.yml.erb +1 -0
- data/template/config/backend.rb +0 -0
- data/template/config/encryption.yml.erb +2 -0
- data/template/config/sessions.yml.erb +1 -0
- data/test/granter_test.rb +93 -0
- data/test/ldap_backend_test.rb +66 -0
- data/test/server_test.rb +285 -0
- data/test/teststrap.rb +34 -0
- data/test/ticket_test.rb +84 -0
- metadata +177 -0
@@ -0,0 +1,258 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta name="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
+
<title>Class: Kennedy::Server</title>
|
7
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
9
|
+
|
10
|
+
<script type="text/javascript" charset="utf-8">
|
11
|
+
relpath = '..';
|
12
|
+
if (relpath != '') relpath += '/';
|
13
|
+
</script>
|
14
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
16
|
+
|
17
|
+
</head>
|
18
|
+
<body>
|
19
|
+
<div id="header">
|
20
|
+
<div id="menu">
|
21
|
+
|
22
|
+
<a href="../_index.html">Index (S)</a> »
|
23
|
+
<a title="Kennedy" href="../Kennedy.html">Kennedy</a>
|
24
|
+
»
|
25
|
+
<span class="title">Server</span>
|
26
|
+
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<div id="search">
|
30
|
+
<a id="class_list_link" href="#">Namespace List</a>
|
31
|
+
<a id="method_list_link" href="#">Method List</a>
|
32
|
+
<a id ="file_list_link" href="#">File List</a>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div class="clear"></div>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<iframe id="search_frame"></iframe>
|
39
|
+
|
40
|
+
<div id="content"><h1>Class: Kennedy::Server
|
41
|
+
|
42
|
+
|
43
|
+
</h1>
|
44
|
+
|
45
|
+
<dl class="box">
|
46
|
+
|
47
|
+
<dt class="r1">Inherits:</dt>
|
48
|
+
<dd class="r1">
|
49
|
+
<span class="inheritName">Sinatra::Base</span>
|
50
|
+
|
51
|
+
<ul class="fullTree">
|
52
|
+
<li>Object</li>
|
53
|
+
|
54
|
+
<li class="next">Sinatra::Base</li>
|
55
|
+
|
56
|
+
<li class="next">Kennedy::Server</li>
|
57
|
+
|
58
|
+
</ul>
|
59
|
+
<a href="#" class="inheritanceTree">show all</a>
|
60
|
+
|
61
|
+
</dd>
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
<dt class="r2 last">Defined in:</dt>
|
71
|
+
<dd class="r2 last">lib/kennedy/server.rb</dd>
|
72
|
+
|
73
|
+
</dl>
|
74
|
+
<div class="clear"></div>
|
75
|
+
|
76
|
+
<h2>Overview</h2><div class="docstring">
|
77
|
+
<div class="discussion">
|
78
|
+
<p>
|
79
|
+
Server
|
80
|
+
</p>
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
</div>
|
85
|
+
<div class="tags">
|
86
|
+
|
87
|
+
</div>
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
<h2>Method Summary</h2>
|
92
|
+
<ul class="summary">
|
93
|
+
|
94
|
+
<li class="public ">
|
95
|
+
<span class="summary_signature"><a title="create (class method)" href="#create-class_method">+ (Object) <strong>create</strong>(opts = {}) </a>
|
96
|
+
|
97
|
+
</span>
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
<span class="summary_desc">
|
105
|
+
Creates a new subclass of Kennedy::Server with the given options.
|
106
|
+
|
107
|
+
</span>
|
108
|
+
|
109
|
+
</li>
|
110
|
+
|
111
|
+
|
112
|
+
</ul>
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
<div id="method_details">
|
118
|
+
<h2>Method Details</h2>
|
119
|
+
|
120
|
+
<div class="method_details first">
|
121
|
+
<p class="signature first" id="create-class_method">
|
122
|
+
|
123
|
+
+ (<tt>Object</tt>) <strong>create</strong>(opts = {})
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
</p><div class="docstring">
|
128
|
+
<div class="discussion">
|
129
|
+
<p>
|
130
|
+
Creates a new subclass of Kennedy::Server with the given options
|
131
|
+
</p>
|
132
|
+
|
133
|
+
|
134
|
+
</div>
|
135
|
+
</div>
|
136
|
+
<div class="tags">
|
137
|
+
<h3>Parameters:</h3>
|
138
|
+
<ul class="param">
|
139
|
+
|
140
|
+
<li>
|
141
|
+
|
142
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
143
|
+
|
144
|
+
|
145
|
+
<span class='name'>opts</span>
|
146
|
+
|
147
|
+
|
148
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
149
|
+
|
150
|
+
|
151
|
+
—
|
152
|
+
|
153
|
+
The options to use when building the subclass
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
</li>
|
158
|
+
|
159
|
+
</ul>
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
<h3>Options Hash (<tt>opts</tt>):</h3>
|
165
|
+
<ul class="option">
|
166
|
+
|
167
|
+
<li>
|
168
|
+
<span class="type">(<tt>Hash</tt>)</span>
|
169
|
+
<span class="name">:encryption</span>
|
170
|
+
<span class="default">
|
171
|
+
|
172
|
+
<span class="na">N/A</span>
|
173
|
+
|
174
|
+
</span>
|
175
|
+
—
|
176
|
+
The IV and passphrase to use when generating tickets, given as :iv and
|
177
|
+
:passphrase keys in a Hash.
|
178
|
+
|
179
|
+
|
180
|
+
</tr>
|
181
|
+
|
182
|
+
<li>
|
183
|
+
<span class="type">(<tt>Object</tt>)</span>
|
184
|
+
<span class="name">:backend</span>
|
185
|
+
<span class="default">
|
186
|
+
|
187
|
+
<span class="na">N/A</span>
|
188
|
+
|
189
|
+
</span>
|
190
|
+
—
|
191
|
+
An instance of a backend to use for authentication.
|
192
|
+
|
193
|
+
|
194
|
+
</tr>
|
195
|
+
|
196
|
+
<li>
|
197
|
+
<span class="type">(<tt>String</tt>)</span>
|
198
|
+
<span class="name">:session_secret</span>
|
199
|
+
<span class="default">
|
200
|
+
|
201
|
+
<span class="na">N/A</span>
|
202
|
+
|
203
|
+
</span>
|
204
|
+
—
|
205
|
+
A secret for Rack::Session::Cookie to use when generating session cookies.
|
206
|
+
|
207
|
+
|
208
|
+
</tr>
|
209
|
+
|
210
|
+
</ul>
|
211
|
+
|
212
|
+
|
213
|
+
</div><table class="source_code">
|
214
|
+
<tr>
|
215
|
+
<td>
|
216
|
+
<pre class="lines">
|
217
|
+
|
218
|
+
|
219
|
+
17
|
220
|
+
18
|
221
|
+
19
|
222
|
+
20
|
223
|
+
21
|
224
|
+
22
|
225
|
+
23
|
226
|
+
24
|
227
|
+
25</pre>
|
228
|
+
</td>
|
229
|
+
<td>
|
230
|
+
<pre class="code"><span class="info file"># File 'lib/kennedy/server.rb', line 17</span>
|
231
|
+
|
232
|
+
<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='create identifier id'>create</span><span class='lparen token'>(</span><span class='opts identifier id'>opts</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
|
233
|
+
<span class='sc identifier id'>sc</span> <span class='assign token'>=</span> <span class='Class constant id'>Class</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='self self kw'>self</span><span class='rparen token'>)</span>
|
234
|
+
<span class='sc identifier id'>sc</span><span class='dot token'>.</span><span class='instance_eval identifier id'>instance_eval</span> <span class='do do kw'>do</span>
|
235
|
+
<span class='opts identifier id'>opts</span><span class='dot token'>.</span><span class='each identifier id'>each</span> <span class='lbrace token'>{</span> <span class='bitor op'>|</span><span class='k identifier id'>k</span><span class='comma token'>,</span><span class='v identifier id'>v</span><span class='bitor op'>|</span> <span class='set identifier id'>set</span> <span class='k identifier id'>k</span><span class='dot token'>.</span><span class='to_sym identifier id'>to_sym</span><span class='comma token'>,</span> <span class='v identifier id'>v</span> <span class='rbrace token'>}</span>
|
236
|
+
<span class='raise identifier id'>raise</span> <span class='ArgumentError constant id'>ArgumentError</span><span class='comma token'>,</span> <span class='string val'>"A session secret must be set with :session_secret"</span> <span class='unless unless_mod kw'>unless</span> <span class='defined? defined kw'>defined?</span><span class='lparen token'>(</span><span class='session_secret identifier id'>session_secret</span><span class='rparen token'>)</span>
|
237
|
+
<span class='add_cookie_middleware identifier id'>add_cookie_middleware</span>
|
238
|
+
<span class='self self kw'>self</span>
|
239
|
+
<span class='end end kw'>end</span>
|
240
|
+
<span class='end end kw'>end</span>
|
241
|
+
</pre>
|
242
|
+
</td>
|
243
|
+
</tr>
|
244
|
+
</table>
|
245
|
+
</div>
|
246
|
+
|
247
|
+
</div>
|
248
|
+
|
249
|
+
</div>
|
250
|
+
|
251
|
+
<div id="footer">
|
252
|
+
Generated on Tue Dec 8 16:39:39 2009 by
|
253
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
|
254
|
+
0.4.0 (ruby-1.8.7).
|
255
|
+
</div>
|
256
|
+
|
257
|
+
</body>
|
258
|
+
</html>
|
@@ -0,0 +1,875 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta name="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
+
<title>Class: Kennedy::Ticket</title>
|
7
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
9
|
+
|
10
|
+
<script type="text/javascript" charset="utf-8">
|
11
|
+
relpath = '..';
|
12
|
+
if (relpath != '') relpath += '/';
|
13
|
+
</script>
|
14
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
16
|
+
|
17
|
+
</head>
|
18
|
+
<body>
|
19
|
+
<div id="header">
|
20
|
+
<div id="menu">
|
21
|
+
|
22
|
+
<a href="../_index.html">Index (T)</a> »
|
23
|
+
<a title="Kennedy" href="../Kennedy.html">Kennedy</a>
|
24
|
+
»
|
25
|
+
<span class="title">Ticket</span>
|
26
|
+
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<div id="search">
|
30
|
+
<a id="class_list_link" href="#">Namespace List</a>
|
31
|
+
<a id="method_list_link" href="#">Method List</a>
|
32
|
+
<a id ="file_list_link" href="#">File List</a>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div class="clear"></div>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<iframe id="search_frame"></iframe>
|
39
|
+
|
40
|
+
<div id="content"><h1>Class: Kennedy::Ticket
|
41
|
+
|
42
|
+
|
43
|
+
</h1>
|
44
|
+
|
45
|
+
<dl class="box">
|
46
|
+
|
47
|
+
<dt class="r1">Inherits:</dt>
|
48
|
+
<dd class="r1">
|
49
|
+
<span class="inheritName">Object</span>
|
50
|
+
|
51
|
+
</dd>
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
<dt class="r2 last">Defined in:</dt>
|
61
|
+
<dd class="r2 last">lib/kennedy/ticket.rb</dd>
|
62
|
+
|
63
|
+
</dl>
|
64
|
+
<div class="clear"></div>
|
65
|
+
|
66
|
+
<h2>Overview</h2><div class="docstring">
|
67
|
+
<div class="discussion">
|
68
|
+
<p>
|
69
|
+
A ticket represents a time-constrained period in which an authenticated
|
70
|
+
person can access a service
|
71
|
+
</p>
|
72
|
+
|
73
|
+
|
74
|
+
</div>
|
75
|
+
</div>
|
76
|
+
<div class="tags">
|
77
|
+
|
78
|
+
</div>
|
79
|
+
<h2>Constant Summary</h2>
|
80
|
+
|
81
|
+
<dl class="constants">
|
82
|
+
|
83
|
+
<dt id="DefaultExpiry-constant ">DefaultExpiry =
|
84
|
+
<span class="summary_desc">
|
85
|
+
In seconds.
|
86
|
+
|
87
|
+
</span>
|
88
|
+
</dt>
|
89
|
+
<dd><pre class="code"><span class='integer val'>30</span>
|
90
|
+
</pre></dd>
|
91
|
+
|
92
|
+
</dl>
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<h2>Attribute Summary</h2>
|
97
|
+
<ul class="summary">
|
98
|
+
|
99
|
+
<li class="public ">
|
100
|
+
<span class="summary_signature"><a title="#identifier (instance method)" href="#identifier-instance_method">- (Object) <strong>identifier</strong> </a>
|
101
|
+
|
102
|
+
</span>
|
103
|
+
|
104
|
+
<span class="note title readonly">readonly</span>
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
<span class="summary_desc">
|
113
|
+
Returns the value of attribute <tt>identifier</tt>.
|
114
|
+
|
115
|
+
</span>
|
116
|
+
|
117
|
+
</li>
|
118
|
+
|
119
|
+
|
120
|
+
</ul>
|
121
|
+
|
122
|
+
|
123
|
+
<h2>Method Summary</h2>
|
124
|
+
<ul class="summary">
|
125
|
+
|
126
|
+
<li class="public ">
|
127
|
+
<span class="summary_signature"><a title="create (class method)" href="#create-class_method">+ (Object) <strong>create</strong>(args = {}) </a>
|
128
|
+
|
129
|
+
</span>
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
<span class="summary_desc">
|
137
|
+
Creates a new ticket with the given arguments.
|
138
|
+
|
139
|
+
</span>
|
140
|
+
|
141
|
+
</li>
|
142
|
+
|
143
|
+
|
144
|
+
<li class="public ">
|
145
|
+
<span class="summary_signature"><a title="from_encrypted (class method)" href="#from_encrypted-class_method">+ (Object) <strong>from_encrypted</strong>(args = {}) </a>
|
146
|
+
|
147
|
+
</span>
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
<span class="summary_desc">
|
155
|
+
Decrypts a ticket from the given arguments.
|
156
|
+
|
157
|
+
</span>
|
158
|
+
|
159
|
+
</li>
|
160
|
+
|
161
|
+
|
162
|
+
<li class="public ">
|
163
|
+
<span class="summary_signature"><a title="#decrypt (instance method)" href="#decrypt-instance_method">- (Object) <strong>decrypt</strong>(data) </a>
|
164
|
+
|
165
|
+
</span>
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
<span class="summary_desc">
|
173
|
+
Decrypts the given ticket data.
|
174
|
+
|
175
|
+
</span>
|
176
|
+
|
177
|
+
</li>
|
178
|
+
|
179
|
+
|
180
|
+
<li class="public ">
|
181
|
+
<span class="summary_signature"><a title="#expired? (instance method)" href="#expired%3F-instance_method">- (Object) <strong>expired?</strong> </a>
|
182
|
+
|
183
|
+
</span>
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
<span class="summary_desc"></span>
|
191
|
+
|
192
|
+
</li>
|
193
|
+
|
194
|
+
|
195
|
+
<li class="public ">
|
196
|
+
<span class="summary_signature"><a title="#initialize (instance method)" href="#initialize-instance_method">- (Ticket) <strong>initialize</strong>(args = {}) </a>
|
197
|
+
|
198
|
+
</span>
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
<span class="summary_desc">
|
206
|
+
A new instance of <tt>Ticket</tt>.
|
207
|
+
|
208
|
+
</span>
|
209
|
+
|
210
|
+
</li>
|
211
|
+
|
212
|
+
|
213
|
+
<li class="public ">
|
214
|
+
<span class="summary_signature"><a title="#to_encrypted (instance method)" href="#to_encrypted-instance_method">- (String) <strong>to_encrypted</strong> </a>
|
215
|
+
|
216
|
+
</span>
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
<span class="summary_desc">
|
224
|
+
Generates an encrypted chunk of JSON with the identifier and expiration
|
225
|
+
time for this ticket encoded in.
|
226
|
+
|
227
|
+
</span>
|
228
|
+
|
229
|
+
</li>
|
230
|
+
|
231
|
+
|
232
|
+
</ul>
|
233
|
+
|
234
|
+
<div id="constructor_details">
|
235
|
+
<h2>Constructor Details</h2>
|
236
|
+
|
237
|
+
<div class="method_details first">
|
238
|
+
<p class="signature first" id="initialize-instance_method">
|
239
|
+
|
240
|
+
- (<tt><a title="Ticket" href="">Ticket</a></tt>) <strong>initialize</strong>(args = {})
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
</p><div class="docstring">
|
245
|
+
<div class="discussion">
|
246
|
+
<p>
|
247
|
+
A new instance of <tt>Ticket</tt>
|
248
|
+
</p>
|
249
|
+
|
250
|
+
|
251
|
+
</div>
|
252
|
+
</div>
|
253
|
+
<div class="tags">
|
254
|
+
<h3>Parameters:</h3>
|
255
|
+
<ul class="param">
|
256
|
+
|
257
|
+
<li>
|
258
|
+
|
259
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
260
|
+
|
261
|
+
|
262
|
+
<span class='name'>args</span>
|
263
|
+
|
264
|
+
|
265
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
266
|
+
|
267
|
+
|
268
|
+
—
|
269
|
+
|
270
|
+
The arguments to construct the ticket with
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
</li>
|
275
|
+
|
276
|
+
</ul>
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
<h3>Options Hash (<tt>args</tt>):</h3>
|
282
|
+
<ul class="option">
|
283
|
+
|
284
|
+
<li>
|
285
|
+
<span class="type">(<tt>String</tt>)</span>
|
286
|
+
<span class="name">:iv</span>
|
287
|
+
<span class="default">
|
288
|
+
|
289
|
+
<span class="na">N/A</span>
|
290
|
+
|
291
|
+
</span>
|
292
|
+
—
|
293
|
+
An iv to use to encrypt and decrypt the ticket
|
294
|
+
|
295
|
+
|
296
|
+
</tr>
|
297
|
+
|
298
|
+
<li>
|
299
|
+
<span class="type">(<tt>String</tt>)</span>
|
300
|
+
<span class="name">:passphrase</span>
|
301
|
+
<span class="default">
|
302
|
+
|
303
|
+
<span class="na">N/A</span>
|
304
|
+
|
305
|
+
</span>
|
306
|
+
—
|
307
|
+
A passphrase to encrypt and decrypt the ticket
|
308
|
+
|
309
|
+
|
310
|
+
</tr>
|
311
|
+
|
312
|
+
</ul>
|
313
|
+
|
314
|
+
<h3>Returns:</h3>
|
315
|
+
<ul class="return">
|
316
|
+
|
317
|
+
<li>
|
318
|
+
|
319
|
+
<span class='type'>(<tt><a title="Ticket" href="">Ticket</a></tt>)</span>
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
—
|
325
|
+
|
326
|
+
a new instance of <tt>Ticket</tt>
|
327
|
+
|
328
|
+
|
329
|
+
|
330
|
+
</li>
|
331
|
+
|
332
|
+
</ul>
|
333
|
+
|
334
|
+
</div><table class="source_code">
|
335
|
+
<tr>
|
336
|
+
<td>
|
337
|
+
<pre class="lines">
|
338
|
+
|
339
|
+
|
340
|
+
47
|
341
|
+
48
|
342
|
+
49
|
343
|
+
50
|
344
|
+
51</pre>
|
345
|
+
</td>
|
346
|
+
<td>
|
347
|
+
<pre class="code"><span class="info file"># File 'lib/kennedy/ticket.rb', line 47</span>
|
348
|
+
|
349
|
+
<span class='def def kw'>def</span> <span class='initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='args identifier id'>args</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
|
350
|
+
<span class='@iv ivar id'>@iv</span> <span class='assign token'>=</span> <span class='args identifier id'>args</span><span class='lbrack token'>[</span><span class='symbol val'>:iv</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='raise identifier id'>raise</span><span class='lparen token'>(</span><span class='ArgumentError constant id'>ArgumentError</span><span class='comma token'>,</span> <span class='string val'>"Ticket encryption IV must be given as :iv"</span><span class='rparen token'>)</span>
|
351
|
+
<span class='@passphrase ivar id'>@passphrase</span> <span class='assign token'>=</span> <span class='args identifier id'>args</span><span class='lbrack token'>[</span><span class='symbol val'>:passphrase</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='raise identifier id'>raise</span><span class='lparen token'>(</span><span class='ArgumentError constant id'>ArgumentError</span><span class='comma token'>,</span> <span class='string val'>"Ticket encryption passphrase must be given as :passphrase"</span><span class='rparen token'>)</span>
|
352
|
+
<span class='@expiry ivar id'>@expiry</span> <span class='assign token'>=</span> <span class='args identifier id'>args</span><span class='lbrack token'>[</span><span class='symbol val'>:expiry</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='DefaultExpiry constant id'>DefaultExpiry</span>
|
353
|
+
<span class='end end kw'>end</span>
|
354
|
+
</pre>
|
355
|
+
</td>
|
356
|
+
</tr>
|
357
|
+
</table>
|
358
|
+
</div>
|
359
|
+
|
360
|
+
</div>
|
361
|
+
|
362
|
+
<div id="attr_details">
|
363
|
+
<h2>Attribute Details</h2>
|
364
|
+
|
365
|
+
|
366
|
+
<span id=""></span>
|
367
|
+
<span id="identifier-instance_method"></span>
|
368
|
+
<div class="method_details first">
|
369
|
+
<p class="signature first" id="identifier-instance_method">
|
370
|
+
|
371
|
+
- (<tt>Object</tt>) <strong>identifier</strong> <span class="extras">(readonly)</span>
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
</p><div class="docstring">
|
376
|
+
<div class="discussion">
|
377
|
+
<p>
|
378
|
+
Returns the value of attribute <tt>identifier</tt>
|
379
|
+
</p>
|
380
|
+
|
381
|
+
|
382
|
+
</div>
|
383
|
+
</div>
|
384
|
+
<div class="tags">
|
385
|
+
|
386
|
+
</div><table class="source_code">
|
387
|
+
<tr>
|
388
|
+
<td>
|
389
|
+
<pre class="lines">
|
390
|
+
|
391
|
+
|
392
|
+
12
|
393
|
+
13
|
394
|
+
14</pre>
|
395
|
+
</td>
|
396
|
+
<td>
|
397
|
+
<pre class="code"><span class="info file"># File 'lib/kennedy/ticket.rb', line 12</span>
|
398
|
+
|
399
|
+
<span class='def def kw'>def</span> <span class='identifier identifier id'>identifier</span>
|
400
|
+
<span class='@identifier ivar id'>@identifier</span>
|
401
|
+
<span class='end end kw'>end</span>
|
402
|
+
</pre>
|
403
|
+
</td>
|
404
|
+
</tr>
|
405
|
+
</table>
|
406
|
+
</div>
|
407
|
+
|
408
|
+
</div>
|
409
|
+
|
410
|
+
|
411
|
+
<div id="method_details">
|
412
|
+
<h2>Method Details</h2>
|
413
|
+
|
414
|
+
<div class="method_details first">
|
415
|
+
<p class="signature first" id="create-class_method">
|
416
|
+
|
417
|
+
+ (<tt>Object</tt>) <strong>create</strong>(args = {})
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
</p><div class="docstring">
|
422
|
+
<div class="discussion">
|
423
|
+
<p>
|
424
|
+
Creates a new ticket with the given arguments
|
425
|
+
</p>
|
426
|
+
|
427
|
+
|
428
|
+
</div>
|
429
|
+
</div>
|
430
|
+
<div class="tags">
|
431
|
+
<h3>Parameters:</h3>
|
432
|
+
<ul class="param">
|
433
|
+
|
434
|
+
<li>
|
435
|
+
|
436
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
437
|
+
|
438
|
+
|
439
|
+
<span class='name'>args</span>
|
440
|
+
|
441
|
+
|
442
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
443
|
+
|
444
|
+
|
445
|
+
—
|
446
|
+
|
447
|
+
The arguments to generate the ticket with
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
</li>
|
452
|
+
|
453
|
+
</ul>
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
<h3>Options Hash (<tt>args</tt>):</h3>
|
459
|
+
<ul class="option">
|
460
|
+
|
461
|
+
<li>
|
462
|
+
<span class="type">(<tt>String</tt>)</span>
|
463
|
+
<span class="name">:identifier</span>
|
464
|
+
<span class="default">
|
465
|
+
|
466
|
+
<span class="na">N/A</span>
|
467
|
+
|
468
|
+
</span>
|
469
|
+
—
|
470
|
+
An identifier to use in the ticket
|
471
|
+
|
472
|
+
|
473
|
+
</tr>
|
474
|
+
|
475
|
+
<li>
|
476
|
+
<span class="type">(<tt>String</tt>)</span>
|
477
|
+
<span class="name">:iv</span>
|
478
|
+
<span class="default">
|
479
|
+
|
480
|
+
<span class="na">N/A</span>
|
481
|
+
|
482
|
+
</span>
|
483
|
+
—
|
484
|
+
An iv to use to encrypt and decrypt the ticket
|
485
|
+
|
486
|
+
|
487
|
+
</tr>
|
488
|
+
|
489
|
+
<li>
|
490
|
+
<span class="type">(<tt>String</tt>)</span>
|
491
|
+
<span class="name">:passphrase</span>
|
492
|
+
<span class="default">
|
493
|
+
|
494
|
+
<span class="na">N/A</span>
|
495
|
+
|
496
|
+
</span>
|
497
|
+
—
|
498
|
+
A passphrase to encrypt and decrypt the ticket
|
499
|
+
|
500
|
+
|
501
|
+
</tr>
|
502
|
+
|
503
|
+
<li>
|
504
|
+
<span class="type">(<tt>String</tt>)</span>
|
505
|
+
<span class="name">:expiry</span>
|
506
|
+
<span class="default">
|
507
|
+
|
508
|
+
<span class="na">N/A</span>
|
509
|
+
|
510
|
+
</span>
|
511
|
+
—
|
512
|
+
A length of time in seconds for which this ticket is valid after
|
513
|
+
to_encrypted is called
|
514
|
+
|
515
|
+
|
516
|
+
</tr>
|
517
|
+
|
518
|
+
</ul>
|
519
|
+
|
520
|
+
|
521
|
+
</div><table class="source_code">
|
522
|
+
<tr>
|
523
|
+
<td>
|
524
|
+
<pre class="lines">
|
525
|
+
|
526
|
+
|
527
|
+
25
|
528
|
+
26
|
529
|
+
27
|
530
|
+
28
|
531
|
+
29
|
532
|
+
30</pre>
|
533
|
+
</td>
|
534
|
+
<td>
|
535
|
+
<pre class="code"><span class="info file"># File 'lib/kennedy/ticket.rb', line 25</span>
|
536
|
+
|
537
|
+
<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='create identifier id'>create</span><span class='lparen token'>(</span><span class='args identifier id'>args</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
|
538
|
+
<span class='identifier identifier id'>identifier</span> <span class='assign token'>=</span> <span class='args identifier id'>args</span><span class='lbrack token'>[</span><span class='symbol val'>:identifier</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='raise identifier id'>raise</span><span class='lparen token'>(</span><span class='ArgumentError constant id'>ArgumentError</span><span class='comma token'>,</span> <span class='string val'>"Ticket identifier must be given as :identifier"</span><span class='rparen token'>)</span>
|
539
|
+
<span class='ticket identifier id'>ticket</span> <span class='assign token'>=</span> <span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='symbol val'>:iv</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='args identifier id'>args</span><span class='lbrack token'>[</span><span class='symbol val'>:iv</span><span class='rbrack token'>]</span><span class='comma token'>,</span> <span class='symbol val'>:passphrase</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='args identifier id'>args</span><span class='lbrack token'>[</span><span class='symbol val'>:passphrase</span><span class='rbrack token'>]</span><span class='comma token'>,</span> <span class='symbol val'>:expiry</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='args identifier id'>args</span><span class='lbrack token'>[</span><span class='symbol val'>:expiry</span><span class='rbrack token'>]</span><span class='rparen token'>)</span>
|
540
|
+
<span class='ticket identifier id'>ticket</span><span class='dot token'>.</span><span class='identifier identifier id'>identifier</span> <span class='assign token'>=</span> <span class='identifier identifier id'>identifier</span>
|
541
|
+
<span class='ticket identifier id'>ticket</span>
|
542
|
+
<span class='end end kw'>end</span>
|
543
|
+
</pre>
|
544
|
+
</td>
|
545
|
+
</tr>
|
546
|
+
</table>
|
547
|
+
</div>
|
548
|
+
|
549
|
+
<div class="method_details ">
|
550
|
+
<p class="signature " id="from_encrypted-class_method">
|
551
|
+
|
552
|
+
+ (<tt>Object</tt>) <strong>from_encrypted</strong>(args = {})
|
553
|
+
|
554
|
+
|
555
|
+
|
556
|
+
</p><div class="docstring">
|
557
|
+
<div class="discussion">
|
558
|
+
<p>
|
559
|
+
Decrypts a ticket from the given arguments
|
560
|
+
</p>
|
561
|
+
|
562
|
+
|
563
|
+
</div>
|
564
|
+
</div>
|
565
|
+
<div class="tags">
|
566
|
+
<h3>Parameters:</h3>
|
567
|
+
<ul class="param">
|
568
|
+
|
569
|
+
<li>
|
570
|
+
|
571
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
572
|
+
|
573
|
+
|
574
|
+
<span class='name'>args</span>
|
575
|
+
|
576
|
+
|
577
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
578
|
+
|
579
|
+
|
580
|
+
—
|
581
|
+
|
582
|
+
The arguments to build the ticket with
|
583
|
+
|
584
|
+
|
585
|
+
|
586
|
+
</li>
|
587
|
+
|
588
|
+
</ul>
|
589
|
+
|
590
|
+
|
591
|
+
|
592
|
+
|
593
|
+
<h3>Options Hash (<tt>args</tt>):</h3>
|
594
|
+
<ul class="option">
|
595
|
+
|
596
|
+
<li>
|
597
|
+
<span class="type">(<tt>String</tt>)</span>
|
598
|
+
<span class="name">:data</span>
|
599
|
+
<span class="default">
|
600
|
+
|
601
|
+
<span class="na">N/A</span>
|
602
|
+
|
603
|
+
</span>
|
604
|
+
—
|
605
|
+
An encrypted ticket
|
606
|
+
|
607
|
+
|
608
|
+
</tr>
|
609
|
+
|
610
|
+
<li>
|
611
|
+
<span class="type">(<tt>String</tt>)</span>
|
612
|
+
<span class="name">:iv</span>
|
613
|
+
<span class="default">
|
614
|
+
|
615
|
+
<span class="na">N/A</span>
|
616
|
+
|
617
|
+
</span>
|
618
|
+
—
|
619
|
+
An IV to use to decrypt the ticket
|
620
|
+
|
621
|
+
|
622
|
+
</tr>
|
623
|
+
|
624
|
+
<li>
|
625
|
+
<span class="type">(<tt>String</tt>)</span>
|
626
|
+
<span class="name">:passphrase</span>
|
627
|
+
<span class="default">
|
628
|
+
|
629
|
+
<span class="na">N/A</span>
|
630
|
+
|
631
|
+
</span>
|
632
|
+
—
|
633
|
+
A passphrase to use to decrypt the ticket
|
634
|
+
|
635
|
+
|
636
|
+
</tr>
|
637
|
+
|
638
|
+
</ul>
|
639
|
+
|
640
|
+
|
641
|
+
</div><table class="source_code">
|
642
|
+
<tr>
|
643
|
+
<td>
|
644
|
+
<pre class="lines">
|
645
|
+
|
646
|
+
|
647
|
+
37
|
648
|
+
38
|
649
|
+
39
|
650
|
+
40
|
651
|
+
41
|
652
|
+
42</pre>
|
653
|
+
</td>
|
654
|
+
<td>
|
655
|
+
<pre class="code"><span class="info file"># File 'lib/kennedy/ticket.rb', line 37</span>
|
656
|
+
|
657
|
+
<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='from_encrypted identifier id'>from_encrypted</span><span class='lparen token'>(</span><span class='args identifier id'>args</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
|
658
|
+
<span class='data identifier id'>data</span> <span class='assign token'>=</span> <span class='args identifier id'>args</span><span class='lbrack token'>[</span><span class='symbol val'>:data</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='raise identifier id'>raise</span><span class='lparen token'>(</span><span class='ArgumentError constant id'>ArgumentError</span><span class='comma token'>,</span> <span class='string val'>"Data must be given as :data"</span><span class='rparen token'>)</span>
|
659
|
+
<span class='ticket identifier id'>ticket</span> <span class='assign token'>=</span> <span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='symbol val'>:iv</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='args identifier id'>args</span><span class='lbrack token'>[</span><span class='symbol val'>:iv</span><span class='rbrack token'>]</span><span class='comma token'>,</span> <span class='symbol val'>:passphrase</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='args identifier id'>args</span><span class='lbrack token'>[</span><span class='symbol val'>:passphrase</span><span class='rbrack token'>]</span><span class='rparen token'>)</span>
|
660
|
+
<span class='ticket identifier id'>ticket</span><span class='dot token'>.</span><span class='decrypt identifier id'>decrypt</span><span class='lparen token'>(</span><span class='data identifier id'>data</span><span class='rparen token'>)</span>
|
661
|
+
<span class='ticket identifier id'>ticket</span>
|
662
|
+
<span class='end end kw'>end</span>
|
663
|
+
</pre>
|
664
|
+
</td>
|
665
|
+
</tr>
|
666
|
+
</table>
|
667
|
+
</div>
|
668
|
+
|
669
|
+
<div class="method_details ">
|
670
|
+
<p class="signature " id="decrypt-instance_method">
|
671
|
+
|
672
|
+
- (<tt>Object</tt>) <strong>decrypt</strong>(data)
|
673
|
+
|
674
|
+
|
675
|
+
|
676
|
+
</p><div class="docstring">
|
677
|
+
<div class="discussion">
|
678
|
+
<p>
|
679
|
+
Decrypts the given ticket data
|
680
|
+
</p>
|
681
|
+
|
682
|
+
|
683
|
+
</div>
|
684
|
+
</div>
|
685
|
+
<div class="tags">
|
686
|
+
<h3>Parameters:</h3>
|
687
|
+
<ul class="param">
|
688
|
+
|
689
|
+
<li>
|
690
|
+
|
691
|
+
<span class='type'>(<tt>String</tt>)</span>
|
692
|
+
|
693
|
+
|
694
|
+
<span class='name'>data</span>
|
695
|
+
|
696
|
+
|
697
|
+
|
698
|
+
—
|
699
|
+
|
700
|
+
The ticket data to decrypt
|
701
|
+
|
702
|
+
|
703
|
+
|
704
|
+
</li>
|
705
|
+
|
706
|
+
</ul>
|
707
|
+
<h3>Raises:</h3>
|
708
|
+
<ul class="raise">
|
709
|
+
|
710
|
+
<li>
|
711
|
+
|
712
|
+
<span class='type'>(<tt><a title="Kennedy::BadTicketException" href="BadTicketException.html">Kennedy::BadTicketException</a></tt>)</span>
|
713
|
+
|
714
|
+
|
715
|
+
|
716
|
+
|
717
|
+
</li>
|
718
|
+
|
719
|
+
</ul>
|
720
|
+
|
721
|
+
</div><table class="source_code">
|
722
|
+
<tr>
|
723
|
+
<td>
|
724
|
+
<pre class="lines">
|
725
|
+
|
726
|
+
|
727
|
+
72
|
728
|
+
73
|
729
|
+
74
|
730
|
+
75
|
731
|
+
76
|
732
|
+
77
|
733
|
+
78
|
734
|
+
79
|
735
|
+
80
|
736
|
+
81
|
737
|
+
82
|
738
|
+
83
|
739
|
+
84</pre>
|
740
|
+
</td>
|
741
|
+
<td>
|
742
|
+
<pre class="code"><span class="info file"># File 'lib/kennedy/ticket.rb', line 72</span>
|
743
|
+
|
744
|
+
<span class='def def kw'>def</span> <span class='decrypt identifier id'>decrypt</span><span class='lparen token'>(</span><span class='data identifier id'>data</span><span class='rparen token'>)</span>
|
745
|
+
<span class='cipher identifier id'>cipher</span> <span class='assign token'>=</span> <span class='OpenSSL constant id'>OpenSSL</span><span class='colon2 op'>::</span><span class='Cipher constant id'>Cipher</span><span class='colon2 op'>::</span><span class='Cipher constant id'>Cipher</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='string val'>"aes-256-cbc"</span><span class='rparen token'>)</span>
|
746
|
+
<span class='cipher identifier id'>cipher</span><span class='dot token'>.</span><span class='decrypt identifier id'>decrypt</span>
|
747
|
+
<span class='cipher identifier id'>cipher</span><span class='dot token'>.</span><span class='key identifier id'>key</span> <span class='assign token'>=</span> <span class='@passphrase ivar id'>@passphrase</span>
|
748
|
+
<span class='cipher identifier id'>cipher</span><span class='dot token'>.</span><span class='iv identifier id'>iv</span> <span class='assign token'>=</span> <span class='@iv ivar id'>@iv</span>
|
749
|
+
<span class='decrypted identifier id'>decrypted</span> <span class='assign token'>=</span> <span class='cipher identifier id'>cipher</span><span class='dot token'>.</span><span class='update identifier id'>update</span><span class='lparen token'>(</span><span class='data identifier id'>data</span><span class='rparen token'>)</span>
|
750
|
+
<span class='decrypted identifier id'>decrypted</span> <span class='lshft op'><<</span> <span class='cipher identifier id'>cipher</span><span class='dot token'>.</span><span class='final identifier id'>final</span>
|
751
|
+
<span class='json identifier id'>json</span> <span class='assign token'>=</span> <span class='JSON constant id'>JSON</span><span class='dot token'>.</span><span class='parse identifier id'>parse</span><span class='lparen token'>(</span><span class='decrypted identifier id'>decrypted</span><span class='rparen token'>)</span>
|
752
|
+
<span class='self self kw'>self</span><span class='dot token'>.</span><span class='identifier identifier id'>identifier</span> <span class='assign token'>=</span> <span class='json identifier id'>json</span><span class='lbrack token'>[</span><span class='string val'>'identifier'</span><span class='rbrack token'>]</span>
|
753
|
+
<span class='@expiry ivar id'>@expiry</span> <span class='assign token'>=</span> <span class='Time constant id'>Time</span><span class='dot token'>.</span><span class='parse identifier id'>parse</span><span class='lparen token'>(</span><span class='json identifier id'>json</span><span class='lbrack token'>[</span><span class='string val'>'expiry'</span><span class='rbrack token'>]</span><span class='rparen token'>)</span>
|
754
|
+
<span class='rescue rescue kw'>rescue</span> <span class='OpenSSL constant id'>OpenSSL</span><span class='colon2 op'>::</span><span class='Cipher constant id'>Cipher</span><span class='colon2 op'>::</span><span class='CipherError constant id'>CipherError</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='e identifier id'>e</span>
|
755
|
+
<span class='raise identifier id'>raise</span> <span class='Kennedy constant id'>Kennedy</span><span class='colon2 op'>::</span><span class='BadTicketException constant id'>BadTicketException</span><span class='comma token'>,</span> <span class='string val'>"Given data was not decryptable"</span>
|
756
|
+
<span class='end end kw'>end</span>
|
757
|
+
</pre>
|
758
|
+
</td>
|
759
|
+
</tr>
|
760
|
+
</table>
|
761
|
+
</div>
|
762
|
+
|
763
|
+
<div class="method_details ">
|
764
|
+
<p class="signature " id="expired?-instance_method">
|
765
|
+
|
766
|
+
- (<tt>Object</tt>) <strong>expired?</strong>
|
767
|
+
|
768
|
+
|
769
|
+
|
770
|
+
</p><table class="source_code">
|
771
|
+
<tr>
|
772
|
+
<td>
|
773
|
+
<pre class="lines">
|
774
|
+
|
775
|
+
|
776
|
+
86
|
777
|
+
87
|
778
|
+
88</pre>
|
779
|
+
</td>
|
780
|
+
<td>
|
781
|
+
<pre class="code"><span class="info file"># File 'lib/kennedy/ticket.rb', line 86</span>
|
782
|
+
|
783
|
+
<span class='def def kw'>def</span> <span class='expired? fid id'>expired?</span>
|
784
|
+
<span class='notop op'>!</span><span class='@expiry ivar id'>@expiry</span><span class='dot token'>.</span><span class='nil? fid id'>nil?</span> <span class='andop op'>&&</span> <span class='lparen token'>(</span><span class='@expiry ivar id'>@expiry</span> <span class='lt op'><</span> <span class='Time constant id'>Time</span><span class='dot token'>.</span><span class='now identifier id'>now</span><span class='rparen token'>)</span>
|
785
|
+
<span class='end end kw'>end</span>
|
786
|
+
</pre>
|
787
|
+
</td>
|
788
|
+
</tr>
|
789
|
+
</table>
|
790
|
+
</div>
|
791
|
+
|
792
|
+
<div class="method_details ">
|
793
|
+
<p class="signature " id="to_encrypted-instance_method">
|
794
|
+
|
795
|
+
- (<tt>String</tt>) <strong>to_encrypted</strong>
|
796
|
+
|
797
|
+
|
798
|
+
|
799
|
+
</p><div class="docstring">
|
800
|
+
<div class="discussion">
|
801
|
+
<p>
|
802
|
+
Generates an encrypted chunk of JSON with the identifier and expiration
|
803
|
+
time for this ticket encoded in
|
804
|
+
</p>
|
805
|
+
|
806
|
+
|
807
|
+
</div>
|
808
|
+
</div>
|
809
|
+
<div class="tags">
|
810
|
+
<h3>Returns:</h3>
|
811
|
+
<ul class="return">
|
812
|
+
|
813
|
+
<li>
|
814
|
+
|
815
|
+
<span class='type'>(<tt>String</tt>)</span>
|
816
|
+
|
817
|
+
|
818
|
+
|
819
|
+
|
820
|
+
—
|
821
|
+
|
822
|
+
An encrypted JSON string
|
823
|
+
|
824
|
+
|
825
|
+
|
826
|
+
</li>
|
827
|
+
|
828
|
+
</ul>
|
829
|
+
|
830
|
+
</div><table class="source_code">
|
831
|
+
<tr>
|
832
|
+
<td>
|
833
|
+
<pre class="lines">
|
834
|
+
|
835
|
+
|
836
|
+
60
|
837
|
+
61
|
838
|
+
62
|
839
|
+
63
|
840
|
+
64
|
841
|
+
65
|
842
|
+
66
|
843
|
+
67
|
844
|
+
68</pre>
|
845
|
+
</td>
|
846
|
+
<td>
|
847
|
+
<pre class="code"><span class="info file"># File 'lib/kennedy/ticket.rb', line 60</span>
|
848
|
+
|
849
|
+
<span class='def def kw'>def</span> <span class='to_encrypted identifier id'>to_encrypted</span>
|
850
|
+
<span class='cipher identifier id'>cipher</span> <span class='assign token'>=</span> <span class='OpenSSL constant id'>OpenSSL</span><span class='colon2 op'>::</span><span class='Cipher constant id'>Cipher</span><span class='colon2 op'>::</span><span class='Cipher constant id'>Cipher</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='string val'>"aes-256-cbc"</span><span class='rparen token'>)</span>
|
851
|
+
<span class='cipher identifier id'>cipher</span><span class='dot token'>.</span><span class='encrypt identifier id'>encrypt</span>
|
852
|
+
<span class='cipher identifier id'>cipher</span><span class='dot token'>.</span><span class='key identifier id'>key</span> <span class='assign token'>=</span> <span class='@passphrase ivar id'>@passphrase</span>
|
853
|
+
<span class='cipher identifier id'>cipher</span><span class='dot token'>.</span><span class='iv identifier id'>iv</span> <span class='assign token'>=</span> <span class='@iv ivar id'>@iv</span>
|
854
|
+
<span class='encrypted identifier id'>encrypted</span> <span class='assign token'>=</span> <span class='cipher identifier id'>cipher</span><span class='dot token'>.</span><span class='update identifier id'>update</span><span class='lparen token'>(</span><span class='to_expiring_json identifier id'>to_expiring_json</span><span class='rparen token'>)</span>
|
855
|
+
<span class='encrypted identifier id'>encrypted</span> <span class='lshft op'><<</span> <span class='cipher identifier id'>cipher</span><span class='dot token'>.</span><span class='final identifier id'>final</span>
|
856
|
+
<span class='encrypted identifier id'>encrypted</span>
|
857
|
+
<span class='end end kw'>end</span>
|
858
|
+
</pre>
|
859
|
+
</td>
|
860
|
+
</tr>
|
861
|
+
</table>
|
862
|
+
</div>
|
863
|
+
|
864
|
+
</div>
|
865
|
+
|
866
|
+
</div>
|
867
|
+
|
868
|
+
<div id="footer">
|
869
|
+
Generated on Tue Dec 8 16:39:39 2009 by
|
870
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
|
871
|
+
0.4.0 (ruby-1.8.7).
|
872
|
+
</div>
|
873
|
+
|
874
|
+
</body>
|
875
|
+
</html>
|