Class: Savon::WSSE
Overview
Savon::WSSE
Represents parameters for WSSE authentication.
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"
- @@username =
Global WSSE username.
nil
- @@password =
Global WSSE password.
nil
- @@digest =
Global setting of whether to use WSSE digest.
false
Instance Attribute Summary collapse
-
#digest ⇒ Object
writeonly
Sets whether to use WSSE digest per request.
Class Method Summary collapse
-
.digest=(digest) ⇒ Object
Global setting of whether to use WSSE digest.
-
.digest? ⇒ Boolean
Returns the global setting of whether to use WSSE digest.
-
.password ⇒ Object
Returns the global WSSE password.
-
.password=(password) ⇒ Object
Sets the global WSSE password.
-
.username ⇒ Object
Returns the global WSSE username.
-
.username=(username) ⇒ Object
Sets the global WSSE username.
Instance Method Summary collapse
-
#digest? ⇒ Boolean
Returns whether to use WSSE digest.
-
#header ⇒ Object
Returns the XML for a WSSE header or an empty String unless both username and password were specified.
-
#password ⇒ Object
Returns the WSSE password.
-
#password=(password) ⇒ Object
Sets the WSSE password per request.
-
#username ⇒ Object
Returns the WSSE username.
-
#username=(username) ⇒ Object
Sets the WSSE username per request.
Instance Attribute Details
#digest=(value) ⇒ Object (writeonly)
Sets whether to use WSSE digest per request.
78 79 80 |
# File 'lib/savon/wsse.rb', line 78 def digest=(value) @digest = value end |
Class Method Details
.digest=(digest) ⇒ Object
Global setting of whether to use WSSE digest.
51 52 53 |
# File 'lib/savon/wsse.rb', line 51 def self.digest=(digest) @@digest = digest end |
.digest? ⇒ Boolean
Returns the global setting of whether to use WSSE digest.
46 47 48 |
# File 'lib/savon/wsse.rb', line 46 def self.digest? @@digest end |
.password ⇒ Object
Returns the global WSSE password.
32 33 34 |
# File 'lib/savon/wsse.rb', line 32 def self.password @@password end |
.password=(password) ⇒ Object
Sets the global WSSE password.
37 38 39 40 |
# File 'lib/savon/wsse.rb', line 37 def self.password=(password) @@password = password.to_s if password.respond_to? :to_s @@password = nil if password.nil? end |
.username ⇒ Object
Returns the global WSSE username.
18 19 20 |
# File 'lib/savon/wsse.rb', line 18 def self.username @@username end |
.username=(username) ⇒ Object
Sets the global WSSE username.
23 24 25 26 |
# File 'lib/savon/wsse.rb', line 23 def self.username=(username) @@username = username.to_s if username.respond_to? :to_s @@username = nil if username.nil? end |
Instance Method Details
#digest? ⇒ Boolean
Returns whether to use WSSE digest. Defaults to the global setting.
81 82 83 |
# File 'lib/savon/wsse.rb', line 81 def digest? @digest || self.class.digest? end |
#header ⇒ Object
Returns the XML for a WSSE header or an empty String unless both username and password were specified.
87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/savon/wsse.rb', line 87 def header return "" unless username && password builder = Builder::XmlMarkup.new builder.wsse :Security, "xmlns:wsse" => WSENamespace do |xml| xml.wsse :UsernameToken, "xmlns:wsu" => WSUNamespace do xml.wsse :Username, username xml.wsse :Nonce, nonce xml.wsu :Created, xml.wsse :Password, password_node end end end |
#password ⇒ Object
Returns the WSSE password. Defaults to the global setting.
73 74 75 |
# File 'lib/savon/wsse.rb', line 73 def password @password || self.class.password end |
#password=(password) ⇒ Object
Sets the WSSE password per request.
67 68 69 70 |
# File 'lib/savon/wsse.rb', line 67 def password=(password) @password = password.to_s if password.respond_to? :to_s @password = nil if password.nil? end |
#username ⇒ Object
Returns the WSSE username. Defaults to the global setting.
62 63 64 |
# File 'lib/savon/wsse.rb', line 62 def username @username || self.class.username end |
#username=(username) ⇒ Object
Sets the WSSE username per request.
56 57 58 59 |
# File 'lib/savon/wsse.rb', line 56 def username=(username) @username = username.to_s if username.respond_to? :to_s @username = nil if username.nil? end |