Sha256: 255e7a7284dd7ab8967ff3aaa8b9da4ee2cfb4122257b56ec88d601cb6f2ac47
Contents?: true
Size: 658 Bytes
Versions: 1
Compression:
Stored size: 658 Bytes
Contents
module Challah # Allows authentication with an api_key URL parameter. class ApiKeyTechnique def initialize(session) @key = session.key? ? session.key : nil end def authenticate # Api key functionality is only enabled with the :api_key_enabled option. This is turned # off by default and must be manually enabled for security reasons. return nil unless Challah.options[:api_key_enabled] unless @key.to_s.blank? user = Challah.user_model.find_by_api_key(@key) if user and user.active? return user end end nil end def persist? false end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
challah-0.7.0.pre2 | lib/challah/techniques/api_key_technique.rb |