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 wsse:Timestamp header.
-
#timestamp? ⇒ Boolean
Returns whether to generate a wsse: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.
45 46 47 |
# File 'lib/savon/wsse.rb', line 45 def created_at @created_at end |
#digest=(value) ⇒ Object (writeonly)
Sets the attribute digest
52 53 54 |
# File 'lib/savon/wsse.rb', line 52 def digest=(value) @digest = value end |
#expires_at ⇒ Object
Returns the value of attribute expires_at.
45 46 47 |
# File 'lib/savon/wsse.rb', line 45 def expires_at @expires_at end |
#password ⇒ Object
Returns the value of attribute password.
45 46 47 |
# File 'lib/savon/wsse.rb', line 45 def password @password end |
#username ⇒ Object
Returns the value of attribute username.
45 46 47 |
# File 'lib/savon/wsse.rb', line 45 def username @username end |
Instance Method Details
#[](key) ⇒ Object
Returns a value from the WSSE Hash.
28 29 30 |
# File 'lib/savon/wsse.rb', line 28 def [](key) hash[key] end |
#[]=(key, value) ⇒ Object
Sets a value on the WSSE Hash.
33 34 35 |
# File 'lib/savon/wsse.rb', line 33 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.
39 40 41 42 43 |
# File 'lib/savon/wsse.rb', line 39 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
.
48 49 50 |
# File 'lib/savon/wsse.rb', line 48 def digest? !!@digest end |
#timestamp=(timestamp) ⇒ Object
Sets whether to generate a wsse:Timestamp header.
65 66 67 |
# File 'lib/savon/wsse.rb', line 65 def () @wsse_timestamp = end |
#timestamp? ⇒ Boolean
Returns whether to generate a wsse:Timestamp header.
60 61 62 |
# File 'lib/savon/wsse.rb', line 60 def created_at || expires_at || @wsse_timestamp end |
#to_xml ⇒ Object
Returns the XML for a WSSE header.
70 71 72 73 74 75 76 77 78 |
# File 'lib/savon/wsse.rb', line 70 def to_xml if 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.
55 56 57 |
# File 'lib/savon/wsse.rb', line 55 def username_token? username && password end |