Sha256: 7402de134c4ca26537cc2ba90771a9854735bc78faaf7987fb7bf5b18e586127

Contents?: true

Size: 726 Bytes

Versions: 2

Compression:

Stored size: 726 Bytes

Contents

# encoding: utf-8

class Demo
  module Core
    module Handler

      class Authenticator
        extend Handler
        include Substation::Processor::Evaluator::Handler

        def initialize(request)
          @request    = request
          @input      = @request.input
          @db         = @request.env.storage
          @account_id = @request.input.session.fetch('account_id')
        end

        def call
          authenticated? ? success(input) : error(input)
        end

        attr_reader :request
        private     :request

        attr_reader :input
        private     :input

        private

        def authenticated?
          !!@db.load_person(@account_id)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
substation-0.0.11 spec/demo/core/handler/authenticator.rb
substation-0.0.10 spec/demo/core/handler/authenticator.rb