Class Rack::OpenID
In: lib/rack/openid.rb
lib/rack/openid/simple_auth.rb
lib/rack/openid/version.rb
Parent: Object

A Rack middleware that provides a more HTTPish API around the ruby-openid library.

You trigger an OpenID request similar to HTTP authentication. From your app, return a "401 Unauthorized" and a "WWW-Authenticate" header with the identifier you would like to validate.

On competition, the OpenID response is automatically verified and assigned to env.

Methods

build_header   call   new   parse_header  

Classes and Modules

Class Rack::OpenID::MissingResponse
Class Rack::OpenID::SimpleAuth
Class Rack::OpenID::TimeoutResponse

Constants

HTTP_METHODS = %w(GET HEAD PUT POST DELETE OPTIONS)
RESPONSE = "rack.openid.response"
AUTHENTICATE_HEADER = "WWW-Authenticate"
AUTHENTICATE_REGEXP = /^OpenID/
URL_FIELD_SELECTOR = lambda { |field| field.to_s =~ %r{^https?://} }
VERSION = "1.4.2"

Public Class methods

Helper method for building the "WWW-Authenticate" header value.

  Rack::OpenID.build_header(:identifier => "http://josh.openid.com/")
    #=> OpenID identifier="http://josh.openid.com/"

Initialize middleware with application and optional OpenID::Store. If no store is given, OpenID::Store::Memory is used.

  use Rack::OpenID

or

  use Rack::OpenID, OpenID::Store::Memcache.new

Helper method for parsing "WWW-Authenticate" header values into a hash.

  Rack::OpenID.parse_header("OpenID identifier='http://josh.openid.com/'")
    #=> {:identifier => "http://josh.openid.com/"}

Public Instance methods

Standard Rack call dispatch that accepts an env and returns a [status, header, body] response.

[Validate]