Class: WinRM::HTTP::HttpGSSAPI
- Inherits:
-
HttpTransport
- Object
- HttpTransport
- WinRM::HTTP::HttpGSSAPI
- Defined in:
- lib/winrm/http/transport.rb
Overview
Uses Kerberos/GSSAPI to authenticate and encrypt messages
Instance Attribute Summary
Attributes inherited from HttpTransport
Instance Method Summary collapse
-
#initialize(endpoint, realm, service = nil, keytab = nil, opts) ⇒ HttpGSSAPI
constructor
A new instance of HttpGSSAPI.
- #send_request(msg) ⇒ Object
- #set_auth(user, pass) ⇒ Object
Methods inherited from HttpTransport
#basic_auth_only!, #no_sspi_auth!
Constructor Details
#initialize(endpoint, realm, service = nil, keytab = nil, opts) ⇒ HttpGSSAPI
Returns a new instance of HttpGSSAPI.
91 92 93 94 95 96 97 98 99 |
# File 'lib/winrm/http/transport.rb', line 91 def initialize(endpoint, realm, service = nil, keytab = nil, opts) super(endpoint) # Remove the GSSAPI auth from HTTPClient because we are doing our own thing auths = @httpcli.www_auth.instance_variable_get('@authenticator') auths.delete_if {|i| i.is_a?(HTTPClient::SSPINegotiateAuth)} service ||= 'HTTP' @service = "#{service}/#{@endpoint.host}@#{realm}" init_krb end |
Instance Method Details
#send_request(msg) ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/winrm/http/transport.rb', line 105 def send_request(msg) original_length = msg.length pad_len, emsg = winrm_encrypt(msg) hdr = { "Connection" => "Keep-Alive", "Content-Type" => "multipart/encrypted;protocol=\"application/HTTP-Kerberos-session-encrypted\";boundary=\"Encrypted Boundary\"" } body = <<-EOF --Encrypted Boundary\r Content-Type: application/HTTP-Kerberos-session-encrypted\r OriginalContent: type=application/soap+xml;charset=UTF-8;Length=#{original_length + pad_len}\r --Encrypted Boundary\r Content-Type: application/octet-stream\r #{emsg}--Encrypted Boundary\r EOF r = @httpcli.post(@endpoint, body, hdr) winrm_decrypt(r.http_body.content) end |
#set_auth(user, pass) ⇒ Object
101 102 103 |
# File 'lib/winrm/http/transport.rb', line 101 def set_auth(user,pass) # raise Error end |