Class: AMQP::AuthMechanismAdapter
- Inherits:
-
Object
- Object
- AMQP::AuthMechanismAdapter
- Defined in:
- lib/amqp/auth_mechanism_adapter.rb
Overview
Provides a flexible method for encoding AMQP credentials. PLAIN and EXTERNAL are provided by this gem. In order to implement a new authentication mechanism, create a subclass like so:
class MyAuthMechanism < AMQP::Async::AuthMechanismAdapter auth_mechanism “X-MYAUTH” def encode_credentials(username, password)- … end end
Defined Under Namespace
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
The Adapter that this AuthMechanismAdapter operates on behalf of.
Class Method Summary collapse
-
.auth_mechanism(*mechanisms) ⇒ Object
protected
Used by subclasses to declare the mechanisms that an AuthMechanismAdapter understands.
-
.for_adapter(adapter) ⇒ AuthMechanismAdapter
Find and instantiate an AuthMechanismAdapter.
Instance Attribute Details
#adapter ⇒ Object (readonly)
The Adapter that this AuthMechanismAdapter operates on behalf of.
52 53 54 |
# File 'lib/amqp/auth_mechanism_adapter.rb', line 52 def adapter @adapter end |
Class Method Details
.auth_mechanism(*mechanisms) ⇒ Object (protected)
Used by subclasses to declare the mechanisms that an AuthMechanismAdapter understands.
35 36 37 |
# File 'lib/amqp/auth_mechanism_adapter.rb', line 35 def self.auth_mechanism(*mechanisms) mechanisms.each {|mechanism| registry[mechanism] = self} end |
.for_adapter(adapter) ⇒ AuthMechanismAdapter
Find and instantiate an AuthMechanismAdapter.
24 25 26 |
# File 'lib/amqp/auth_mechanism_adapter.rb', line 24 def self.for_adapter(adapter) registry[adapter.mechanism].new adapter end |