Parent

Class/Module Index [+]

Quicksearch

Bunny::Authentication::CredentialsEncoder

Base credentials encoder. Subclasses implement credentials encoding for a particular authentication mechanism (PLAIN, EXTERNAL, etc).

@api plugin

Attributes

session[R]

Session that uses this encoder @return [Bunny::Session]

Public Class Methods

auth_mechanism(*mechanisms) click to toggle source

Registers an encoder for authentication mechanism @api plugin

# File lib/bunny/authentication/credentials_encoder.rb, line 34
def self.auth_mechanism(*mechanisms)
  mechanisms.each do |m|
    registry[m] = self
  end
end
for_session(session) click to toggle source

Instantiates a new encoder for the authentication mechanism used by the provided session.

@return [Bunny::CredentialsEncoder]

# File lib/bunny/authentication/credentials_encoder.rb, line 23
def self.for_session(session)
  registry[session.mechanism].new(session)
end
new(session) click to toggle source
# File lib/bunny/authentication/credentials_encoder.rb, line 49
def initialize(session)
  @session = session
end
registry() click to toggle source

@private

# File lib/bunny/authentication/credentials_encoder.rb, line 28
def self.registry
  @@registry ||= Hash.new { raise NotImplementedError }
end

Public Instance Methods

encode_credentials(username, challenge) click to toggle source

Encodes provided credentials according to the specific authentication mechanism @return [String] Encoded credentials

# File lib/bunny/authentication/credentials_encoder.rb, line 43
def encode_credentials(username, challenge)
  raise NotImplementedError.new("Subclasses must override this method")
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.