Class: ActionDispatch::Cookies::SignedKeyRotatingCookieJar

Inherits:
AbstractCookieJar show all
Includes:
SerializedCookieJars
Defined in:
actionpack/lib/action_dispatch/middleware/cookies.rb

Overview

:nodoc:

Constant Summary

Constants included from SerializedCookieJars

ActionDispatch::Cookies::SerializedCookieJars::MARSHAL_SIGNATURE, ActionDispatch::Cookies::SerializedCookieJars::SERIALIZER

Instance Method Summary collapse

Methods inherited from AbstractCookieJar

#[], #[]=

Methods included from ChainedCookieJars

#encrypted, #permanent, #signed, #signed_or_encrypted

Constructor Details

#initialize(parent_jar) ⇒ SignedKeyRotatingCookieJar

Returns a new instance of SignedKeyRotatingCookieJar.


594
595
596
597
598
599
600
601
602
603
604
# File 'actionpack/lib/action_dispatch/middleware/cookies.rb', line 594

def initialize(parent_jar)
  super

  secret = request.key_generator.generate_key(request.signed_cookie_salt)
  @verifier = ActiveSupport::MessageVerifier.new(secret, digest: signed_cookie_digest, serializer: SERIALIZER)

  request.cookies_rotations.signed.each do |(*secrets)|
    options = secrets.extract_options!
    @verifier.rotate(*secrets, serializer: SERIALIZER, **options)
  end
end