Class: Rack::Auth::OpenIDAuth
- Inherits:
-
AbstractHandler
- Object
- AbstractHandler
- Rack::Auth::OpenIDAuth
- 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, do |env|
env['rack.session'][:authkey] == a_string
end
run RackApp
Or simply:
app = Rack::Auth::OpenIDAuth.new app, realm, , &auth
Instance Attribute Summary collapse
-
#oid ⇒ Object
readonly
Returns the value of attribute oid.
Attributes inherited from AbstractHandler
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, realm, options = {}, &auth) ⇒ OpenIDAuth
constructor
A new instance of OpenIDAuth.
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, ={}, &auth) @oid = OpenID.new(realm, ) super(app, &auth) end |
Instance Attribute Details
#oid ⇒ Object (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 |