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 /logout.
Instance Attribute Summary (collapse)
-
- (String) logout_path
The path at which the middleware will watch for logout requests.
Instance Method Summary (collapse)
-
- (Object) call(env)
When the path is
/logout, renders a logout response. -
- (DefaultLogoutResponder) initialize(app, logout_path)
constructor
Instantiates the middleware.
Methods included from ConfigurationHelper
#using_custom_login_page?, #using_custom_logout_page?
Methods included from EnvironmentHelper
#authority, #configuration, #interactive?
Constructor Details
- (DefaultLogoutResponder) initialize(app, logout_path)
Instantiates the middleware.
21 22 23 24 |
# File 'lib/aker/rack/default_logout_responder.rb', line 21 def initialize(app, logout_path) @app = app self.logout_path = logout_path end |
Instance Attribute Details
- (String) logout_path
The path at which the middleware will watch for logout requests.
13 14 15 |
# File 'lib/aker/rack/default_logout_responder.rb', line 13 def logout_path @logout_path end |
Instance Method Details
- (Object) call(env)
When the path is /logout, renders a logout response.
30 31 32 33 34 35 36 37 38 |
# File 'lib/aker/rack/default_logout_responder.rb', line 30 def call(env) return @app.call(env) if using_custom_logout_page?(env) if env['REQUEST_METHOD'] == 'GET' && env['PATH_INFO'] == logout_path ::Rack::Response.new('You have been logged out.', 200).finish else @app.call(env) end end |