Method: HTTPClient::NegotiateAuth#get

Defined in:
lib/httpclient.rb

#get(req) ⇒ Object



529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
# File 'lib/httpclient.rb', line 529

def get(req)
  return nil unless SSPIEnabled
  target_uri = req.header.request_uri
  param = Util.hash_find_value(@challenge) { |uri, param|
    Util.uri_part_of(target_uri, uri)
  }
  return nil unless param
  state = param[:state]
  authenticator = param[:authenticator]
  authphrase = param[:authphrase]
  case state
  when :init
    authenticator = param[:authenticator] = Win32::SSPI::NegotiateAuth.new
    return authenticator.get_initial_token
  when :response
    return authenticator.complete_authentication(authphrase)
  end
  nil
end