Class: VMware::ClientAuthHeaderHandler

Inherits:
SOAP::Header::SimpleHandler
  • Object
show all
Defined in:
lib/vmware/connection.rb

Overview

Helper class for including username and password in SOAP headers.

Instance Method Summary collapse

Constructor Details

#initialize(userid, passwd) ⇒ ClientAuthHeaderHandler

Returns a new instance of ClientAuthHeaderHandler.



12
13
14
15
16
17
18
19
20
21
# File 'lib/vmware/connection.rb', line 12

def initialize(userid, passwd) 
  namespace = "http://vmware.com/labmanager" 
  headername = "AuthenticationHeader" 
  header = XSD::QName.new(namespace, headername) 
  super(header) 
  @sessionid = nil 
  @userid = userid 
  @passwd = passwd 
  @mustunderstand = true 
end

Instance Method Details

#on_simple_inbound(my_header, mustunderstand) ⇒ Object



31
32
33
# File 'lib/vmware/connection.rb', line 31

def on_simple_inbound(my_header, mustunderstand) 
  @sessionid = my_header["sessionid"] 
end

#on_simple_outboundObject



23
24
25
26
27
28
29
# File 'lib/vmware/connection.rb', line 23

def on_simple_outbound 
  if @sessionid 
    { "sessionid" => @sessionid } 
  else 
    { "username" => @userid, "password" => @passwd } 
  end 
end