Class: Savon::WSSE
- Inherits:
-
Object
- Object
- Savon::WSSE
- Defined in:
- lib/savon/wsse.rb
Overview
Savon::WSSE
Provides 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"
- PasswordTextURI =
URI for “wsse:Password/@Type” #PasswordText.
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"
- PasswordDigestURI =
URI for “wsse:Password/@Type” #PasswordDigest.
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"
Instance Attribute Summary collapse
-
#digest ⇒ Object
writeonly
Sets the attribute digest.
-
#password ⇒ Object
Returns the value of attribute password.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#credentials(username, password, digest = false) ⇒ Object
Sets the authentication credentials.
-
#digest? ⇒ Boolean
Returns whether to use WSSE digest.
-
#to_xml ⇒ Object
Returns the XML for a WSSE header or an empty String unless authentication credentials were specified.
Instance Attribute Details
#digest=(value) ⇒ Object (writeonly)
Sets the attribute digest
41 42 43 |
# File 'lib/savon/wsse.rb', line 41 def digest=(value) @digest = value end |
#password ⇒ Object
Returns the value of attribute password.
34 35 36 |
# File 'lib/savon/wsse.rb', line 34 def password @password end |
#username ⇒ Object
Returns the value of attribute username.
34 35 36 |
# File 'lib/savon/wsse.rb', line 34 def username @username end |
Instance Method Details
#credentials(username, password, digest = false) ⇒ Object
Sets the authentication credentials. Also accepts whether to use WSSE digest.
28 29 30 31 32 |
# File 'lib/savon/wsse.rb', line 28 def credentials(username, password, digest = false) self.username = username self.password = password self.digest = digest end |
#digest? ⇒ Boolean
Returns whether to use WSSE digest. Defaults to false
.
37 38 39 |
# File 'lib/savon/wsse.rb', line 37 def digest? !!@digest end |
#to_xml ⇒ Object
Returns the XML for a WSSE header or an empty String unless authentication credentials were specified.
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/savon/wsse.rb', line 45 def to_xml return "" unless username && password builder = Builder::XmlMarkup.new builder.wsse :Security, "xmlns:wsse" => WSENamespace do |xml| xml.wsse :UsernameToken, "wsu:Id" => wsu_id, "xmlns:wsu" => WSUNamespace do xml.wsse :Username, username xml.wsse :Nonce, nonce xml.wsu :Created, xml.wsse :Password, password_node, :Type => password_type end end end |