Source Code Cross Referenced for httpdSecurityManager.java in  » Web-Server » Jigsaw » org » w3c » jigsaw » http » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Server » Jigsaw » org.w3c.jigsaw.http 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // httpdSecurityManager.java
002:        // $Id: httpdSecurityManager.java,v 1.3 2002/06/19 14:22:46 ylafon Exp $
003:        // (c) COPYRIGHT MIT and INRIA, 1996.
004:        // Please first read the full copyright statement in file COPYRIGHT.html
005:
006:        package org.w3c.jigsaw.http;
007:
008:        /**
009:         * The <b>jhttpd</b> security manager. 
010:         * You really need this if you plan to accept agent execution on your server.
011:         * Although, in next versions, the security manager may be used to limit
012:         * your server users in what entities they can export.
013:         * <p>Add the <b>-s</b> command line argument to <b>jhttpd</b> invocation to 
014:         * set the security manager to an instance of this class.
015:         */
016:
017:        public class httpdSecurityManager extends SecurityManager {
018:            /**
019:             * Name of the property indicating if agents are allowed to accept().
020:             * When <strong>true</strong>, this property indicates that agents are
021:             * allowed to use the <em>accept</em> method of ServerSockets.
022:             * <p>This property defaults to <strong>false</strong>.
023:             */
024:            public static final String SM_AGENT_ACCEPT_P = "org.w3c.jigsaw.security.agent.accept";
025:            /**
026:             * Name of the property indicating if agents are allowed to write().
027:             * When <strong>true</strong>, this property indicates that agents
028:             * are allowed to use the <em>write</em> method of output streams.
029:             * <p>This property defaults to <strong>false</strong>.
030:             */
031:            public static final String SM_AGENT_WRITE_P = "org.w3c.jigsaw.security.write";
032:            /**
033:             * Name of the property indicating if security maneger is debuged.
034:             * When <strong>true</strong> this property makes the security manager
035:             * emits debugging traces.
036:             * <p>This property defaults to <strong>false</strong>.
037:             */
038:            public static final String SM_DEBUG_P = "org.w3c.jigsaw.debug";
039:
040:            private static boolean debug = false;
041:            private static boolean agent_accept = false;
042:            private static boolean agent_write = false;
043:
044:            static {
045:                // Get properties:
046:                agent_accept = Boolean.getBoolean(SM_AGENT_ACCEPT_P);
047:                agent_write = Boolean.getBoolean(SM_AGENT_WRITE_P);
048:                debug = Boolean.getBoolean(SM_DEBUG_P);
049:            }
050:
051:            protected final boolean inAgent() {
052:                //	ClassLoader loader = currentClassLoader() ;
053:                // Agent are not available yet with new Jigsaw design
054:                //	if ( loader == null ) {
055:                //	    return false ;
056:                //	} else if ( loader instanceof org.w3c.jigsaw.agent.AgentClassLoader ) {
057:                //	    return true ;
058:                //	} else {
059:                //	    throw new SecurityException ("Unknown class loader: " + loader) ;
060:                //	}
061:                return false;
062:            }
063:
064:            protected void trace(String msg) {
065:                if (inAgent())
066:                    System.out.println("[agent-security] " + msg);
067:                else
068:                    System.out.println("[httpd-security] " + msg);
069:            }
070:
071:            public void checkAccept(String host, int port) {
072:                if (debug)
073:                    trace("checkAccept: " + host + "@" + port);
074:                if (inAgent() && (!agent_accept))
075:                    throw new SecurityException();
076:                return;
077:            }
078:
079:            public void checkAccess(Thread thr) {
080:                if (debug)
081:                    trace("checkAccess: " + thr.getName());
082:                if (inAgent())
083:                    throw new SecurityException("Access denied to agents.");
084:                return;
085:            }
086:
087:            public void checkCreateClassLoader() {
088:                if (debug)
089:                    trace("checkCreateClassLoader.");
090:                if (inAgent())
091:                    throw new SecurityException(
092:                            "createClassLoader denied to agents.");
093:                return;
094:            }
095:
096:            public void checkListen(int port) {
097:                if (debug)
098:                    trace("checkListen: " + port);
099:                if (inAgent())
100:                    throw new SecurityException("Listen denied to agents.");
101:                return;
102:            }
103:
104:            public void checkPropertiesAccess() {
105:                if (debug)
106:                    trace("checkPropertiesAccess.");
107:                if (inAgent())
108:                    throw new SecurityException("Properties denied to agents");
109:                return;
110:            }
111:
112:            public void checkRead(String file) {
113:                if (debug)
114:                    trace("checkRead: " + file);
115:                if (inAgent())
116:                    throw new SecurityException("Read(file) denied to agents.");
117:
118:                return;
119:            }
120:
121:            public void checkRead(int fd) {
122:                if (debug)
123:                    trace("checkRead: " + fd);
124:                if (inAgent())
125:                    throw new SecurityException("Read(fd) denied to agents.");
126:                return;
127:            }
128:
129:            public void checkWrite(int fd) {
130:                if (debug)
131:                    trace("checkWrite: " + fd);
132:                if (inAgent())
133:                    throw new SecurityException("Write(fd) denied to agents.");
134:                return;
135:            }
136:
137:            public void checkWrite(String file) {
138:                if (debug)
139:                    trace("checkWrite: " + file);
140:                if (inAgent() && (!agent_write))
141:                    throw new SecurityException("write(file) denied to agents.");
142:                return;
143:            }
144:
145:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.