This repository was archived by the owner on Oct 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
This repository was archived by the owner on Oct 18, 2023. It is now read-only.
It is possible to specify the name of the Id attribute in the Xmldsig gem #7
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Change:
| @doc = NemID::XMLDSig::Document.new(string) |
to:
@doc = NemID::XMLDSig::Document.new(string, id_attr: 'Id')and change:
| @doc = NemID::XMLDSig::Document.new(Base64.decode64(string)) |
to:
@doc = NemID::XMLDSig::Document.new(Base64.decode64(string), id_attr: 'Id')And the following code is not needed anymore:
Lines 12 to 31 in ee4ac33
| # The "referenced_node" method needs to be overridden since NemID uses | |
| # "Id" (as opposed to ID or wsu:Id) as the attribute name in the "Signature" | |
| # element of the XML document. | |
| Xmldsig::Reference.class_eval do | |
| def referenced_node | |
| if reference_uri && reference_uri != "" | |
| id = reference_uri[1..-1] | |
| if ref = document.dup.at_xpath("//*[@ID='#{id}' or @Id='#{id}' or @wsu:Id='#{id}']", NAMESPACES) | |
| ref | |
| else | |
| raise( | |
| ReferencedNodeNotFound, | |
| "Could not find the referenced node #{id}'" | |
| ) | |
| end | |
| else | |
| document.dup.root | |
| end | |
| end | |
| end |
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request