Class: Webhookdb::Service::Middleware::SessionLength

Inherits:
Object
  • Object
show all
Defined in:
lib/webhookdb/service/middleware.rb

Overview

In some environments, like the browser, we may want a shorter session. Use a dedicated header to provide a short session.

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ SessionLength

Returns a new instance of SessionLength.



116
117
118
# File 'lib/webhookdb/service/middleware.rb', line 116

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



120
121
122
123
124
# File 'lib/webhookdb/service/middleware.rb', line 120

def call(env)
  env["rack.session.options"][:expire_after] = 2.hours.to_i if
    env[Webhookdb::Service::SHORT_SESSION_HTTP].present?
  return @app.call(env)
end