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
Constructor Details
#initialize(endpoint, realm, service = nil, keytab = nil, opts) ⇒ HttpGSSAPI
Returns a new instance of HttpGSSAPI.
64 65 66 67 68 69 70 71 72 |
# File 'lib/winrm/http/transport.rb', line 64 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
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/winrm/http/transport.rb', line 78 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
74 75 76 |
# File 'lib/winrm/http/transport.rb', line 74 def set_auth(user,pass) # raise Error end |