class ActionDispatch::Cookies::SignedKeyRotatingCookieJar
:nodoc:
def commit(name, options)
def commit(name, options) options[:value] = @verifier.generate(serialize(options[:value]), **cookie_metadata(name, options)) raise CookieOverflow if options[:value].bytesize > MAX_COOKIE_SIZE 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) deserialize(name) do |rotate| @verifier.verified(signed_message, on_rotation: rotate, purpose: purpose) end end