rack-simple_auth 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MANIFEST +1 -22
- data/README.rdoc +1 -0
- data/checksum/rack-simple_auth-1.0.1.gem.sha512 +1 -0
- data/lib/rack/simple_auth/hmac/middleware.rb +46 -8
- data/lib/rack/simple_auth/version.rb +1 -1
- data/rack-simple_auth.gemspec +5 -0
- metadata +59 -24
- data/doc/Rack.html +0 -128
- data/doc/Rack/SimpleAuth.html +0 -252
- data/doc/Rack/SimpleAuth/HMAC.html +0 -128
- data/doc/Rack/SimpleAuth/HMAC/Config.html +0 -1003
- data/doc/Rack/SimpleAuth/HMAC/Middleware.html +0 -1418
- data/doc/Rack/SimpleAuth/Logger.html +0 -264
- data/doc/_index.html +0 -185
- data/doc/class_list.html +0 -54
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -57
- data/doc/css/style.css +0 -339
- data/doc/examples/index.php +0 -32
- data/doc/examples/rack_lobster.ru +0 -22
- data/doc/file.README.html +0 -221
- data/doc/file_list.html +0 -56
- data/doc/frames.html +0 -26
- data/doc/index.html +0 -221
- data/doc/js/app.js +0 -219
- data/doc/js/full_list.js +0 -178
- data/doc/js/jquery.js +0 -4
- data/doc/method_list.html +0 -179
- data/doc/top-level-namespace.html +0 -112
@@ -1,1418 +0,0 @@
|
|
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 http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
-
<title>
|
7
|
-
Class: Rack::SimpleAuth::HMAC::Middleware
|
8
|
-
|
9
|
-
— Documentation by YARD 0.8.7.4
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="../../../css/style.css" type="text/css" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="../../../css/common.css" type="text/css" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
hasFrames = window.top.frames.main ? true : false;
|
19
|
-
relpath = '../../../';
|
20
|
-
framesUrl = "../../../frames.html#!Rack/SimpleAuth/HMAC/Middleware.html";
|
21
|
-
</script>
|
22
|
-
|
23
|
-
|
24
|
-
<script type="text/javascript" charset="utf-8" src="../../../js/jquery.js"></script>
|
25
|
-
|
26
|
-
<script type="text/javascript" charset="utf-8" src="../../../js/app.js"></script>
|
27
|
-
|
28
|
-
|
29
|
-
</head>
|
30
|
-
<body>
|
31
|
-
<div id="header">
|
32
|
-
<div id="menu">
|
33
|
-
|
34
|
-
<a href="../../../_index.html">Index (M)</a> »
|
35
|
-
<span class='title'><span class='object_link'><a href="../../../Rack.html" title="Rack (module)">Rack</a></span></span> » <span class='title'><span class='object_link'><a href="../../SimpleAuth.html" title="Rack::SimpleAuth (module)">SimpleAuth</a></span></span> » <span class='title'><span class='object_link'><a href="../HMAC.html" title="Rack::SimpleAuth::HMAC (module)">HMAC</a></span></span>
|
36
|
-
»
|
37
|
-
<span class="title">Middleware</span>
|
38
|
-
|
39
|
-
|
40
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
-
</div>
|
42
|
-
|
43
|
-
<div id="search">
|
44
|
-
|
45
|
-
<a class="full_list_link" id="class_list_link"
|
46
|
-
href="../../../class_list.html">
|
47
|
-
Class List
|
48
|
-
</a>
|
49
|
-
|
50
|
-
<a class="full_list_link" id="method_list_link"
|
51
|
-
href="../../../method_list.html">
|
52
|
-
Method List
|
53
|
-
</a>
|
54
|
-
|
55
|
-
<a class="full_list_link" id="file_list_link"
|
56
|
-
href="../../../file_list.html">
|
57
|
-
File List
|
58
|
-
</a>
|
59
|
-
|
60
|
-
</div>
|
61
|
-
<div class="clear"></div>
|
62
|
-
</div>
|
63
|
-
|
64
|
-
<iframe id="search_frame"></iframe>
|
65
|
-
|
66
|
-
<div id="content"><h1>Class: Rack::SimpleAuth::HMAC::Middleware
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
</h1>
|
71
|
-
|
72
|
-
<dl class="box">
|
73
|
-
|
74
|
-
<dt class="r1">Inherits:</dt>
|
75
|
-
<dd class="r1">
|
76
|
-
<span class="inheritName">Object</span>
|
77
|
-
|
78
|
-
<ul class="fullTree">
|
79
|
-
<li>Object</li>
|
80
|
-
|
81
|
-
<li class="next">Rack::SimpleAuth::HMAC::Middleware</li>
|
82
|
-
|
83
|
-
</ul>
|
84
|
-
<a href="#" class="inheritanceTree">show all</a>
|
85
|
-
|
86
|
-
</dd>
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
<dt class="r2 last">Defined in:</dt>
|
97
|
-
<dd class="r2 last">lib/rack/simple_auth/hmac/middleware.rb</dd>
|
98
|
-
|
99
|
-
</dl>
|
100
|
-
<div class="clear"></div>
|
101
|
-
|
102
|
-
<h2>Overview</h2><div class="docstring">
|
103
|
-
<div class="discussion">
|
104
|
-
|
105
|
-
<p>Middleware class which represents the interface to the rack api via <span class='object_link'><a href="#call-instance_method" title="Rack::SimpleAuth::HMAC::Middleware#call (method)">#call</a></span>
|
106
|
-
and checks if a request is hmac authorized.</p>
|
107
|
-
|
108
|
-
|
109
|
-
</div>
|
110
|
-
</div>
|
111
|
-
<div class="tags">
|
112
|
-
|
113
|
-
<div class="examples">
|
114
|
-
<p class="tag_title">Examples:</p>
|
115
|
-
|
116
|
-
|
117
|
-
<p class="example_title"><div class='inline'>
|
118
|
-
<p>Basic Usage</p>
|
119
|
-
</div></p>
|
120
|
-
|
121
|
-
<pre class="example code"><code>"request_config = {
|
122
|
-
'GET' => 'path',
|
123
|
-
'POST' => 'params',
|
124
|
-
'DELETE' => 'path',
|
125
|
-
'PUT' => 'path',
|
126
|
-
'PATCH' => 'path'
|
127
|
-
}
|
128
|
-
|
129
|
-
use Rack::SimpleAuth::HMAC::Middleware do |options|
|
130
|
-
options.tolerance = 1500
|
131
|
-
|
132
|
-
options.secret = 'test_secret'
|
133
|
-
options.signature = 'test_signature'
|
134
|
-
|
135
|
-
options.logpath = "#{File.expand_path('..', __FILE__)}/logs"
|
136
|
-
options.request_config = request_config
|
137
|
-
|
138
|
-
options.verbose = true
|
139
|
-
end
|
140
|
-
|
141
|
-
run Rack::Lobster.new"</code></pre>
|
142
|
-
|
143
|
-
</div>
|
144
|
-
|
145
|
-
|
146
|
-
</div>
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
<h2>
|
155
|
-
Class Method Summary
|
156
|
-
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
157
|
-
</h2>
|
158
|
-
|
159
|
-
<ul class="summary">
|
160
|
-
|
161
|
-
<li class="public ">
|
162
|
-
<span class="summary_signature">
|
163
|
-
|
164
|
-
<a href="#method_missing-class_method" title="method_missing (class method)">+ (Object) <strong>method_missing</strong>(name, *args) </a>
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
</span>
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
<span class="summary_desc"><div class='inline'>
|
179
|
-
<p>Throw NoMethodError and give hint if method who was called is
|
180
|
-
Rack::SimpleAuth::Middleware.call.</p>
|
181
|
-
</div></span>
|
182
|
-
|
183
|
-
</li>
|
184
|
-
|
185
|
-
|
186
|
-
</ul>
|
187
|
-
|
188
|
-
<h2>
|
189
|
-
Instance Method Summary
|
190
|
-
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
191
|
-
</h2>
|
192
|
-
|
193
|
-
<ul class="summary">
|
194
|
-
|
195
|
-
<li class="private ">
|
196
|
-
<span class="summary_signature">
|
197
|
-
|
198
|
-
<a href="#allowed_messages-instance_method" title="#allowed_messages (instance method)">- (Array) <strong>allowed_messages</strong> </a>
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
</span>
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
<span class="note title private">private</span>
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
<span class="summary_desc"><div class='inline'>
|
213
|
-
<p>Builds Array of allowed message hashs between @tolerance via <span class='object_link'><a href="#message-instance_method" title="Rack::SimpleAuth::HMAC::Middleware#message (method)">#message</a></span>.</p>
|
214
|
-
</div></span>
|
215
|
-
|
216
|
-
</li>
|
217
|
-
|
218
|
-
|
219
|
-
<li class="private ">
|
220
|
-
<span class="summary_signature">
|
221
|
-
|
222
|
-
<a href="#authorized%3F-instance_method" title="#authorized? (instance method)">- (TrueClass, FalseClass) <strong>authorized?</strong> </a>
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
</span>
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
<span class="note title private">private</span>
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
<span class="summary_desc"><div class='inline'>
|
237
|
-
<p>Check if request is authorized.</p>
|
238
|
-
</div></span>
|
239
|
-
|
240
|
-
</li>
|
241
|
-
|
242
|
-
|
243
|
-
<li class="public ">
|
244
|
-
<span class="summary_signature">
|
245
|
-
|
246
|
-
<a href="#call-instance_method" title="#call (instance method)">- (Object) <strong>call</strong>(env) </a>
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
</span>
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
<span class="summary_desc"><div class='inline'>
|
261
|
-
<p>call Method for Rack Middleware/Application.</p>
|
262
|
-
</div></span>
|
263
|
-
|
264
|
-
</li>
|
265
|
-
|
266
|
-
|
267
|
-
<li class="private ">
|
268
|
-
<span class="summary_signature">
|
269
|
-
|
270
|
-
<a href="#empty_header%3F-instance_method" title="#empty_header? (instance method)">- (TrueClass, FalseClass) <strong>empty_header?</strong> </a>
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
</span>
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
<span class="note title private">private</span>
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
<span class="summary_desc"><div class='inline'>
|
285
|
-
<p>Check if HTTP_AUTHORIZATION Header is set.</p>
|
286
|
-
</div></span>
|
287
|
-
|
288
|
-
</li>
|
289
|
-
|
290
|
-
|
291
|
-
<li class="public ">
|
292
|
-
<span class="summary_signature">
|
293
|
-
|
294
|
-
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Middleware) <strong>initialize</strong>(app, &block) {|@config| ... }</a>
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
</span>
|
299
|
-
|
300
|
-
|
301
|
-
<span class="note title constructor">constructor</span>
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
<span class="summary_desc"><div class='inline'>
|
311
|
-
<p>Constructor for Rack Middleware (passing the rack stack).</p>
|
312
|
-
</div></span>
|
313
|
-
|
314
|
-
</li>
|
315
|
-
|
316
|
-
|
317
|
-
<li class="private ">
|
318
|
-
<span class="summary_signature">
|
319
|
-
|
320
|
-
<a href="#log-instance_method" title="#log (instance method)">- (Object) <strong>log</strong> </a>
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
</span>
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
<span class="note title private">private</span>
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
<span class="summary_desc"><div class='inline'>
|
335
|
-
<p>Log to @config.logpath Contains: - allowed messages and received message
|
336
|
-
- time when request was made - type of request - requested path.</p>
|
337
|
-
</div></span>
|
338
|
-
|
339
|
-
</li>
|
340
|
-
|
341
|
-
|
342
|
-
<li class="private ">
|
343
|
-
<span class="summary_signature">
|
344
|
-
|
345
|
-
<a href="#message-instance_method" title="#message (instance method)">- (String) <strong>message</strong>(date, delay = 0) </a>
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
</span>
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
<span class="note title private">private</span>
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
<span class="summary_desc"><div class='inline'>
|
360
|
-
<p>Get Message for current Request and delay.</p>
|
361
|
-
</div></span>
|
362
|
-
|
363
|
-
</li>
|
364
|
-
|
365
|
-
|
366
|
-
<li class="private ">
|
367
|
-
<span class="summary_signature">
|
368
|
-
|
369
|
-
<a href="#request_data-instance_method" title="#request_data (instance method)">- (String|Hash) <strong>request_data</strong> </a>
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
</span>
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
<span class="note title private">private</span>
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
<span class="summary_desc"><div class='inline'>
|
384
|
-
<p>Get Request Data specified by @config.request_config.</p>
|
385
|
-
</div></span>
|
386
|
-
|
387
|
-
</li>
|
388
|
-
|
389
|
-
|
390
|
-
<li class="private ">
|
391
|
-
<span class="summary_signature">
|
392
|
-
|
393
|
-
<a href="#request_message-instance_method" title="#request_message (instance method)">- (String) <strong>request_message</strong> </a>
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
</span>
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
<span class="note title private">private</span>
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
<span class="summary_desc"><div class='inline'>
|
408
|
-
<p>Get encrypted request message.</p>
|
409
|
-
</div></span>
|
410
|
-
|
411
|
-
</li>
|
412
|
-
|
413
|
-
|
414
|
-
<li class="private ">
|
415
|
-
<span class="summary_signature">
|
416
|
-
|
417
|
-
<a href="#request_signature-instance_method" title="#request_signature (instance method)">- (String) <strong>request_signature</strong> </a>
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
</span>
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
<span class="note title private">private</span>
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
<span class="summary_desc"><div class='inline'>
|
432
|
-
<p>Get request signature.</p>
|
433
|
-
</div></span>
|
434
|
-
|
435
|
-
</li>
|
436
|
-
|
437
|
-
|
438
|
-
<li class="private ">
|
439
|
-
<span class="summary_signature">
|
440
|
-
|
441
|
-
<a href="#valid_request%3F-instance_method" title="#valid_request? (instance method)">- (TrueClass, FalseClass) <strong>valid_request?</strong> </a>
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
</span>
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
<span class="note title private">private</span>
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
<span class="summary_desc"><div class='inline'>
|
456
|
-
<p>Checks for valid HMAC Request.</p>
|
457
|
-
</div></span>
|
458
|
-
|
459
|
-
</li>
|
460
|
-
|
461
|
-
|
462
|
-
</ul>
|
463
|
-
|
464
|
-
|
465
|
-
<div id="constructor_details" class="method_details_list">
|
466
|
-
<h2>Constructor Details</h2>
|
467
|
-
|
468
|
-
<div class="method_details first">
|
469
|
-
<h3 class="signature first" id="initialize-instance_method">
|
470
|
-
|
471
|
-
- (<tt><span class='object_link'><a href="" title="Rack::SimpleAuth::HMAC::Middleware (class)">Middleware</a></span></tt>) <strong>initialize</strong>(app, &block) {|@config| ... }
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
</h3><div class="docstring">
|
478
|
-
<div class="discussion">
|
479
|
-
|
480
|
-
<p>Constructor for Rack Middleware (passing the rack stack)</p>
|
481
|
-
|
482
|
-
|
483
|
-
</div>
|
484
|
-
</div>
|
485
|
-
<div class="tags">
|
486
|
-
<p class="tag_title">Parameters:</p>
|
487
|
-
<ul class="param">
|
488
|
-
|
489
|
-
<li>
|
490
|
-
|
491
|
-
<span class='name'>app</span>
|
492
|
-
|
493
|
-
|
494
|
-
<span class='type'>(<tt><span class='object_link'><a href="../../../Rack.html" title="Rack (module)">Rack</a></span> Application</tt>)</span>
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
—
|
499
|
-
<div class='inline'><dl class="rdoc-list label-list"><dt>next middleware or rack app which gets called
|
500
|
-
<dd></dd></dl>
|
501
|
-
</div>
|
502
|
-
|
503
|
-
</li>
|
504
|
-
|
505
|
-
<li>
|
506
|
-
|
507
|
-
<span class='name'>block</span>
|
508
|
-
|
509
|
-
|
510
|
-
<span class='type'>(<tt>Proc</tt>)</span>
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
—
|
515
|
-
<div class='inline'><dl class="rdoc-list label-list"><dt>the dsl block which will be yielded into the config object
|
516
|
-
<dd></dd></dl>
|
517
|
-
</div>
|
518
|
-
|
519
|
-
</li>
|
520
|
-
|
521
|
-
</ul>
|
522
|
-
|
523
|
-
<p class="tag_title">Yields:</p>
|
524
|
-
<ul class="yield">
|
525
|
-
|
526
|
-
<li>
|
527
|
-
|
528
|
-
|
529
|
-
<span class='type'>(<tt>@config</tt>)</span>
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
</li>
|
534
|
-
|
535
|
-
</ul>
|
536
|
-
|
537
|
-
</div><table class="source_code">
|
538
|
-
<tr>
|
539
|
-
<td>
|
540
|
-
<pre class="lines">
|
541
|
-
|
542
|
-
|
543
|
-
56
|
544
|
-
57
|
545
|
-
58
|
546
|
-
59
|
547
|
-
60</pre>
|
548
|
-
</td>
|
549
|
-
<td>
|
550
|
-
<pre class="code"><span class="info file"># File 'lib/rack/simple_auth/hmac/middleware.rb', line 56</span>
|
551
|
-
|
552
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_app'>app</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
553
|
-
<span class='ivar'>@app</span><span class='comma'>,</span> <span class='ivar'>@config</span> <span class='op'>=</span> <span class='id identifier rubyid_app'>app</span><span class='comma'>,</span> <span class='const'>Config</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
554
|
-
|
555
|
-
<span class='kw'>yield</span> <span class='ivar'>@config</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
556
|
-
<span class='kw'>end</span></pre>
|
557
|
-
</td>
|
558
|
-
</tr>
|
559
|
-
</table>
|
560
|
-
</div>
|
561
|
-
|
562
|
-
</div>
|
563
|
-
|
564
|
-
|
565
|
-
<div id="class_method_details" class="method_details_list">
|
566
|
-
<h2>Class Method Details</h2>
|
567
|
-
|
568
|
-
|
569
|
-
<div class="method_details first">
|
570
|
-
<h3 class="signature first" id="method_missing-class_method">
|
571
|
-
|
572
|
-
+ (<tt>Object</tt>) <strong>method_missing</strong>(name, *args)
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
</h3><div class="docstring">
|
579
|
-
<div class="discussion">
|
580
|
-
|
581
|
-
<p>Throw NoMethodError and give hint if method who was called is
|
582
|
-
Rack::SimpleAuth::Middleware.call</p>
|
583
|
-
|
584
|
-
|
585
|
-
</div>
|
586
|
-
</div>
|
587
|
-
<div class="tags">
|
588
|
-
<p class="tag_title">Parameters:</p>
|
589
|
-
<ul class="param">
|
590
|
-
|
591
|
-
<li>
|
592
|
-
|
593
|
-
<span class='name'>name</span>
|
594
|
-
|
595
|
-
|
596
|
-
<span class='type'>(<tt>Symbol</tt>)</span>
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
</li>
|
601
|
-
|
602
|
-
<li>
|
603
|
-
|
604
|
-
<span class='name'>args</span>
|
605
|
-
|
606
|
-
|
607
|
-
<span class='type'>(<tt>Array</tt>)</span>
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
</li>
|
612
|
-
|
613
|
-
</ul>
|
614
|
-
|
615
|
-
<p class="tag_title">Raises:</p>
|
616
|
-
<ul class="raise">
|
617
|
-
|
618
|
-
<li>
|
619
|
-
|
620
|
-
|
621
|
-
<span class='type'>(<tt>NoMethodError</tt>)</span>
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
—
|
626
|
-
<div class='inline'>
|
627
|
-
<p>if the method isn't defined and outputs additional hint for calling
|
628
|
-
Rack::SimpleAuth::Middleware.call</p>
|
629
|
-
</div>
|
630
|
-
|
631
|
-
</li>
|
632
|
-
|
633
|
-
</ul>
|
634
|
-
|
635
|
-
</div><table class="source_code">
|
636
|
-
<tr>
|
637
|
-
<td>
|
638
|
-
<pre class="lines">
|
639
|
-
|
640
|
-
|
641
|
-
41
|
642
|
-
42
|
643
|
-
43
|
644
|
-
44
|
645
|
-
45
|
646
|
-
46
|
647
|
-
47
|
648
|
-
48</pre>
|
649
|
-
</td>
|
650
|
-
<td>
|
651
|
-
<pre class="code"><span class="info file"># File 'lib/rack/simple_auth/hmac/middleware.rb', line 41</span>
|
652
|
-
|
653
|
-
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_method_missing'>method_missing</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
654
|
-
<span class='id identifier rubyid_msg'>msg</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Did you try to use HMAC Middleware as Rack Application via 'run'?\n</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_eql?'>eql?</span><span class='lparen'>(</span><span class='symbol'>:call</span><span class='rparen'>)</span>
|
655
|
-
<span class='id identifier rubyid_msg'>msg</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>method: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span>
|
656
|
-
<span class='id identifier rubyid_msg'>msg</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>args: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_eql?'>eql?</span><span class='lparen'>(</span><span class='symbol'>:call</span><span class='rparen'>)</span>
|
657
|
-
<span class='id identifier rubyid_msg'>msg</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>on: </span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
658
|
-
|
659
|
-
<span class='id identifier rubyid_fail'>fail</span> <span class='const'>NoMethodError</span><span class='comma'>,</span> <span class='id identifier rubyid_msg'>msg</span>
|
660
|
-
<span class='kw'>end</span></pre>
|
661
|
-
</td>
|
662
|
-
</tr>
|
663
|
-
</table>
|
664
|
-
</div>
|
665
|
-
|
666
|
-
</div>
|
667
|
-
|
668
|
-
<div id="instance_method_details" class="method_details_list">
|
669
|
-
<h2>Instance Method Details</h2>
|
670
|
-
|
671
|
-
|
672
|
-
<div class="method_details first">
|
673
|
-
<h3 class="signature first" id="allowed_messages-instance_method">
|
674
|
-
|
675
|
-
- (<tt>Array</tt>) <strong>allowed_messages</strong> <span class="extras">(private)</span>
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
</h3><div class="docstring">
|
682
|
-
<div class="discussion">
|
683
|
-
|
684
|
-
<p>Builds Array of allowed message hashs between @tolerance via <span class='object_link'><a href="#message-instance_method" title="Rack::SimpleAuth::HMAC::Middleware#message (method)">#message</a></span></p>
|
685
|
-
|
686
|
-
|
687
|
-
</div>
|
688
|
-
</div>
|
689
|
-
<div class="tags">
|
690
|
-
|
691
|
-
<p class="tag_title">Returns:</p>
|
692
|
-
<ul class="return">
|
693
|
-
|
694
|
-
<li>
|
695
|
-
|
696
|
-
|
697
|
-
<span class='type'>(<tt>Array</tt>)</span>
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
</li>
|
702
|
-
|
703
|
-
</ul>
|
704
|
-
|
705
|
-
</div><table class="source_code">
|
706
|
-
<tr>
|
707
|
-
<td>
|
708
|
-
<pre class="lines">
|
709
|
-
|
710
|
-
|
711
|
-
137
|
712
|
-
138
|
713
|
-
139
|
714
|
-
140
|
715
|
-
141
|
716
|
-
142
|
717
|
-
143
|
718
|
-
144
|
719
|
-
145
|
720
|
-
146
|
721
|
-
147</pre>
|
722
|
-
</td>
|
723
|
-
<td>
|
724
|
-
<pre class="code"><span class="info file"># File 'lib/rack/simple_auth/hmac/middleware.rb', line 137</span>
|
725
|
-
|
726
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_allowed_messages'>allowed_messages</span>
|
727
|
-
<span class='id identifier rubyid_messages'>messages</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
728
|
-
|
729
|
-
<span class='comment'># Timestamp with milliseconds as Fixnum
|
730
|
-
</span> <span class='id identifier rubyid_date'>date</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span> <span class='op'>*</span> <span class='int'>1000</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
|
731
|
-
<span class='lparen'>(</span><span class='op'>-</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_tolerance'>tolerance</span><span class='rparen'>)</span><span class='op'>..</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_tolerance'>tolerance</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_step'>step</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
|
732
|
-
<span class='id identifier rubyid_messages'>messages</span> <span class='op'><<</span> <span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>HMAC</span><span class='period'>.</span><span class='id identifier rubyid_hexdigest'>hexdigest</span><span class='lparen'>(</span><span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>Digest</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>sha256</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_secret'>secret</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span><span class='lparen'>(</span><span class='id identifier rubyid_date'>date</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
733
|
-
<span class='kw'>end</span>
|
734
|
-
|
735
|
-
<span class='id identifier rubyid_messages'>messages</span>
|
736
|
-
<span class='kw'>end</span></pre>
|
737
|
-
</td>
|
738
|
-
</tr>
|
739
|
-
</table>
|
740
|
-
</div>
|
741
|
-
|
742
|
-
<div class="method_details ">
|
743
|
-
<h3 class="signature " id="authorized?-instance_method">
|
744
|
-
|
745
|
-
- (<tt>TrueClass</tt>, <tt>FalseClass</tt>) <strong>authorized?</strong> <span class="extras">(private)</span>
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
</h3><div class="docstring">
|
752
|
-
<div class="discussion">
|
753
|
-
|
754
|
-
<p>Check if request is authorized</p>
|
755
|
-
|
756
|
-
|
757
|
-
</div>
|
758
|
-
</div>
|
759
|
-
<div class="tags">
|
760
|
-
|
761
|
-
<p class="tag_title">Returns:</p>
|
762
|
-
<ul class="return">
|
763
|
-
|
764
|
-
<li>
|
765
|
-
|
766
|
-
|
767
|
-
<span class='type'>(<tt>TrueClass</tt>)</span>
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
—
|
772
|
-
<div class='inline'>
|
773
|
-
<p>if request is authorized -> <span class='object_link'><a href="#request_signature-instance_method" title="Rack::SimpleAuth::HMAC::Middleware#request_signature (method)">#request_signature</a></span> is correct &
|
774
|
-
<span class='object_link'><a href="#request_message-instance_method" title="Rack::SimpleAuth::HMAC::Middleware#request_message (method)">#request_message</a></span> is included in <span class='object_link'><a href="#allowed_messages-instance_method" title="Rack::SimpleAuth::HMAC::Middleware#allowed_messages (method)">#allowed_messages</a></span></p>
|
775
|
-
</div>
|
776
|
-
|
777
|
-
</li>
|
778
|
-
|
779
|
-
<li>
|
780
|
-
|
781
|
-
|
782
|
-
<span class='type'>(<tt>FalseClass</tt>)</span>
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
—
|
787
|
-
<div class='inline'>
|
788
|
-
<p>if request is not authorized</p>
|
789
|
-
</div>
|
790
|
-
|
791
|
-
</li>
|
792
|
-
|
793
|
-
</ul>
|
794
|
-
|
795
|
-
</div><table class="source_code">
|
796
|
-
<tr>
|
797
|
-
<td>
|
798
|
-
<pre class="lines">
|
799
|
-
|
800
|
-
|
801
|
-
111
|
802
|
-
112
|
803
|
-
113</pre>
|
804
|
-
</td>
|
805
|
-
<td>
|
806
|
-
<pre class="code"><span class="info file"># File 'lib/rack/simple_auth/hmac/middleware.rb', line 111</span>
|
807
|
-
|
808
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_authorized?'>authorized?</span>
|
809
|
-
<span class='id identifier rubyid_request_signature'>request_signature</span><span class='period'>.</span><span class='id identifier rubyid_eql?'>eql?</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_signature'>signature</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_allowed_messages'>allowed_messages</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_request_message'>request_message</span><span class='rparen'>)</span>
|
810
|
-
<span class='kw'>end</span></pre>
|
811
|
-
</td>
|
812
|
-
</tr>
|
813
|
-
</table>
|
814
|
-
</div>
|
815
|
-
|
816
|
-
<div class="method_details ">
|
817
|
-
<h3 class="signature " id="call-instance_method">
|
818
|
-
|
819
|
-
- (<tt>Object</tt>) <strong>call</strong>(env)
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
</h3><div class="docstring">
|
826
|
-
<div class="discussion">
|
827
|
-
|
828
|
-
<p>call Method for Rack Middleware/Application</p>
|
829
|
-
|
830
|
-
|
831
|
-
</div>
|
832
|
-
</div>
|
833
|
-
<div class="tags">
|
834
|
-
<p class="tag_title">Parameters:</p>
|
835
|
-
<ul class="param">
|
836
|
-
|
837
|
-
<li>
|
838
|
-
|
839
|
-
<span class='name'>env</span>
|
840
|
-
|
841
|
-
|
842
|
-
<span class='type'>(<tt>Hash</tt>)</span>
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
—
|
847
|
-
<div class='inline'><dl class="rdoc-list label-list"><dt>Rack Env Hash which contains headers etc..
|
848
|
-
<dd></dd></dl>
|
849
|
-
</div>
|
850
|
-
|
851
|
-
</li>
|
852
|
-
|
853
|
-
</ul>
|
854
|
-
|
855
|
-
|
856
|
-
</div><table class="source_code">
|
857
|
-
<tr>
|
858
|
-
<td>
|
859
|
-
<pre class="lines">
|
860
|
-
|
861
|
-
|
862
|
-
67
|
863
|
-
68
|
864
|
-
69
|
865
|
-
70
|
866
|
-
71
|
867
|
-
72
|
868
|
-
73
|
869
|
-
74
|
870
|
-
75
|
871
|
-
76</pre>
|
872
|
-
</td>
|
873
|
-
<td>
|
874
|
-
<pre class="code"><span class="info file"># File 'lib/rack/simple_auth/hmac/middleware.rb', line 67</span>
|
875
|
-
|
876
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span>
|
877
|
-
<span class='ivar'>@request</span> <span class='op'>=</span> <span class='const'>Rack</span><span class='op'>::</span><span class='const'>Request</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span>
|
878
|
-
|
879
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_valid_request?'>valid_request?</span>
|
880
|
-
<span class='ivar'>@app</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span>
|
881
|
-
<span class='kw'>else</span>
|
882
|
-
<span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='const'>Rack</span><span class='op'>::</span><span class='const'>Response</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Unauthorized</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='int'>401</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Content-Type</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>text/html</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
883
|
-
<span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_finish'>finish</span>
|
884
|
-
<span class='kw'>end</span>
|
885
|
-
<span class='kw'>end</span></pre>
|
886
|
-
</td>
|
887
|
-
</tr>
|
888
|
-
</table>
|
889
|
-
</div>
|
890
|
-
|
891
|
-
<div class="method_details ">
|
892
|
-
<h3 class="signature " id="empty_header?-instance_method">
|
893
|
-
|
894
|
-
- (<tt>TrueClass</tt>, <tt>FalseClass</tt>) <strong>empty_header?</strong> <span class="extras">(private)</span>
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
</h3><div class="docstring">
|
901
|
-
<div class="discussion">
|
902
|
-
|
903
|
-
<p>Check if HTTP_AUTHORIZATION Header is set</p>
|
904
|
-
|
905
|
-
|
906
|
-
</div>
|
907
|
-
</div>
|
908
|
-
<div class="tags">
|
909
|
-
|
910
|
-
<p class="tag_title">Returns:</p>
|
911
|
-
<ul class="return">
|
912
|
-
|
913
|
-
<li>
|
914
|
-
|
915
|
-
|
916
|
-
<span class='type'>(<tt>TrueClass</tt>)</span>
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
—
|
921
|
-
<div class='inline'>
|
922
|
-
<p>if header is set</p>
|
923
|
-
</div>
|
924
|
-
|
925
|
-
</li>
|
926
|
-
|
927
|
-
<li>
|
928
|
-
|
929
|
-
|
930
|
-
<span class='type'>(<tt>FalseClass</tt>)</span>
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
—
|
935
|
-
<div class='inline'>
|
936
|
-
<p>if header is not set</p>
|
937
|
-
</div>
|
938
|
-
|
939
|
-
</li>
|
940
|
-
|
941
|
-
</ul>
|
942
|
-
|
943
|
-
</div><table class="source_code">
|
944
|
-
<tr>
|
945
|
-
<td>
|
946
|
-
<pre class="lines">
|
947
|
-
|
948
|
-
|
949
|
-
100
|
950
|
-
101
|
951
|
-
102</pre>
|
952
|
-
</td>
|
953
|
-
<td>
|
954
|
-
<pre class="code"><span class="info file"># File 'lib/rack/simple_auth/hmac/middleware.rb', line 100</span>
|
955
|
-
|
956
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_empty_header?'>empty_header?</span>
|
957
|
-
<span class='ivar'>@request</span><span class='period'>.</span><span class='id identifier rubyid_env'>env</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>HTTP_AUTHORIZATION</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
958
|
-
<span class='kw'>end</span></pre>
|
959
|
-
</td>
|
960
|
-
</tr>
|
961
|
-
</table>
|
962
|
-
</div>
|
963
|
-
|
964
|
-
<div class="method_details ">
|
965
|
-
<h3 class="signature " id="log-instance_method">
|
966
|
-
|
967
|
-
- (<tt>Object</tt>) <strong>log</strong> <span class="extras">(private)</span>
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
</h3><div class="docstring">
|
974
|
-
<div class="discussion">
|
975
|
-
|
976
|
-
<p>Log to @config.logpath Contains:</p>
|
977
|
-
|
978
|
-
<pre class="code ruby"><code class="ruby">- allowed messages and received message
|
979
|
-
- time when request was made
|
980
|
-
- type of request
|
981
|
-
- requested path</code></pre>
|
982
|
-
|
983
|
-
|
984
|
-
</div>
|
985
|
-
</div>
|
986
|
-
<div class="tags">
|
987
|
-
|
988
|
-
|
989
|
-
</div><table class="source_code">
|
990
|
-
<tr>
|
991
|
-
<td>
|
992
|
-
<pre class="lines">
|
993
|
-
|
994
|
-
|
995
|
-
181
|
996
|
-
182
|
997
|
-
183
|
998
|
-
184
|
999
|
-
185
|
1000
|
-
186
|
1001
|
-
187
|
1002
|
-
188
|
1003
|
-
189
|
1004
|
-
190
|
1005
|
-
191
|
1006
|
-
192
|
1007
|
-
193
|
1008
|
-
194
|
1009
|
-
195
|
1010
|
-
196
|
1011
|
-
197
|
1012
|
-
198</pre>
|
1013
|
-
</td>
|
1014
|
-
<td>
|
1015
|
-
<pre class="code"><span class="info file"># File 'lib/rack/simple_auth/hmac/middleware.rb', line 181</span>
|
1016
|
-
|
1017
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_log'>log</span>
|
1018
|
-
<span class='kw'>if</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_logpath'>logpath</span>
|
1019
|
-
<span class='id identifier rubyid_msg'>msg</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='embexpr_end'>}</span><span class='tstring_content'> - </span><span class='embexpr_beg'>#{</span><span class='ivar'>@request</span><span class='period'>.</span><span class='id identifier rubyid_request_method'>request_method</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='ivar'>@request</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_content'> - 400 Unauthorized\n</span><span class='tstring_end'>"</span></span>
|
1020
|
-
<span class='id identifier rubyid_msg'>msg</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>HTTP_AUTHORIZATION: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@request</span><span class='period'>.</span><span class='id identifier rubyid_env'>env</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>HTTP_AUTHORIZATION</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span>
|
1021
|
-
<span class='id identifier rubyid_msg'>msg</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Auth Message Config: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_request_config'>request_config</span><span class='lbracket'>[</span><span class='ivar'>@request</span><span class='period'>.</span><span class='id identifier rubyid_request_method'>request_method</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span>
|
1022
|
-
|
1023
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_allowed_messages'>allowed_messages</span>
|
1024
|
-
<span class='id identifier rubyid_msg'>msg</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Allowed Encrypted Messages:\n</span><span class='tstring_end'>"</span></span>
|
1025
|
-
<span class='id identifier rubyid_allowed_messages'>allowed_messages</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_hash'>hash</span><span class='op'>|</span>
|
1026
|
-
<span class='id identifier rubyid_msg'>msg</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_hash'>hash</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span>
|
1027
|
-
<span class='kw'>end</span>
|
1028
|
-
<span class='kw'>end</span>
|
1029
|
-
|
1030
|
-
<span class='id identifier rubyid_msg'>msg</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Auth Signature: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_signature'>signature</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
1031
|
-
|
1032
|
-
<span class='const'>Rack</span><span class='op'>::</span><span class='const'>SimpleAuth</span><span class='op'>::</span><span class='const'>Logger</span><span class='period'>.</span><span class='id identifier rubyid_log'>log</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_logpath'>logpath</span><span class='comma'>,</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_verbose'>verbose</span><span class='comma'>,</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>RACK_ENV</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_msg'>msg</span><span class='rparen'>)</span>
|
1033
|
-
<span class='kw'>end</span>
|
1034
|
-
<span class='kw'>end</span></pre>
|
1035
|
-
</td>
|
1036
|
-
</tr>
|
1037
|
-
</table>
|
1038
|
-
</div>
|
1039
|
-
|
1040
|
-
<div class="method_details ">
|
1041
|
-
<h3 class="signature " id="message-instance_method">
|
1042
|
-
|
1043
|
-
- (<tt>String</tt>) <strong>message</strong>(date, delay = 0) <span class="extras">(private)</span>
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
</h3><div class="docstring">
|
1050
|
-
<div class="discussion">
|
1051
|
-
|
1052
|
-
<p>Get Message for current Request and delay</p>
|
1053
|
-
|
1054
|
-
|
1055
|
-
</div>
|
1056
|
-
</div>
|
1057
|
-
<div class="tags">
|
1058
|
-
<p class="tag_title">Parameters:</p>
|
1059
|
-
<ul class="param">
|
1060
|
-
|
1061
|
-
<li>
|
1062
|
-
|
1063
|
-
<span class='name'>date</span>
|
1064
|
-
|
1065
|
-
|
1066
|
-
<span class='type'>(<tt>Fixnum</tt>)</span>
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
—
|
1071
|
-
<div class='inline'><dl class="rdoc-list label-list"><dt>current date in timestamp format
|
1072
|
-
<dd></dd></dl>
|
1073
|
-
</div>
|
1074
|
-
|
1075
|
-
</li>
|
1076
|
-
|
1077
|
-
<li>
|
1078
|
-
|
1079
|
-
<span class='name'>delay</span>
|
1080
|
-
|
1081
|
-
|
1082
|
-
<span class='type'>(<tt>Fixnum</tt>)</span>
|
1083
|
-
|
1084
|
-
|
1085
|
-
<em class="default">(defaults to: <tt>0</tt>)</em>
|
1086
|
-
|
1087
|
-
|
1088
|
-
—
|
1089
|
-
<div class='inline'><dl class="rdoc-list label-list"><dt>delay in timestamp format
|
1090
|
-
<dd></dd></dl>
|
1091
|
-
</div>
|
1092
|
-
|
1093
|
-
</li>
|
1094
|
-
|
1095
|
-
</ul>
|
1096
|
-
|
1097
|
-
<p class="tag_title">Returns:</p>
|
1098
|
-
<ul class="return">
|
1099
|
-
|
1100
|
-
<li>
|
1101
|
-
|
1102
|
-
|
1103
|
-
<span class='type'>(<tt>String</tt>)</span>
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
—
|
1108
|
-
<div class='inline'>
|
1109
|
-
<p>message</p>
|
1110
|
-
</div>
|
1111
|
-
|
1112
|
-
</li>
|
1113
|
-
|
1114
|
-
</ul>
|
1115
|
-
|
1116
|
-
</div><table class="source_code">
|
1117
|
-
<tr>
|
1118
|
-
<td>
|
1119
|
-
<pre class="lines">
|
1120
|
-
|
1121
|
-
|
1122
|
-
156
|
1123
|
-
157
|
1124
|
-
158
|
1125
|
-
159
|
1126
|
-
160</pre>
|
1127
|
-
</td>
|
1128
|
-
<td>
|
1129
|
-
<pre class="code"><span class="info file"># File 'lib/rack/simple_auth/hmac/middleware.rb', line 156</span>
|
1130
|
-
|
1131
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_message'>message</span><span class='lparen'>(</span><span class='id identifier rubyid_date'>date</span><span class='comma'>,</span> <span class='id identifier rubyid_delay'>delay</span> <span class='op'>=</span> <span class='int'>0</span><span class='rparen'>)</span>
|
1132
|
-
<span class='id identifier rubyid_date'>date</span> <span class='op'>+=</span> <span class='id identifier rubyid_delay'>delay</span>
|
1133
|
-
|
1134
|
-
<span class='lbrace'>{</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>method</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='ivar'>@request</span><span class='period'>.</span><span class='id identifier rubyid_request_method'>request_method</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>date</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_date'>date</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>data</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_request_data'>request_data</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span>
|
1135
|
-
<span class='kw'>end</span></pre>
|
1136
|
-
</td>
|
1137
|
-
</tr>
|
1138
|
-
</table>
|
1139
|
-
</div>
|
1140
|
-
|
1141
|
-
<div class="method_details ">
|
1142
|
-
<h3 class="signature " id="request_data-instance_method">
|
1143
|
-
|
1144
|
-
- (<tt>String|Hash</tt>) <strong>request_data</strong> <span class="extras">(private)</span>
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
</h3><div class="docstring">
|
1151
|
-
<div class="discussion">
|
1152
|
-
|
1153
|
-
<p>Get Request Data specified by @config.request_config</p>
|
1154
|
-
|
1155
|
-
|
1156
|
-
</div>
|
1157
|
-
</div>
|
1158
|
-
<div class="tags">
|
1159
|
-
|
1160
|
-
<p class="tag_title">Returns:</p>
|
1161
|
-
<ul class="return">
|
1162
|
-
|
1163
|
-
<li>
|
1164
|
-
|
1165
|
-
|
1166
|
-
<span class='type'>(<tt>String|Hash</tt>)</span>
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
—
|
1171
|
-
<div class='inline'>
|
1172
|
-
<p>data</p>
|
1173
|
-
</div>
|
1174
|
-
|
1175
|
-
</li>
|
1176
|
-
|
1177
|
-
</ul>
|
1178
|
-
|
1179
|
-
</div><table class="source_code">
|
1180
|
-
<tr>
|
1181
|
-
<td>
|
1182
|
-
<pre class="lines">
|
1183
|
-
|
1184
|
-
|
1185
|
-
166
|
1186
|
-
167
|
1187
|
-
168
|
1188
|
-
169
|
1189
|
-
170
|
1190
|
-
171
|
1191
|
-
172</pre>
|
1192
|
-
</td>
|
1193
|
-
<td>
|
1194
|
-
<pre class="code"><span class="info file"># File 'lib/rack/simple_auth/hmac/middleware.rb', line 166</span>
|
1195
|
-
|
1196
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_request_data'>request_data</span>
|
1197
|
-
<span class='kw'>if</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_request_config'>request_config</span><span class='lbracket'>[</span><span class='ivar'>@request</span><span class='period'>.</span><span class='id identifier rubyid_request_method'>request_method</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>path</span><span class='tstring_end'>'</span></span> <span class='op'>||</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_request_config'>request_config</span><span class='lbracket'>[</span><span class='ivar'>@request</span><span class='period'>.</span><span class='id identifier rubyid_request_method'>request_method</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>params</span><span class='tstring_end'>'</span></span>
|
1198
|
-
<span class='ivar'>@request</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_request_config'>request_config</span><span class='lbracket'>[</span><span class='ivar'>@request</span><span class='period'>.</span><span class='id identifier rubyid_request_method'>request_method</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rparen'>)</span>
|
1199
|
-
<span class='kw'>else</span>
|
1200
|
-
<span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Not a valid option </span><span class='embexpr_beg'>#{</span><span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_request_config'>request_config</span><span class='lbracket'>[</span><span class='ivar'>@request</span><span class='period'>.</span><span class='id identifier rubyid_request_method'>request_method</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'> - Use either params or path</span><span class='tstring_end'>"</span></span>
|
1201
|
-
<span class='kw'>end</span>
|
1202
|
-
<span class='kw'>end</span></pre>
|
1203
|
-
</td>
|
1204
|
-
</tr>
|
1205
|
-
</table>
|
1206
|
-
</div>
|
1207
|
-
|
1208
|
-
<div class="method_details ">
|
1209
|
-
<h3 class="signature " id="request_message-instance_method">
|
1210
|
-
|
1211
|
-
- (<tt>String</tt>) <strong>request_message</strong> <span class="extras">(private)</span>
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
</h3><div class="docstring">
|
1218
|
-
<div class="discussion">
|
1219
|
-
|
1220
|
-
<p>Get encrypted request message</p>
|
1221
|
-
|
1222
|
-
|
1223
|
-
</div>
|
1224
|
-
</div>
|
1225
|
-
<div class="tags">
|
1226
|
-
|
1227
|
-
<p class="tag_title">Returns:</p>
|
1228
|
-
<ul class="return">
|
1229
|
-
|
1230
|
-
<li>
|
1231
|
-
|
1232
|
-
|
1233
|
-
<span class='type'>(<tt>String</tt>)</span>
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
—
|
1238
|
-
<div class='inline'>
|
1239
|
-
<p>message of current request</p>
|
1240
|
-
</div>
|
1241
|
-
|
1242
|
-
</li>
|
1243
|
-
|
1244
|
-
</ul>
|
1245
|
-
|
1246
|
-
</div><table class="source_code">
|
1247
|
-
<tr>
|
1248
|
-
<td>
|
1249
|
-
<pre class="lines">
|
1250
|
-
|
1251
|
-
|
1252
|
-
129
|
1253
|
-
130
|
1254
|
-
131</pre>
|
1255
|
-
</td>
|
1256
|
-
<td>
|
1257
|
-
<pre class="code"><span class="info file"># File 'lib/rack/simple_auth/hmac/middleware.rb', line 129</span>
|
1258
|
-
|
1259
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_request_message'>request_message</span>
|
1260
|
-
<span class='ivar'>@request</span><span class='period'>.</span><span class='id identifier rubyid_env'>env</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>HTTP_AUTHORIZATION</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>:</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
1261
|
-
<span class='kw'>end</span></pre>
|
1262
|
-
</td>
|
1263
|
-
</tr>
|
1264
|
-
</table>
|
1265
|
-
</div>
|
1266
|
-
|
1267
|
-
<div class="method_details ">
|
1268
|
-
<h3 class="signature " id="request_signature-instance_method">
|
1269
|
-
|
1270
|
-
- (<tt>String</tt>) <strong>request_signature</strong> <span class="extras">(private)</span>
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
</h3><div class="docstring">
|
1277
|
-
<div class="discussion">
|
1278
|
-
|
1279
|
-
<p>Get request signature</p>
|
1280
|
-
|
1281
|
-
|
1282
|
-
</div>
|
1283
|
-
</div>
|
1284
|
-
<div class="tags">
|
1285
|
-
|
1286
|
-
<p class="tag_title">Returns:</p>
|
1287
|
-
<ul class="return">
|
1288
|
-
|
1289
|
-
<li>
|
1290
|
-
|
1291
|
-
|
1292
|
-
<span class='type'>(<tt>String</tt>)</span>
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
—
|
1297
|
-
<div class='inline'>
|
1298
|
-
<p>signature of current request</p>
|
1299
|
-
</div>
|
1300
|
-
|
1301
|
-
</li>
|
1302
|
-
|
1303
|
-
</ul>
|
1304
|
-
|
1305
|
-
</div><table class="source_code">
|
1306
|
-
<tr>
|
1307
|
-
<td>
|
1308
|
-
<pre class="lines">
|
1309
|
-
|
1310
|
-
|
1311
|
-
120
|
1312
|
-
121
|
1313
|
-
122</pre>
|
1314
|
-
</td>
|
1315
|
-
<td>
|
1316
|
-
<pre class="code"><span class="info file"># File 'lib/rack/simple_auth/hmac/middleware.rb', line 120</span>
|
1317
|
-
|
1318
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_request_signature'>request_signature</span>
|
1319
|
-
<span class='ivar'>@request</span><span class='period'>.</span><span class='id identifier rubyid_env'>env</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>HTTP_AUTHORIZATION</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>:</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span>
|
1320
|
-
<span class='kw'>end</span></pre>
|
1321
|
-
</td>
|
1322
|
-
</tr>
|
1323
|
-
</table>
|
1324
|
-
</div>
|
1325
|
-
|
1326
|
-
<div class="method_details ">
|
1327
|
-
<h3 class="signature " id="valid_request?-instance_method">
|
1328
|
-
|
1329
|
-
- (<tt>TrueClass</tt>, <tt>FalseClass</tt>) <strong>valid_request?</strong> <span class="extras">(private)</span>
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
</h3><div class="docstring">
|
1336
|
-
<div class="discussion">
|
1337
|
-
|
1338
|
-
<p>Checks for valid HMAC Request</p>
|
1339
|
-
|
1340
|
-
|
1341
|
-
</div>
|
1342
|
-
</div>
|
1343
|
-
<div class="tags">
|
1344
|
-
|
1345
|
-
<p class="tag_title">Returns:</p>
|
1346
|
-
<ul class="return">
|
1347
|
-
|
1348
|
-
<li>
|
1349
|
-
|
1350
|
-
|
1351
|
-
<span class='type'>(<tt>TrueClass</tt>)</span>
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
—
|
1356
|
-
<div class='inline'>
|
1357
|
-
<p>if request is authorized</p>
|
1358
|
-
</div>
|
1359
|
-
|
1360
|
-
</li>
|
1361
|
-
|
1362
|
-
<li>
|
1363
|
-
|
1364
|
-
|
1365
|
-
<span class='type'>(<tt>FalseClass</tt>)</span>
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
—
|
1370
|
-
<div class='inline'>
|
1371
|
-
<p>if request is not authorized or HTTP_AUTHORIZATION Header is not set</p>
|
1372
|
-
</div>
|
1373
|
-
|
1374
|
-
</li>
|
1375
|
-
|
1376
|
-
</ul>
|
1377
|
-
|
1378
|
-
</div><table class="source_code">
|
1379
|
-
<tr>
|
1380
|
-
<td>
|
1381
|
-
<pre class="lines">
|
1382
|
-
|
1383
|
-
|
1384
|
-
86
|
1385
|
-
87
|
1386
|
-
88
|
1387
|
-
89
|
1388
|
-
90
|
1389
|
-
91
|
1390
|
-
92</pre>
|
1391
|
-
</td>
|
1392
|
-
<td>
|
1393
|
-
<pre class="code"><span class="info file"># File 'lib/rack/simple_auth/hmac/middleware.rb', line 86</span>
|
1394
|
-
|
1395
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_valid_request?'>valid_request?</span>
|
1396
|
-
<span class='id identifier rubyid_log'>log</span>
|
1397
|
-
|
1398
|
-
<span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>if</span> <span class='id identifier rubyid_empty_header?'>empty_header?</span> <span class='op'>||</span> <span class='op'>!</span><span class='id identifier rubyid_authorized?'>authorized?</span>
|
1399
|
-
|
1400
|
-
<span class='kw'>true</span>
|
1401
|
-
<span class='kw'>end</span></pre>
|
1402
|
-
</td>
|
1403
|
-
</tr>
|
1404
|
-
</table>
|
1405
|
-
</div>
|
1406
|
-
|
1407
|
-
</div>
|
1408
|
-
|
1409
|
-
</div>
|
1410
|
-
|
1411
|
-
<div id="footer">
|
1412
|
-
Generated on Wed Apr 30 09:50:22 2014 by
|
1413
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1414
|
-
0.8.7.4 (ruby-2.1.1).
|
1415
|
-
</div>
|
1416
|
-
|
1417
|
-
</body>
|
1418
|
-
</html>
|