lib/sepa/soap_builder.rb
# Add needed information to soap header. Mainly security related stuff. The process is as
# follows:
# 1. The reference id of the security token is set using {#set_token_id} method
# 2. Created and expires timestamps are set. Expires is set to be 5 minutes after creation.
# 3. Timestamp reference id is set with {#set_node_id} method
# 4. The digest of timestamp node is calculated and set to correct node
# 5. The reference id of body is set with {#set_node_id}
# 6. The digest of body is calculated and set to correct node
# 7. The signature of SignedInfo node is calculated and added to correct node
# 8. Own signing certificate is formatted (Begin and end certificate removed and linebreaks
#    removed) and embedded in the soap
# @todo split into smaller methods
Add needed information to soap header. Mainly security related stuff. The process is as
follows:
1. The reference id of the security token is set using {#set_token_id} method
2. Created and expires timestamps are set. Expires is set to be 5 minutes after creation.
3. Timestamp reference id is set with {#set_node_id} method
4. The digest of timestamp node is calculated and set to correct node
5. The reference id of body is set with {#set_node_id}
6. The digest of body is calculated and set to correct node
7. The signature of SignedInfo node is calculated and added to correct node
8. Own signing certificate is formatted (Begin and end certificate removed and linebreaks
removed) and embedded in the soap
Add needed information to soap header . Mainly security related stuff . The process is as follows : 1 . The reference id of the security token is set using { #set_token_id } method 2 . Created and expires timestamps are set . Expires is set to be 5 minutes after creation . 3 . Timestamp reference id is set with { #set_node_id } method 4 . The digest of timestamp node is calculated and set to correct node 5 . The reference id of body is set with { #set_node_id } 6 . The digest of body is calculated and set to correct node 7 . The signature of SignedInfo node is calculated and added to correct node 8 . Own signing certificate is formatted ( Begin and end certificate removed and linebreaks removed ) and embedded in the soap
def process_header
        set_token_id
        set_node(@header_template, 'wsu|Created', iso_time)
        set_node(@header_template, 'wsu|Expires', (Time.now.utc + 300).iso8601)
        timestamp_id = set_node_id(@header_template, OASIS_UTILITY, 'Timestamp', 0)
        timestamp_digest = calculate_digest(@header_template, 'wsu|Timestamp')
        dsig = "dsig|Reference[URI='##{timestamp_id}'] dsig|DigestValue"
        set_node(@header_template, dsig, timestamp_digest)
        body_id = set_node_id(@template, ENVELOPE, 'Body', 1)
        body_digest = calculate_digest(@template, 'env|Body')
        dsig = "dsig|Reference[URI='##{body_id}'] dsig|DigestValue"
        set_node(@header_template, dsig, body_digest)
        signature = calculate_signature(@header_template, 'dsig|SignedInfo')
        set_node(@header_template, 'dsig|SignatureValue', signature)
        formatted_cert = format_cert(@own_signing_certificate)
        set_node(@header_template, 'wsse|BinarySecurityToken', formatted_cert)
      end
def process_header set_token_id set_node ( @header_template , 'wsu|Created' , iso_time ) set_node ( @header_template , 'wsu|Expires' , ( Time . now . utc + 300 ) . iso8601 ) timestamp_id = set_node_id ( @header_template , OASIS_UTILITY , 'Timestamp' , 0 ) timestamp_digest = calculate_digest ( @header_template , 'wsu|Timestamp' ) dsig = "dsig|Reference[URI='##{timestamp_id}'] dsig|DigestValue" set_node ( @header_template , dsig , timestamp_digest ) body_id = set_node_id ( @template , ENVELOPE , 'Body' , 1 ) body_digest = calculate_digest ( @template , 'env|Body' ) dsig = "dsig|Reference[URI='##{body_id}'] dsig|DigestValue" set_node ( @header_template , dsig , body_digest ) signature = calculate_signature ( @header_template , 'dsig|SignedInfo' ) set_node ( @header_template , 'dsig|SignatureValue' , signature ) formatted_cert = format_cert ( @own_signing_certificate ) set_node ( @header_template , 'wsse|BinarySecurityToken' , formatted_cert ) end
Add needed information to soap header.
Add needed information to soap header .
todo
split into smaller methods
split into smaller methods