KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > security > interceptors > iiop > CorbaClientSecurityInterceptor


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999-2004 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  */

21
22 package org.objectweb.jonas.security.interceptors.iiop;
23
24 import org.objectweb.security.context.SecurityContext;
25 import org.objectweb.security.context.SecurityCurrent;
26 import org.omg.IOP.ServiceContext JavaDoc;
27 import org.omg.PortableInterceptor.ClientRequestInfo JavaDoc;
28 import org.omg.PortableInterceptor.ClientRequestInterceptor JavaDoc;
29 import org.omg.PortableInterceptor.ForwardRequest JavaDoc;
30 import org.omg.PortableInterceptor.ORBInitInfo JavaDoc;
31
32 /**
33  * Class <code>CorbaClientSecurityInterceptor</code> is a Client Security
34  * Interceptor Java Client
35  * @author Guillaume Riviere (Guillaume.Riviere@inrialpes.fr)
36  * @version 1.0, 13/09/2002
37  */

38 public class CorbaClientSecurityInterceptor extends SecurityInterceptor implements ClientRequestInterceptor JavaDoc {
39
40     /**
41      * interceptor name
42      */

43     private String JavaDoc interceptorName = "CorbaClientSecurityInteceptor";
44
45     /**
46      * constructor
47      */

48     public CorbaClientSecurityInterceptor(ORBInitInfo JavaDoc info) {
49     }
50
51     /**
52      * get the name of this interceptor
53      * @return name
54      */

55     public String JavaDoc name() {
56         return interceptorName;
57     }
58
59     public void destroy() {
60     }
61
62     /**
63      * send client transaction context with the request, if existed.
64      * @param ClientRequestInfo iiop client info
65      * @exception IOException if an exception occured with the ObjectOutput
66      */

67     public void send_request(ClientRequestInfo JavaDoc jri) throws ForwardRequest JavaDoc {
68         // Gets Current object (always existing in JOnAS Server)
69
SecurityCurrent current = SecurityCurrent.getCurrent();
70         if (current != null) {
71             SecurityContext jsc = current.getSecurityContext();
72             if (jsc != null) {
73                 ServiceContext JavaDoc ssc = new ServiceContext JavaDoc(SEC_CTX_ID, marshallSecurityContext(jsc));
74                 jri.add_request_service_context(ssc, true);
75             }
76         }
77
78     }
79
80     /**
81      * Receive reply interception
82      * @param JClientRequestInfo jri client info
83      * @exception IOException if an exception occur with the ObjectOutput
84      */

85     public void receive_reply(ClientRequestInfo JavaDoc jri) {
86     }
87
88     // empty method
89
public void send_poll(ClientRequestInfo JavaDoc jri) {
90     }
91
92     public void receive_exception(ClientRequestInfo JavaDoc jri) throws ForwardRequest JavaDoc {
93     }
94
95     public void receive_other(ClientRequestInfo JavaDoc jri) throws ForwardRequest JavaDoc {
96     }
97 }
98
99
Popular Tags