Class: Rack::Auth::OpenIDAuth

Inherits:
AbstractHandler show all
Defined in:
lib/rack/auth/openid.rb

Overview

A class developed out of the request to use OpenID as an authentication middleware. The request will be sent to the OpenID instance unless the block evaluates to true. For example in rackup, you can use it as such:

use Rack::Session::Pool
use Rack::Auth::OpenIDAuth, realm, openid_options do |env|
  env['rack.session'][:authkey] == a_string
end
run RackApp

Or simply:

app = Rack::Auth::OpenIDAuth.new app, realm, openid_options, &auth

Instance Attribute Summary collapse

Attributes inherited from AbstractHandler

#realm

Instance Method Summary collapse

Constructor Details

#initialize(app, realm, options = {}, &auth) ⇒ OpenIDAuth

Returns a new instance of OpenIDAuth.



476
477
478
479
# File 'lib/rack/auth/openid.rb', line 476

def initialize(app, realm, options={}, &auth)
  @oid = OpenID.new(realm, options)
  super(app, &auth)
end

Instance Attribute Details

#oidObject (readonly)

Returns the value of attribute oid.



475
476
477
# File 'lib/rack/auth/openid.rb', line 475

def oid
  @oid
end

Instance Method Details

#call(env) ⇒ Object



481
482
483
484
# File 'lib/rack/auth/openid.rb', line 481

def call(env)
  to = @authenticator.call(env) ? @app : @oid
  to.call(env)
end