Class: Akami::WSSE
- Inherits:
-
Object
- Object
- Akami::WSSE
- Defined in:
- lib/akami/wsse.rb,
lib/akami/wsse/certs.rb,
lib/akami/wsse/signature.rb,
lib/akami/wsse/verify_signature.rb
Overview
Akami::WSSE
Building Web Service Security.
Defined Under Namespace
Classes: Certs, InvalidSignature, Signature, VerifySignature
Constant Summary collapse
- WSE_NAMESPACE =
Namespace for WS Security Secext.
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
- WSU_NAMESPACE =
Namespace for WS Security Utility.
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
- PASSWORD_TEXT_URI =
PasswordText URI.
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"
- PASSWORD_DIGEST_URI =
PasswordDigest URI.
"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.
-
#signature ⇒ Object
Returns the value of attribute signature.
-
#username ⇒ Object
Returns the value of attribute username.
-
#verify_response ⇒ Object
Returns the value of attribute verify_response.
Instance Method Summary collapse
-
#[](key) ⇒ Object
Returns a value from the WSSE Hash.
-
#[]=(key, value) ⇒ Object
Sets a value on the WSSE Hash.
-
#body_attributes ⇒ Object
Hook for Soap::XML that allows us to add attributes to the env:Body tag.
-
#credentials(username, password, digest = false) ⇒ Object
Sets authentication credentials for a wsse:UsernameToken header.
-
#digest? ⇒ Boolean
Returns whether to use WSSE digest.
- #sign_with=(klass) ⇒ Object
- #signature? ⇒ Boolean
-
#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.
49 50 51 |
# File 'lib/akami/wsse.rb', line 49 def created_at @created_at end |
#digest=(value) ⇒ Object (writeonly)
Sets the attribute digest
64 65 66 |
# File 'lib/akami/wsse.rb', line 64 def digest=(value) @digest = value end |
#expires_at ⇒ Object
Returns the value of attribute expires_at.
49 50 51 |
# File 'lib/akami/wsse.rb', line 49 def expires_at @expires_at end |
#password ⇒ Object
Returns the value of attribute password.
49 50 51 |
# File 'lib/akami/wsse.rb', line 49 def password @password end |
#signature ⇒ Object
Returns the value of attribute signature.
49 50 51 |
# File 'lib/akami/wsse.rb', line 49 def signature @signature end |
#username ⇒ Object
Returns the value of attribute username.
49 50 51 |
# File 'lib/akami/wsse.rb', line 49 def username @username end |
#verify_response ⇒ Object
Returns the value of attribute verify_response.
49 50 51 |
# File 'lib/akami/wsse.rb', line 49 def verify_response @verify_response end |
Instance Method Details
#[](key) ⇒ Object
Returns a value from the WSSE Hash.
32 33 34 |
# File 'lib/akami/wsse.rb', line 32 def [](key) hash[key] end |
#[]=(key, value) ⇒ Object
Sets a value on the WSSE Hash.
37 38 39 |
# File 'lib/akami/wsse.rb', line 37 def []=(key, value) hash[key] = value end |
#body_attributes ⇒ Object
Hook for Soap::XML that allows us to add attributes to the env:Body tag
82 83 84 85 86 87 88 |
# File 'lib/akami/wsse.rb', line 82 def body_attributes if signature? signature.body_attributes else {} end end |
#credentials(username, password, digest = false) ⇒ Object
Sets authentication credentials for a wsse:UsernameToken header. Also accepts whether to use WSSE digest authentication.
43 44 45 46 47 |
# File 'lib/akami/wsse.rb', line 43 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
.
60 61 62 |
# File 'lib/akami/wsse.rb', line 60 def digest? !!@digest end |
#sign_with=(klass) ⇒ Object
51 52 53 |
# File 'lib/akami/wsse.rb', line 51 def sign_with=(klass) @signature = klass end |
#signature? ⇒ Boolean
55 56 57 |
# File 'lib/akami/wsse.rb', line 55 def signature? !!@signature end |
#timestamp=(timestamp) ⇒ Object
Sets whether to generate a wsu:Timestamp header.
77 78 79 |
# File 'lib/akami/wsse.rb', line 77 def () @wsu_timestamp = end |
#timestamp? ⇒ Boolean
Returns whether to generate a wsu:Timestamp header.
72 73 74 |
# File 'lib/akami/wsse.rb', line 72 def created_at || expires_at || @wsu_timestamp end |
#to_xml ⇒ Object
Returns the XML for a WSSE header.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/akami/wsse.rb', line 91 def to_xml if signature? and signature.have_document? Gyoku.xml wsse_signature.merge!(hash) elsif 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.
67 68 69 |
# File 'lib/akami/wsse.rb', line 67 def username_token? username && password end |