class Rack::OpenID::SimpleAuth

A simple OpenID middleware that restricts access to a single identifier.

use Rack::OpenID::SimpleAuth, "http://example.org"

SimpleAuth will automatically insert the required Rack::OpenID middleware, so use Rack::OpenID is unnecessary.

Attributes

app[R]
identifier[R]

Public Class Methods

new(*args) click to toggle source
# File lib/rack/openid/simple_auth.rb, line 14
def self.new(*args)
  Rack::OpenID.new(super)
end
new(app, identifier) click to toggle source
# File lib/rack/openid/simple_auth.rb, line 20
def initialize(app, identifier)
  @app        = app
  @identifier = identifier
end

Public Instance Methods

call(env) click to toggle source
# File lib/rack/openid/simple_auth.rb, line 25
def call(env)
  if session_authenticated?(env)
    app.call(env)
  elsif successful_response?(env)
    authenticate_session(env)
    redirect_to requested_url(env)
  else
    authentication_request
  end
end