class Logux::Process::Auth

Constants

AUTHENTICATED
DENIED

Attributes

chunk[R]
stream[R]

Public Class Methods

new(stream:, chunk:) click to toggle source
# File lib/logux/process/auth.rb, line 8
def initialize(stream:, chunk:)
  @stream = stream
  @chunk = chunk
end

Public Instance Methods

call() click to toggle source
# File lib/logux/process/auth.rb, line 13
def call
  stream.write([auth_result, chunk.auth_id])
end

Private Instance Methods

auth_result() click to toggle source
# File lib/logux/process/auth.rb, line 22
def auth_result
  auth_rule(chunk.user_id, chunk.credentials) ? AUTHENTICATED : DENIED
end
auth_rule(user_id, credentials) click to toggle source
# File lib/logux/process/auth.rb, line 26
def auth_rule(user_id, credentials)
  Logux.configuration.auth_rule.call(user_id, credentials)
end