Sha256: 1e72d023045beb49b043feb2879c7cf5258ae483a5b02b5f9b944e8cf04d6d87
Contents?: true
Size: 830 Bytes
Versions: 6
Compression:
Stored size: 830 Bytes
Contents
module Warden module GitHub class Verifier def self.dump(user) new.serialize(user) end def self.load(key) new.deserialize(key) end def serialize(user) cookie_verifier.generate(user.marshal_dump) end def deserialize(key) User.new.tap do |u| u.marshal_load(cookie_verifier.verify(key)) end rescue ::ActiveSupport::MessageVerifier::InvalidSignature nil end def verifier_key self.class.verifier_key end private def self.verifier_key @verifier_key ||= ENV['WARDEN_GITHUB_VERIFIER_SECRET'] || SecureRandom.hex end def cookie_verifier @cookie_verifier ||= ::ActiveSupport::MessageVerifier.new(verifier_key, serializer: JSON) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems