1 /** 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 20 package org.apache.wss4j.dom.callback; 21 22 import java.util.List; 23 24 import javax.xml.crypto.dom.DOMCryptoContext; 25 26 import org.apache.wss4j.common.ext.WSSecurityException; 27 import org.w3c.dom.Element; 28 29 /** 30 * This interface defines a pluggable way of locating Elements that are referenced via an Id. 31 */ 32 public interface CallbackLookup { 33 34 /** 35 * Get the DOM element that corresponds to the given id and ValueType reference. The Id can 36 * be a wsu:Id or else an Id attribute, or a SAML Id when the ValueType refers to a SAML 37 * Assertion. 38 * 39 * @param id The id of the element to locate 40 * @param valueType The ValueType attribute of the element to locate (can be null) 41 * @param checkMultipleElements If true then go through the entire tree and return 42 * null if there are multiple elements with the same Id 43 * @return the located element 44 * @throws WSSecurityException 45 */ 46 Element getElement(String id, String valueType, boolean checkMultipleElements) throws WSSecurityException; 47 48 /** 49 * Get the DOM element that corresponds to the given id and ValueType reference. The Id can 50 * be a wsu:Id or else an Id attribute, or a SAML Id when the ValueType refers to a SAML 51 * Assertion. The implementation is also responsible to register the retrieved Element on the 52 * DOMCryptoContext argument, so that the XML Signature implementation can find the Element. 53 * 54 * @param id The id of the element to locate 55 * @param valueType The ValueType attribute of the element to locate (can be null) 56 * @param checkMultipleElements If true then go through the entire tree and return 57 * null if there are multiple elements with the same Id 58 * @param context The DOMCryptoContext to store the Element in 59 * @return the located element 60 * @throws WSSecurityException 61 */ 62 Element getAndRegisterElement( 63 String id, String valueType, boolean checkMultipleElements, DOMCryptoContext context 64 ) throws WSSecurityException; 65 66 /** 67 * Get the DOM element(s) that correspond to the given localname/namespace. 68 * @param localname The localname of the Element(s) 69 * @param namespace The namespace of the Element(s) 70 * @return the located element(s) 71 * @throws WSSecurityException 72 */ 73 List<Element> getElements( 74 String localname, String namespace 75 ) throws WSSecurityException; 76 77 /** 78 * Get the SOAP Body 79 */ 80 Element getSOAPBody(); 81 }