Sha256: 3dfa21e48e636518c8201412a5435f858307715ebf34211a1e89581e38d8b993

Contents?: true

Size: 472 Bytes

Versions: 6

Compression:

Stored size: 472 Bytes

Contents

module Janus
  module Strategies
    class TokenAuthenticatable < Base
      def valid?
        resource.include?(Janus::Models::TokenAuthenticatable) and !auth_token.nil?
      end

      def authenticate!
        user = resource.find_for_token_authentication(auth_token)
        if user
          success!(user)
        else
          pass
        end
      end

      def auth_token
        request.params[resource.token_authentication_key]
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
janus-0.10.1 lib/janus/strategies/token_authenticatable.rb
janus-0.10.0 lib/janus/strategies/token_authenticatable.rb
janus-0.9.1 lib/janus/strategies/token_authenticatable.rb
janus-0.9.0 lib/janus/strategies/token_authenticatable.rb
janus-0.8.1 lib/janus/strategies/token_authenticatable.rb
janus-0.8.0 lib/janus/strategies/token_authenticatable.rb