Common functions for mechanisms
Mechanisms implement handling of methods start and receive. They return: [message_name, content] or nil where message_name is either ‘auth’ or ‘response’ and content is either a string which may transmitted encoded as Base64 or nil.
# File lib/sasl/base.rb, line 94 def initialize(mechanism, preferences) @mechanism = mechanism @preferences = preferences @state = nil end
# File lib/sasl/base.rb, line 103 def failure? @state == :failure end
# File lib/sasl/base.rb, line 112 def receive(message_name, content) case message_name when 'success' @state = :success when 'failure' @state = :failure end nil end
# File lib/sasl/base.rb, line 107 def start raise AbstractMethod end
# File lib/sasl/base.rb, line 100 def success? @state == :success end