class Net::NTLM::Client

Constants

DEFAULT_FLAGS

Attributes

domain[R]
flags[R]
password[R]
username[R]
workstation[R]

Public Class Methods

new(username, password, opts = {}) click to toggle source

@note All string parameters should be encoded in UTF-8. The proper

final encoding for placing in the various {Message messages} will be
chosen based on negotiation with the server.

@param username [String] @param password [String] @option opts [String] :domain where we're authenticating to @option opts [String] :workstation local workstation name @option opts [Fixnum] :flags (DEFAULT_FLAGS) see Net::NTLM::Message::Type1.flag

# File lib/net/ntlm/client.rb, line 21
def initialize(username, password, opts = {})
  @username     = username
  @password     = password
  @domain       = opts[:domain] || nil
  @workstation  = opts[:workstation] || nil
  @flags        = opts[:flags] || DEFAULT_FLAGS
end

Public Instance Methods

init_context(resp = nil, channel_binding = nil) click to toggle source

@return [NTLM::Message]

# File lib/net/ntlm/client.rb, line 30
def init_context(resp = nil, channel_binding = nil)
  if resp.nil?
    @session = nil
    type1_message
  else
    @session = Client::Session.new(self, Net::NTLM::Message.decode64(resp), channel_binding)
    @session.authenticate!
  end
end
session() click to toggle source

@return [Client::Session]

# File lib/net/ntlm/client.rb, line 41
def session
  @session
end
session_key() click to toggle source
# File lib/net/ntlm/client.rb, line 45
def session_key
  @session.exported_session_key
end

Private Instance Methods

type1_message() click to toggle source

@return [Message::Type1]

# File lib/net/ntlm/client.rb, line 52
def type1_message
  type1 = Message::Type1.new
  type1[:flag].value = flags
  type1.domain = domain if domain
  type1.workstation = workstation if workstation

  type1
end