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
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#digest ⇒ Object
writeonly
Sets the attribute digest.
-
#expires_at ⇒ Object
Returns the value of attribute expires_at.
-
#password ⇒ Object
Returns the value of attribute password.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#[](key) ⇒ Object
Returns a value from the WSSE Hash.
-
#[]=(key, value) ⇒ Object
Sets a value on the WSSE Hash.
-
#credentials(username, password, digest = false) ⇒ Object
Sets authentication credentials for a wsse:UsernameToken header.
-
#digest? ⇒ Boolean
Returns whether to use WSSE digest.
-
#timestamp=(timestamp) ⇒ Object
Sets whether to generate a wsu:Timestamp header.
-
#timestamp? ⇒ Boolean
Returns whether to generate a wsu:Timestamp header.
-
#to_xml ⇒ Object
Returns the XML for a WSSE header.
-
#username_token? ⇒ Boolean
Returns whether to generate a wsse:UsernameToken header.
Instance Attribute Details
#created_at ⇒ Object
Returns the value of attribute created_at.
44 45 46 |
# File 'lib/savon/wsse.rb', line 44 def created_at @created_at end |
#digest=(value) ⇒ Object (writeonly)
Sets the attribute digest
51 52 53 |
# File 'lib/savon/wsse.rb', line 51 def digest=(value) @digest = value end |
#expires_at ⇒ Object
Returns the value of attribute expires_at.
44 45 46 |
# File 'lib/savon/wsse.rb', line 44 def expires_at @expires_at end |
#password ⇒ Object
Returns the value of attribute password.
44 45 46 |
# File 'lib/savon/wsse.rb', line 44 def password @password end |
#username ⇒ Object
Returns the value of attribute username.
44 45 46 |
# File 'lib/savon/wsse.rb', line 44 def username @username end |
Instance Method Details
#[](key) ⇒ Object
Returns a value from the WSSE Hash.
27 28 29 |
# File 'lib/savon/wsse.rb', line 27 def [](key) hash[key] end |
#[]=(key, value) ⇒ Object
Sets a value on the WSSE Hash.
32 33 34 |
# File 'lib/savon/wsse.rb', line 32 def []=(key, value) hash[key] = value end |
#credentials(username, password, digest = false) ⇒ Object
Sets authentication credentials for a wsse:UsernameToken header. Also accepts whether to use WSSE digest authentication.
38 39 40 41 42 |
# File 'lib/savon/wsse.rb', line 38 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
.
47 48 49 |
# File 'lib/savon/wsse.rb', line 47 def digest? !!@digest end |
#timestamp=(timestamp) ⇒ Object
Sets whether to generate a wsu:Timestamp header.
64 65 66 |
# File 'lib/savon/wsse.rb', line 64 def () @wsu_timestamp = end |
#timestamp? ⇒ Boolean
Returns whether to generate a wsu:Timestamp header.
59 60 61 |
# File 'lib/savon/wsse.rb', line 59 def created_at || expires_at || @wsu_timestamp end |
#to_xml ⇒ Object
Returns the XML for a WSSE header.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/savon/wsse.rb', line 69 def to_xml if username_token? && Gyoku.xml wsse_username_token.merge!() { |key, v1, v2| v1.merge!(v2) { |key, v1, v2| v1.merge!(v2) } } elsif username_token? Gyoku.xml wsse_username_token.merge!(hash) elsif Gyoku.xml .merge!(hash) else "" end end |
#username_token? ⇒ Boolean
Returns whether to generate a wsse:UsernameToken header.
54 55 56 |
# File 'lib/savon/wsse.rb', line 54 def username_token? username && password end |