8
8
require 'openid/extensions/oauth'
9
9
require 'openid/extensions/pape'
10
10
11
- module Rack #:nodoc:
11
+ module Rack
12
12
# A Rack middleware that provides a more HTTPish API around the
13
13
# ruby-openid library.
14
14
#
@@ -17,7 +17,7 @@ module Rack #:nodoc:
17
17
# header with the identifier you would like to validate.
18
18
#
19
19
# On competition, the OpenID response is automatically verified and
20
- # assigned to <tt> env["rack.openid.response"]</tt> .
20
+ # assigned to env["rack.openid.response"].
21
21
class OpenID
22
22
# Helper method for building the "WWW-Authenticate" header value.
23
23
#
@@ -53,18 +53,16 @@ def self.parse_header(str)
53
53
params
54
54
end
55
55
56
- class TimeoutResponse #:nodoc:
56
+ class TimeoutResponse
57
57
include ::OpenID ::Consumer ::Response
58
58
STATUS = :failure
59
59
end
60
60
61
- class MissingResponse #:nodoc:
61
+ class MissingResponse
62
62
include ::OpenID ::Consumer ::Response
63
63
STATUS = :missing
64
64
end
65
65
66
- # :stopdoc:
67
-
68
66
HTTP_METHODS = %w( GET HEAD PUT POST DELETE OPTIONS )
69
67
70
68
RESPONSE = "rack.openid.response"
@@ -73,8 +71,6 @@ class MissingResponse #:nodoc:
73
71
74
72
URL_FIELD_SELECTOR = lambda { |field | field . to_s =~ %r{^https?://} }
75
73
76
- # :startdoc:
77
-
78
74
# Initialize middleware with application and optional OpenID::Store.
79
75
# If no store is given, OpenID::Store::Memory is used.
80
76
#
@@ -89,7 +85,7 @@ def initialize(app, store = nil)
89
85
end
90
86
91
87
# Standard Rack +call+ dispatch that accepts an +env+ and
92
- # returns a <tt> [status, header, body]</tt> response.
88
+ # returns a [status, header, body] response.
93
89
def call ( env )
94
90
req = Rack ::Request . new ( env )
95
91
@@ -283,8 +279,7 @@ def add_attribute_exchange_fields(oidreq, fields)
283
279
end
284
280
285
281
def add_oauth_fields ( oidreq , fields )
286
- if ( consumer = fields [ 'oauth[consumer]' ] ) &&
287
- ( scope = fields [ 'oauth[scope]' ] )
282
+ if ( consumer = fields [ 'oauth[consumer]' ] ) && ( scope = fields [ 'oauth[scope]' ] )
288
283
oauthreq = ::OpenID ::OAuth ::Request . new ( consumer , Array ( scope ) . join ( ' ' ) )
289
284
oidreq . add_extension ( oauthreq )
290
285
end
@@ -306,9 +301,9 @@ def default_store
306
301
end
307
302
308
303
def timeout_protection_from_identity_server
309
- yield
310
- rescue Timeout ::Error
311
- TimeoutResponse . new
312
- end
304
+ yield
305
+ rescue Timeout ::Error
306
+ TimeoutResponse . new
307
+ end
313
308
end
314
309
end
0 commit comments