Module: Toolhound::Authentication
- Included in:
- Client
- Defined in:
- lib/toolhound-ruby/authentication.rb
Overview
Authentication methods for Client
Instance Method Summary collapse
-
#authenticatable? ⇒ Boolean
Indicates if the client was supplied Basic Auth username and password.
-
#reconnect ⇒ Object
Closes the current active session by expiring the ticket.
- #sign_in ⇒ Object
- #sign_out ⇒ Object (also: #logout)
Instance Method Details
#authenticatable? ⇒ Boolean
Indicates if the client was supplied Basic Auth username and password
11 12 13 |
# File 'lib/toolhound-ruby/authentication.rb', line 11 def authenticatable? !!(@username && @password && @dataserver) end |
#reconnect ⇒ Object
Closes the current active session by expiring the ticket.
50 51 52 53 |
# File 'lib/toolhound-ruby/authentication.rb', line 50 def reconnect sign_out sign_in end |
#sign_in ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/toolhound-ruby/authentication.rb', line 16 def sign_in @connection ||= begin TinyTds::Client.new( dataserver: @dataserver, port: @port, username: @username, password: @password, timeout: @timeout ) end end |
#sign_out ⇒ Object Also known as: logout
54 55 56 57 58 59 |
# File 'lib/toolhound-ruby/authentication.rb', line 54 def sign_out @connection.close if @connection @connection = nil # post "api/logout" # @me = nil end |