Sha256: 1cb39230c96967ec8bacb0084f1144d1f10841bb2b757e3b14b8da351d4df376
Contents?: true
Size: 1.33 KB
Versions: 3
Compression:
Stored size: 1.33 KB
Contents
module Toolhound # Authentication methods for {Toolhound::Client} module Authentication # Indicates if the client was supplied Basic Auth # username and password # # @see # @return [Boolean] def authenticatable? !!(@username && @password && @dataserver) end def sign_in @connection ||= begin TinyTds::Client.new( dataserver: @dataserver, port: @port, username: @username, password: @password ) end end # def sign_in # # response = post 'auth/sign_in', { email: @email, password: @password} # # update_headers(last_response && last_response.headers) # reset_agent # @me = response && response[:data] #&& response[:data] # end # alias :login :sign_in # def update_headers(headers) # headers ||= {} # # puts "update" # # last_response.headers # @client_id = headers["client"] # @access_token = headers["access-token"] # @expiry = headers["expiry"] # @uid = headers["uid"] # end # Closes the current active session by expiring the ticket. # def sign_out @connection.close if @connection @connection = nil # post "api/logout" # @me = nil end alias :logout :sign_out end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
toolhound-ruby-1.0.7 | lib/toolhound-ruby/authentication.rb |
toolhound-ruby-1.0.6 | lib/toolhound-ruby/authentication.rb |
toolhound-ruby-1.0.5 | lib/toolhound-ruby/authentication.rb |