Class: Aker::Rack::DefaultLogoutResponder
- Inherits:
-
Object
- Object
- Aker::Rack::DefaultLogoutResponder
- Includes:
- ConfigurationHelper
- Defined in:
- lib/aker/rack/default_logout_responder.rb
Overview
Provides a default response for ‘GET` of the application’s configured logout path.
Instance Method Summary collapse
-
#call(env) ⇒ Object
When the path is the configured logout path, renders a logout response.
-
#initialize(app) ⇒ DefaultLogoutResponder
constructor
Instantiates the middleware.
Methods included from ConfigurationHelper
Methods included from EnvironmentHelper
#authority, #configuration, #interactive?
Constructor Details
#initialize(app) ⇒ DefaultLogoutResponder
Instantiates the middleware.
15 16 17 |
# File 'lib/aker/rack/default_logout_responder.rb', line 15 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
When the path is the configured logout path, renders a logout response.
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/aker/rack/default_logout_responder.rb', line 24 def call(env) result = @app.call(env) if result.first == 404 && env['REQUEST_METHOD'] == 'GET' && env['PATH_INFO'] == logout_path(env) ::Rack::Response.new('You have been logged out.', 200).finish else result end end |