This repository has been archived by the owner on May 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SANTUARIO-532 User-defined and delayed evaluation of which XML elemen…
…ts need to be secured
- Loading branch information
1 parent
cc40b75
commit 4f7f5c3
Showing
52 changed files
with
2,007 additions
and
420 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/main/java/org/apache/xml/security/stax/ext/ElementSelector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.apache.xml.security.stax.ext; | ||
|
||
import org.w3c.dom.Element; | ||
|
||
import javax.xml.namespace.QName; | ||
|
||
/** | ||
* This interface allows implementors to select secure parts based on an element's qualified name and skeleton DOM | ||
* element, returning a {@link SecurePart} upon match or {@code null} otherwise. | ||
* | ||
* @author Peter De Maeyer | ||
*/ | ||
public interface ElementSelector { | ||
|
||
/** | ||
* Gets the required number of occurrences, or {@code -1} for no such requirement. | ||
* The number of occurrences is verified after processing the entire XML document. | ||
* Processing will fail when the number of occurrences mismatches the required number. | ||
* Use {@code 0} to verify that a secure part <i>never</i> occurs. | ||
* Use {@code -1} to disable verification altogether. | ||
* The recommended default for all implementations is {@code -1} | ||
* | ||
* @return a number of required secure parts, or {@code -1} for no particular number of required secure parts. | ||
*/ | ||
int getRequiredNumOccurrences(); | ||
|
||
/** | ||
* Selects the given element for encryption or signing when the return value is non-{@code null}, | ||
* or does not select it when the return value is {@code null}. | ||
* The given element is a combination of qualified name and skeleton DOM element. | ||
* The structure of the skeleton DOM element depends on the | ||
* {@link org.apache.xml.security.stax.ext.XMLSecurityProperties.ElementModifier} set on | ||
* {@link XMLSecurityProperties}, and is possibly {@code null}. | ||
* The skeleton DOM element has no content, it only has: | ||
* <ol> | ||
* <li>local name, namespace URI and prefix;</li> | ||
* <li>attributes;</li> | ||
* <li>namespace declarations (which are just a special type of attributes).</li> | ||
* </ol> | ||
* | ||
* @param name the qualified name, never {@code null}. | ||
* @param element the skeleton DOM element, possibly {@code null}. | ||
* @return {@code true} to select the given skeleton element for encryption or signing, {@code false} otherwise | ||
*/ | ||
boolean select(QName name, Element element); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/main/java/org/apache/xml/security/stax/ext/SecurePartFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.apache.xml.security.stax.ext; | ||
|
||
import org.w3c.dom.Element; | ||
|
||
import javax.xml.namespace.QName; | ||
|
||
/** | ||
* @author Peter De Maeyer | ||
*/ | ||
public interface SecurePartFactory { | ||
|
||
SecurePart create(QName name, Element element); | ||
} |
Oops, something went wrong.