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 /* 21 * XSEC 22 * 23 * XSECURIResolver := Virtual Interface class that takes a URI and 24 * creates a binary input stream from it. 25 * 26 * $Id: XSECURIResolver.hpp 1819345 2017-12-27 16:48:05Z scantor $ 27 */ 28 29 #ifndef XSECURIRESOLVER_INCLUDE 30 #define XSECURIRESOLVER_INCLUDE 31 32 #include <xsec/framework/XSECDefs.hpp> 33 34 XSEC_DECLARE_XERCES_CLASS(BinInputStream); 35 36 /** 37 * @ingroup pubsig 38 */ 39 /*\@{*/ 40 41 /** 42 * @brief Interface class for resolving URIs. 43 * 44 * The XML Digital Signature standard makes heavy use of URIs to 45 * identify information to be referenced and signed. 46 * 47 * The library internally handles reference URIs within the 48 * document that contains the signature, but uses URIResolver 49 * classes to dereference a URI into a byte stream that can 50 * then be processed. 51 * 52 * The interface class allows others to re-implement and install 53 * their own resolves according to their needs. The basic 54 * implementations found in the library are just that - very basic. 55 * Enough to do the job for interoperability testing, but not 56 * enough to provide robustness in a major application. 57 * 58 */ 59 60 class XSEC_EXPORT XSECURIResolver { 61 62 public: 63 64 /** @name Constructors and Destructors */ 65 //@{ 66 XSECURIResolver()67 XSECURIResolver() {}; ~XSECURIResolver()68 virtual ~XSECURIResolver() {}; 69 70 //@} 71 72 /** @name Interface Methods */ 73 //@{ 74 75 /** 76 * \brief Create a BYTE_STREAM from a URI. 77 * 78 * The resolver is required to take the input URI and 79 * dereference it to an actual stream of octets. 80 * 81 * The octets are provided back to the library using 82 * the Xerces BinInputStream class. 83 * 84 * @note The returned stream is "owned" by the caller, which 85 * will delete it when processing is complete. 86 * @param uri The string containing the URI to be de-referenced. NULL 87 * if this is an anonymous reference. 88 * @returns The octet stream corresponding to the URI. 89 */ 90 91 virtual XERCES_CPP_NAMESPACE_QUALIFIER BinInputStream* 92 resolveURI(const XMLCh* uri) = 0; 93 94 /** 95 * \brief Set the base URI for relative URIs. 96 * 97 */ 98 99 virtual void setBaseURI(const XMLCh* uri) = 0; 100 101 /** 102 * \brief Clone the resolver to be installed in a new object. 103 * 104 * When URIResolvers are passed into signatures and other 105 * objects, they are cloned and control of the original object 106 * is left with the caller. 107 * 108 */ 109 110 virtual XSECURIResolver* clone() = 0; 111 112 //@} 113 114 }; 115 116 117 #endif /* XSECURIRESOLVER_INCLUDE */ 118