Class: AMQP::AuthMechanismAdapter::Plain

Inherits:
AMQP::AuthMechanismAdapter show all
Defined in:
lib/amqp/auth_mechanism_adapter/plain.rb

Overview

Manages the encoding of credentials for the PLAIN authentication mechanism.

Instance Attribute Summary

Attributes inherited from AMQP::AuthMechanismAdapter

#adapter

Instance Method Summary collapse

Methods inherited from AMQP::AuthMechanismAdapter

auth_mechanism, for_adapter

Instance Method Details

#encode_credentials(username, password) ⇒ String

Encodes credentials for the given username and password. This involves sending the password across the wire in plaintext, so PLAIN authentication should only be used over a secure transport layer.

Parameters:

  • username (String)

    The username to encode.

  • password (String)

    The password to encode.

Returns:

  • (String)

    The username and password, encoded for the PLAIN mechanism.



20
21
22
# File 'lib/amqp/auth_mechanism_adapter/plain.rb', line 20

def encode_credentials(username, password)
  "\0#{username}\0#{password}"
end