88require 'openid/extensions/oauth'
99require 'openid/extensions/pape'
1010
11- module Rack #:nodoc:
11+ module Rack
1212 # A Rack middleware that provides a more HTTPish API around the
1313 # ruby-openid library.
1414 #
@@ -17,7 +17,7 @@ module Rack #:nodoc:
1717 # header with the identifier you would like to validate.
1818 #
1919 # 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"].
2121 class OpenID
2222 # Helper method for building the "WWW-Authenticate" header value.
2323 #
@@ -53,18 +53,16 @@ def self.parse_header(str)
5353 params
5454 end
5555
56- class TimeoutResponse #:nodoc:
56+ class TimeoutResponse
5757 include ::OpenID ::Consumer ::Response
5858 STATUS = :failure
5959 end
6060
61- class MissingResponse #:nodoc:
61+ class MissingResponse
6262 include ::OpenID ::Consumer ::Response
6363 STATUS = :missing
6464 end
6565
66- # :stopdoc:
67-
6866 HTTP_METHODS = %w( GET HEAD PUT POST DELETE OPTIONS )
6967
7068 RESPONSE = "rack.openid.response"
@@ -73,8 +71,6 @@ class MissingResponse #:nodoc:
7371
7472 URL_FIELD_SELECTOR = lambda { |field | field . to_s =~ %r{^https?://} }
7573
76- # :startdoc:
77-
7874 # Initialize middleware with application and optional OpenID::Store.
7975 # If no store is given, OpenID::Store::Memory is used.
8076 #
@@ -89,7 +85,7 @@ def initialize(app, store = nil)
8985 end
9086
9187 # 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.
9389 def call ( env )
9490 req = Rack ::Request . new ( env )
9591
@@ -283,8 +279,7 @@ def add_attribute_exchange_fields(oidreq, fields)
283279 end
284280
285281 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]' ] )
288283 oauthreq = ::OpenID ::OAuth ::Request . new ( consumer , Array ( scope ) . join ( ' ' ) )
289284 oidreq . add_extension ( oauthreq )
290285 end
@@ -306,9 +301,9 @@ def default_store
306301 end
307302
308303 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
313308 end
314309end
0 commit comments