Class: OpenvpnPasswordAuthenticator
- Inherits:
-
Object
- Object
- OpenvpnPasswordAuthenticator
- Defined in:
- lib/openvpn_password_authenticator.rb
Instance Attribute Summary collapse
-
#api ⇒ Object
Returns the value of attribute api.
Instance Method Summary collapse
- #authenticate ⇒ Object
-
#initialize(args, api_adapter_class) ⇒ OpenvpnPasswordAuthenticator
constructor
A new instance of OpenvpnPasswordAuthenticator.
Constructor Details
#initialize(args, api_adapter_class) ⇒ OpenvpnPasswordAuthenticator
Returns a new instance of OpenvpnPasswordAuthenticator.
4 5 6 7 8 |
# File 'lib/openvpn_password_authenticator.rb', line 4 def initialize(args, api_adapter_class) content = File.read(args[0]) @login, @password = content.split("\n") @api = api_adapter_class.new(@login, @password) end |
Instance Attribute Details
#api ⇒ Object
Returns the value of attribute api.
2 3 4 |
# File 'lib/openvpn_password_authenticator.rb', line 2 def api @api end |
Instance Method Details
#authenticate ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/openvpn_password_authenticator.rb', line 10 def authenticate if @api.valid_credentials? exit 0 else exit 1 end end |