Method: Rack::Protection::SessionHijacking#accepts?

Defined in:
lib/rack/protection/session_hijacking.rb

#accepts?(env) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
24
25
26
27
28
29
30
# File 'lib/rack/protection/session_hijacking.rb', line 21

def accepts?(env)
  session = session env
  key     = options[:tracking_key]
  if session.include? key
    session[key].all? { |k, v| v == encode(env[k]) }
  else
    session[key] = {}
    options[:track].each { |k| session[key][k] = encode(env[k]) }
  end
end