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 34
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
282cc09
commit e9b0747
Showing
53 changed files
with
2,033 additions
and
385 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
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
88 changes: 88 additions & 0 deletions
88
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,88 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.xml.security.stax.ext; | ||
|
||
import org.w3c.dom.Element; | ||
|
||
import javax.xml.namespace.QName; | ||
|
||
/** | ||
* This interface allows implementors to select <i>which</i> elements to secure, based on an element's qualified name | ||
* and skeleton DOM element. | ||
*/ | ||
public interface ElementSelector { | ||
|
||
/** | ||
* Selects a given element for securing. | ||
* The given element is a combination of qualified name and skeleton DOM element. | ||
* The skeleton DOM element has no content nor comments, 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> | ||
* The hierarchical structure of the skeleton DOM element depends on the | ||
* {@link org.apache.xml.security.stax.ext.XMLSecurityProperties.ElementModifier} set on | ||
* {@link XMLSecurityProperties}. | ||
* The qualified name and/or skeleton DOM element may be {@code null} | ||
* The skeleton DOM element may be {@code null}, if an only if the qualified name is {@code null} or the element | ||
* modifier is set to {@code null} using | ||
* {@link XMLSecurityProperties#setElementModifier(XMLSecurityProperties.ElementModifier)}. | ||
* <table> | ||
* <tr> | ||
* <th>Name</th> | ||
* <th>Element</th> | ||
* <th>Meaning</th> | ||
* </tr> | ||
* <tr> | ||
* <td>Not {@code null}</td> | ||
* <td>Not {@code null}</td> | ||
* <td> | ||
* A regular element, when the element modifier has a regular non-null value. | ||
* The framework calls this method for every element in the document. | ||
* </td> | ||
* </tr> | ||
* <tr> | ||
* <td>Not {@code null}</td> | ||
* <td>{@code null}</td> | ||
* <td> | ||
* A regular element, when the element modifier has explicitly been set to {@code null} using | ||
* {@link XMLSecurityProperties#setElementModifier(XMLSecurityProperties.ElementModifier)}. | ||
* The framework calls this method for every element in the document. | ||
* </td> | ||
* </tr> | ||
* <tr> | ||
* <td>{@code null}</td> | ||
* <td>{@code null}</td> | ||
* <td> | ||
* The document element. | ||
* The framework may call this method once for the whole document, even if it has no elements. | ||
* When the qualified name is {@code null}, the skeleton DOM element is also {@code null}. | ||
* In practice, it is only used by the signature action when finalizing processing, to resolve any | ||
* external references which are global to the document but not bound to any specific element. | ||
* </td> | ||
* </tr> | ||
* </table> | ||
* | ||
* @param name The qualified name, possibly {@code null}. | ||
* @param element The skeleton DOM element, possibly {@code null}. | ||
* @return {@code true} to select the given skeleton element for securing, {@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
Oops, something went wrong.