class ActionDispatch::Cookies::SignedKeyRotatingCookieJar
:nodoc:
def commit(name, options)
def commit(name, options) super options[:value] = @verifier.generate(options[:value], **cookie_metadata(name, options)) check_for_overflow!(name, options) end
def initialize(parent_jar)
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
def parse(name, signed_message, purpose: nil)
def parse(name, signed_message, purpose: nil) rotated = false data = @verifier.verified(signed_message, purpose: purpose, on_rotation: -> { rotated = true }) super(name, data, force_reserialize: rotated) end