Class: WinRM::HTTP::HttpGSSAPI

Inherits:
HttpTransport show all
Defined in:
lib/winrm/http/transport.rb

Overview

Uses Kerberos/GSSAPI to authenticate and encrypt messages rubocop:disable Metrics/ClassLength

Constant Summary

Constants inherited from HttpTransport

WinRM::HTTP::HttpTransport::DEFAULT_RECEIVE_TIMEOUT

Instance Attribute Summary

Attributes inherited from HttpTransport

#endpoint

Instance Method Summary collapse

Methods inherited from HttpTransport

#basic_auth_only!, #no_ssl_peer_verification!, #no_sspi_auth!, #receive_timeout, #receive_timeout=

Constructor Details

#initialize(endpoint, realm, service = nil, keytab = nil, opts) ⇒ HttpGSSAPI

rubocop:disable Lint/UnusedMethodArgument



126
127
128
129
130
131
132
133
134
# File 'lib/winrm/http/transport.rb', line 126

def initialize(endpoint, realm, service = nil, keytab = nil, opts)
  # rubocop:enable Lint/UnusedMethodArgument
  super(endpoint)
  # Remove the GSSAPI auth from HTTPClient because we are doing our own thing
  no_sspi_auth!
  service ||= 'HTTP'
  @service = "#{service}/#{@endpoint.host}@#{realm}"
  init_krb
end

Instance Method Details

#send_request(message) ⇒ Object

Sends the SOAP payload to the WinRM service and returns the service’s SOAP response. If an error occurrs an appropriate error is raised.



141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/winrm/http/transport.rb', line 141

def send_request(message)
  resp = send_kerberos_request(message)

  if resp.status == 401
    @logger.debug 'Got 401 - reinitializing Kerberos and retrying one more time'
    init_krb
    resp = send_kerberos_request(message)
  end

  handler = WinRM::ResponseHandler.new(winrm_decrypt(resp.http_body.content), resp.status)
  handler.parse_to_xml
end