Sha256: 7a7e26ff57b249ea2b0a2b32f64f2be8d9daea70a186a90962c91a8d53aac96f
Contents?: true
Size: 875 Bytes
Versions: 13
Compression:
Stored size: 875 Bytes
Contents
module Clearance # Rack middleware that manages the Clearance {Session}. This middleware is # automatically mounted by the Clearance {Engine}. # # * maintains the session cookie specified by your {Configuration}. # * exposes previously cookied sessions to Clearance and your app at # `request.env[:clearance]`, which {Authentication#current_user} pulls the # user from. # # @see Session # @see Configuration#cookie_name # class RackSession def initialize(app) @app = app end # Reads previously existing sessions from a cookie and maintains the cookie # on each response. def call(env) session = Clearance::Session.new(env) env[:clearance] = session response = @app.call(env) if session.authentication_successful? session.add_cookie_to_headers end response end end end
Version data entries
13 entries across 13 versions & 1 rubygems