Skip to content

cert and timestamp can't be together? #15

Open
@rderoldan1

Description

@rderoldan1

@tjarratt I just found something that I consider an issue, if signature and timestamp are true, just signature header is returned

  # Returns the XML for a WSSE header.
    def to_xml
      if signature? and signature.have_document?
         Gyoku.xml wsse_signature1.merge!(hash)
      elsif username_token? && timestamp?
          Gyoku.xml wsse_username_token.merge!(wsu_timestamp) {
          |key, v1, v2| v1.merge!(v2) {
            |key, v1, v2| v1.merge!(v2)
          }
        }
      elsif username_token?
        Gyoku.xml wsse_username_token.merge!(hash)
      elsif timestamp?
        Gyoku.xml wsu_timestamp.merge!(hash)
      else
        ""
      end
    end

The if clause is not considering the case of have signed? and timestamp?, I fix it (in a really ugly way) but for testing purposes it works, I don't know if is not really comment to have timestamps and the cert headers together, but what do you think?

# Returns the XML for a WSSE header.
    def to_xml
      if signature? and signature.have_document?
        if timestamp?
          wsse_signature1 = {}
          wsse_signature1["wsse:Security"] = wsse_signature["wsse:Security"].merge!(wsu_timestamp["wsse:Security"])
          wsse_signature1["wsse:Security"][:order!] << "wsu:Timestamp"
          Gyoku.xml wsse_signature1
        else
          Gyoku.xml wsse_signature.merge!(hash)
        end
      elsif username_token? && timestamp?
          Gyoku.xml wsse_username_token.merge!(wsu_timestamp) {
          |key, v1, v2| v1.merge!(v2) {
            |key, v1, v2| v1.merge!(v2)
          }
        }
      elsif username_token?
        Gyoku.xml wsse_username_token.merge!(hash)
      elsif timestamp?
        Gyoku.xml wsu_timestamp.merge!(hash)
      else
        ""
      end
    end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions