Class: Couchbase::PasswordAuthenticator
- Inherits:
-
Object
- Object
- Couchbase::PasswordAuthenticator
- Defined in:
- lib/couchbase/authenticator.rb
Overview
Authenticator for username/password credentials
Constant Summary collapse
- DEFAULT_SASL_MECHANISMS =
[:scram_sha512, :scram_sha256, :scram_sha1].freeze
Instance Attribute Summary collapse
-
#allowed_sasl_mechanisms ⇒ Object
Returns the value of attribute allowed_sasl_mechanisms.
-
#password ⇒ Object
Returns the value of attribute password.
-
#username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
-
.ldap_compatible(username, password) ⇒ PasswordAuthenticator
Creates a LDAP compatible password authenticator which is INSECURE if not used with TLS.
Instance Method Summary collapse
-
#initialize(username, password) ⇒ PasswordAuthenticator
constructor
Creates a new password authenticator with the default settings.
Constructor Details
#initialize(username, password) ⇒ PasswordAuthenticator
Creates a new password authenticator with the default settings.
30 31 32 33 |
# File 'lib/couchbase/authenticator.rb', line 30 def initialize(username, password) @username = username @password = password end |
Instance Attribute Details
#allowed_sasl_mechanisms ⇒ Object
Returns the value of attribute allowed_sasl_mechanisms.
24 25 26 |
# File 'lib/couchbase/authenticator.rb', line 24 def allowed_sasl_mechanisms @allowed_sasl_mechanisms end |
#password ⇒ Object
Returns the value of attribute password.
23 24 25 |
# File 'lib/couchbase/authenticator.rb', line 23 def password @password end |
#username ⇒ Object
Returns the value of attribute username.
22 23 24 |
# File 'lib/couchbase/authenticator.rb', line 22 def username @username end |
Class Method Details
.ldap_compatible(username, password) ⇒ PasswordAuthenticator
Creates a LDAP compatible password authenticator which is INSECURE if not used with TLS.
Please note that this is INSECURE and will leak user credentials on the wire to eavesdroppers. This should only be enabled in trusted environments.
43 44 45 46 47 |
# File 'lib/couchbase/authenticator.rb', line 43 def self.ldap_compatible(username, password) new(username, password).tap do |auth| auth.allowed_sasl_mechanisms = [:plain] end end |