Class: Aker::Cas::Middleware::LogoutResponder

Inherits:
Object
  • Object
show all
Includes:
Rack::ConfigurationHelper
Defined in:
lib/aker/cas/middleware/logout_responder.rb

Instance Method Summary collapse

Methods included from Rack::ConfigurationHelper

#login_path, #logout_path

Methods included from Rack::EnvironmentHelper

#authority, #configuration, #interactive?

Constructor Details

#initialize(app) ⇒ LogoutResponder


10
11
12
# File 'lib/aker/cas/middleware/logout_responder.rb', line 10

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object

Rack entry point.

Given a GET to the configured logout path, redirects to #cas_logout_url. All other requests are passed through.


22
23
24
25
26
27
28
# File 'lib/aker/cas/middleware/logout_responder.rb', line 22

def call(env)
  if env['REQUEST_METHOD'] == 'GET' && env['PATH_INFO'] == logout_path(env)
    ::Rack::Response.new { |r| r.redirect(cas_logout_url(env)) }.finish
  else
    @app.call(env)
  end
end