Module: Savon::WSSE

Included in:
SOAP
Defined in:
lib/savon/wsse.rb

Overview

Savon::WSSE

Includes support methods for adding WSSE authentication to a SOAP request.

Constant Summary collapse

WSENamespace =

Namespace for WS Security Secext.

"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
WSUNamespace =

Namespace for WS Security Utility.

"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.digest=(value) ⇒ Object (writeonly)

Sets whether to use WSSE digest by default.



32
33
34
# File 'lib/savon/wsse.rb', line 32

def digest=(value)
  @digest = value
end

.passwordObject

Accessor for the default WSSE password.



29
30
31
# File 'lib/savon/wsse.rb', line 29

def password
  @password
end

.usernameObject

Accessor for the default WSSE username.



26
27
28
# File 'lib/savon/wsse.rb', line 26

def username
  @username
end

Class Method Details

.digest?Boolean

Returns whether to use WSSE digest by default.

Returns:

  • (Boolean)


35
36
37
# File 'lib/savon/wsse.rb', line 35

def digest?
  @digest
end

Instance Method Details

#wsse?Boolean

Returns whether WSSE authentication was set via options.

Returns:

  • (Boolean)


42
43
44
45
# File 'lib/savon/wsse.rb', line 42

def wsse?
  options[:wsse] = {} unless options[:wsse].kind_of? Hash
  wsse_username && wsse_password
end

#wsse_header(xml) ⇒ Object

Takes a Builder::XmlMarkup instance and appends a WSSE header.



48
49
50
51
52
53
54
55
56
# File 'lib/savon/wsse.rb', line 48

def wsse_header(xml)
  options[:wsse] = {} unless options[:wsse].kind_of? Hash

  xml.wsse :Security, "xmlns:wsse" => WSENamespace do
    xml.wsse :UsernameToken, "xmlns:wsu" => WSUNamespace do
      wsse_nodes xml
    end
  end
end