KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xerces > parsers > SecurityConfiguration


1 /*
2  * Copyright 2001-2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.xerces.parsers;
18
19 import org.apache.xerces.impl.Constants;
20 import org.apache.xerces.xni.grammars.XMLGrammarPool;
21 import org.apache.xerces.xni.parser.XMLComponentManager;
22 import org.apache.xerces.util.SecurityManager;
23 import org.apache.xerces.util.SymbolTable;
24
25 /**
26  * This configuration allows Xerces to behave in a security-conscious manner; that is,
27  * it permits applications to instruct Xerces to limit certain
28  * operations that could be exploited by malicious document authors to cause a denail-of-service
29  * attack when the document is parsed.
30  *
31  * In addition to the features and properties recognized by the base
32  * parser configuration, this class recognizes these additional
33  * features and properties:
34  * <ul>
35  * <li>Properties
36  * <ul>
37  * <li>http://apache.org/xml/properties/security-manager</li>
38  * </ul>
39  * </ul>
40  *
41  * @author Neil Graham, IBM
42  *
43  * @version $Id: SecurityConfiguration.java,v 1.6 2005/05/04 03:56:45 mrglavas Exp $
44  */

45 public class SecurityConfiguration extends XIncludeAwareParserConfiguration
46 {
47
48     //
49
// Constants
50
//
51

52     protected static final String JavaDoc SECURITY_MANAGER_PROPERTY =
53         Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
54
55     //
56
// Constructors
57
//
58

59     /** Default constructor. */
60     public SecurityConfiguration () {
61         this(null, null, null);
62     } // <init>()
63

64     /**
65      * Constructs a parser configuration using the specified symbol table.
66      *
67      * @param symbolTable The symbol table to use.
68      */

69     public SecurityConfiguration (SymbolTable symbolTable) {
70         this(symbolTable, null, null);
71     } // <init>(SymbolTable)
72

73     /**
74      * Constructs a parser configuration using the specified symbol table and
75      * grammar pool.
76      * <p>
77      * <strong>REVISIT:</strong>
78      * Grammar pool will be updated when the new validation engine is
79      * implemented.
80      *
81      * @param symbolTable The symbol table to use.
82      * @param grammarPool The grammar pool to use.
83      */

84     public SecurityConfiguration (SymbolTable symbolTable,
85                                          XMLGrammarPool grammarPool) {
86         this(symbolTable, grammarPool, null);
87     } // <init>(SymbolTable,XMLGrammarPool)
88

89     /**
90      * Constructs a parser configuration using the specified symbol table,
91      * grammar pool, and parent settings.
92      * <p>
93      * <strong>REVISIT:</strong>
94      * Grammar pool will be updated when the new validation engine is
95      * implemented.
96      *
97      * @param symbolTable The symbol table to use.
98      * @param grammarPool The grammar pool to use.
99      * @param parentSettings The parent settings.
100      */

101     public SecurityConfiguration (SymbolTable symbolTable,
102                                          XMLGrammarPool grammarPool,
103                                          XMLComponentManager parentSettings) {
104         super(symbolTable, grammarPool, parentSettings);
105         
106         // create the SecurityManager property:
107
setProperty(SECURITY_MANAGER_PROPERTY, new SecurityManager JavaDoc());
108     } // <init>(SymbolTable,XMLGrammarPool)
109

110 } // class SecurityConfiguration
111

112
Popular Tags