Source Code Cross Referenced for SecurityServerInterceptor.java in  » Net » Coadunation_1.0.1 » com » rift » coad » lib » interceptor » iiop » 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 » Net » Coadunation_1.0.1 » com.rift.coad.lib.interceptor.iiop 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * CoadunationLib: The coaduntion implementation library.
003:         * Copyright (C) 2006  Rift IT Contracting
004:         * 
005:         * This library is free software; you can redistribute it and/or
006:         * modify it under the terms of the GNU Lesser General Public
007:         * License as published by the Free Software Foundation; either
008:         * version 2.1 of the License, or (at your option) any later version.
009:         * 
010:         * This library is distributed in the hope that it will be useful,
011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013:         * Lesser General Public License for more details.
014:         * 
015:         * You should have received a copy of the GNU Lesser General Public
016:         * License along with this library; if not, write to the Free Software
017:         * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
018:         *
019:         * SecurityServerInterceptor.java
020:         *
021:         * The security server interceptor is responsible for intercepting the call on
022:         * the server and setting up the security context appropriatly.
023:         */
024:
025:        // package path
026:        package com.rift.coad.lib.interceptor.iiop;
027:
028:        // java imports
029:        import java.util.MissingResourceException;
030:        import org.omg.CORBA.TIMEOUT;
031:        import org.omg.IOP.ServiceContext;
032:        import org.omg.PortableInterceptor.ServerRequestInterceptor;
033:        import org.omg.PortableInterceptor.ServerRequestInfo;
034:        import org.omg.PortableInterceptor.ForwardRequest;
035:        import org.omg.PortableInterceptor.ORBInitInfo;
036:
037:        // logging import
038:        import org.apache.log4j.Logger;
039:
040:        // coadunation imports
041:        import com.rift.coad.lib.common.ObjectSerializer;
042:        import com.rift.coad.lib.interceptor.credentials.Credential;
043:        import com.rift.coad.lib.interceptor.InterceptorWrapper;
044:        import com.rift.coad.lib.interceptor.ServerInterceptor;
045:
046:        /**
047:         * The security server interceptor is responsible for intercepting the call on
048:         * the server and setting up the security context appropriatly.
049:         *
050:         * @author Brett Chaldecott
051:         */
052:        public class SecurityServerInterceptor extends InterceptorWrapper
053:                implements  ServerRequestInterceptor {
054:            // the class log variable
055:            protected static Logger log = Logger
056:                    .getLogger(SecurityServerInterceptor.class.getName());
057:
058:            /** 
059:             * Creates a new instance of SecurityServerInterceptor 
060:             */
061:            public SecurityServerInterceptor(ORBInitInfo info) {
062:            }
063:
064:            /**
065:             * This method returns the name of this interceptor.
066:             *
067:             * @return A string containing the name of this interceptor.
068:             */
069:            public String name() {
070:                return "SecurityServerInterceptor";
071:            }
072:
073:            /**
074:             * This method is called to distory this object.
075:             */
076:            public void destroy() {
077:                // do nothing for time being
078:            }
079:
080:            /**
081:             * Allows the interceptor to process service context information.
082:             *
083:             * @param ri The reference to the request information
084:             */
085:            public void receive_request_service_contexts(ServerRequestInfo ri) {
086:
087:            }
088:
089:            /**
090:             * Allows an Interceptor to query request information after all the
091:             * information, including operation parameters, are available.
092:             */
093:            public void receive_request(ServerRequestInfo ri) {
094:                try {
095:                    // this logic assums that the context will not get set internally
096:                    // and stuff this logic up
097:                    log.debug("Receive a request on the server side");
098:                    ServiceContext serviceContext = ri
099:                            .get_request_service_context(Constants.STANDARD_SECURITY_CONTEXT_ID);
100:                    if (serviceContext != null) {
101:                        Credential credential = (Credential) ObjectSerializer
102:                                .deserialize(serviceContext.context_data);
103:                        this .getServerInterceptor().createSession(credential);
104:                    }
105:                } catch (org.omg.CORBA.BAD_PARAM ex) {
106:                    // ignore the bad param exception
107:                } catch (Exception ex) {
108:                    log.debug("Failed to setup the security because : "
109:                            + ex.getMessage(), ex);
110:                }
111:            }
112:
113:            /**
114:             * Allows an Interceptor to query the exception information and modify the 
115:             * reply service context before the exception is thrown to the client.
116:             */
117:            public void send_exception(ServerRequestInfo ri) {
118:                try {
119:                    // this logic assums that the context will not get set internally
120:                    // and stuff this logic up
121:                    log.debug("Reply to a request on the server side.");
122:                    ServiceContext serviceContext = ri
123:                            .get_request_service_context(Constants.STANDARD_SECURITY_CONTEXT_ID);
124:                    if (serviceContext != null) {
125:                        this .getServerInterceptor().release();
126:                    }
127:                } catch (org.omg.CORBA.BAD_PARAM ex) {
128:                    // ignore the bad param exception
129:                } catch (Exception ex) {
130:                    log.debug("Failed to release security because : "
131:                            + ex.getMessage(), ex);
132:                }
133:            }
134:
135:            /**
136:             * Allows an Interceptor to query the information available when a request 
137:             * results in something other than a normal reply or an exception.
138:             */
139:            public void send_other(ServerRequestInfo ri) {
140:
141:            }
142:
143:            /**
144:             * Allows an Interceptor to query reply information and modify the reply 
145:             * service context after the target operation has been invoked and before
146:             * the reply is returned to the client.
147:             */
148:            public void send_reply(ServerRequestInfo ri) {
149:                try {
150:                    // this logic assums that the context will not get set internally
151:                    // and stuff this logic up
152:                    log.debug("Reply to a request on the server side.");
153:                    ServiceContext serviceContext = ri
154:                            .get_request_service_context(Constants.STANDARD_SECURITY_CONTEXT_ID);
155:                    if (serviceContext != null) {
156:                        this .getServerInterceptor().release();
157:                    }
158:                } catch (org.omg.CORBA.BAD_PARAM ex) {
159:                    // ignore the bad param exception
160:                } catch (Exception ex) {
161:                    log.debug("Failed to release security because : "
162:                            + ex.getMessage(), ex);
163:                }
164:            }
165:
166:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.