Sha256: 222f47fdcdeb441bab16b7740783557cdf35e765f3b6cb40111864df7d225eb9
Contents?: true
Size: 761 Bytes
Versions: 3
Compression:
Stored size: 761 Bytes
Contents
module Challah # Allows authentication with an api_key URL parameter. class ApiKeyTechnique attr_accessor :user_model 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 = user_model.find_by_api_key(@key) if user and user.valid_session? return user end end nil end def persist? false end def user_model @user_model ||= Challah.user end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
challah-1.6.1 | lib/challah/techniques/api_key_technique.rb |
challah-1.6.0 | lib/challah/techniques/api_key_technique.rb |
challah-1.5.0 | lib/challah/techniques/api_key_technique.rb |