Class: RSocks::Authenticator
- Inherits:
-
Object
- Object
- RSocks::Authenticator
- Defined in:
- lib/r_socks/authenticator.rb
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #auth!(data) ⇒ Object
-
#initialize(adaptor = nil) ⇒ Authenticator
constructor
A new instance of Authenticator.
Constructor Details
#initialize(adaptor = nil) ⇒ Authenticator
Returns a new instance of Authenticator.
7 8 9 10 11 |
# File 'lib/r_socks/authenticator.rb', line 7 def initialize(adaptor = nil) @default_user = ENV['RSOCKS_USER'] || 'default' @default_password = ENV['RSOCKS_PASSWORD'] || 'default' @adaptor = adaptor end |
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
5 6 7 |
# File 'lib/r_socks/authenticator.rb', line 5 def password @password end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
5 6 7 |
# File 'lib/r_socks/authenticator.rb', line 5 def username @username end |
Instance Method Details
#auth!(data) ⇒ Object
13 14 15 16 |
# File 'lib/r_socks/authenticator.rb', line 13 def auth!(data) return false if data.unpack('C')[0] != RSocks::AUTH_HEADER validate(data[1..-1]) end |