Sha256: 69ef4622a203fa692b3dfee0655025e6f2a595a25ae1d7d87a724dc675763553
Contents?: true
Size: 608 Bytes
Versions: 1
Compression:
Stored size: 608 Bytes
Contents
# frozen_string_literal: true module Logux module Process class Auth attr_reader :stream, :chunk def initialize(stream:, chunk:) @stream = stream @chunk = chunk end def call stream.write([auth_result, chunk.auth_id]) end AUTHENTICATED = 'authenticated' DENIED = 'denied' private def auth_result auth_rule(chunk.user_id, chunk.credentials) ? AUTHENTICATED : DENIED end def auth_rule(user_id, credentials) Logux.configuration.auth_rule.call(user_id, credentials) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
logux-rack-0.1.0 | lib/logux/process/auth.rb |