KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > security > interceptors > jrmp > ClientSecurityInterceptor


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  * $Id: ClientSecurityInterceptor.java,v 1.5 2004/05/25 15:13:29 benoitf Exp $
23  * --------------------------------------------------------------------------
24  *
25  */

26 package org.objectweb.jonas.security.interceptors.jrmp;
27
28 // java import
29
import java.io.IOException JavaDoc;
30
31 import org.objectweb.carol.rmi.jrmp.interceptor.JClientRequestInfo;
32 import org.objectweb.carol.rmi.jrmp.interceptor.JClientRequestInterceptor;
33 import org.objectweb.security.context.SecurityContext;
34 import org.objectweb.security.context.SecurityCurrent;
35
36 /**
37  * Class <code>ClientSecurityInterceptor</code> is a JRMP Security client
38  * interceptor for Security Context propagation
39  * @author Jeff Mesnil
40  * @author Guillaume Riviere
41  * @version 1.0, 10/03/2003
42  */

43 public class ClientSecurityInterceptor implements JClientRequestInterceptor {
44
45     /**
46      * security context id
47      */

48     public static int SEC_CTX_ID = 1;
49
50     /**
51      * interceptor name
52      */

53     private String JavaDoc interceptorName = "ClientSecurityInterceptor";
54
55     /**
56      * constructor
57      */

58     public ClientSecurityInterceptor() {
59     }
60
61     /**
62      * send client context with the request. The sendingRequest method of the
63      * JPortableInterceptors is called prior to marshalling arguments and
64      * contexts
65      * @param JClientRequestInfo jri the jrmp client info
66      * @exception IOException if an exception occur with the ObjectOutput
67      */

68     public void send_request(JClientRequestInfo jri) throws IOException JavaDoc {
69
70         // Gets Current object (always existing in JOnAS Server)
71
SecurityCurrent current = SecurityCurrent.getCurrent();
72         if (current != null) {
73             // Get the Security Context
74
SecurityContext ctx = current.getSecurityContext();
75             SecurityServiceContext ssc = new SecurityServiceContext(SEC_CTX_ID, ctx);
76             jri.add_request_service_context(ssc);
77         }
78     }
79
80     /**
81      * we do not use the received security context to set it (EJB, v1.1, chapter
82      * 15.5) Receive reply interception
83      * @param JClientRequestInfo jri the jrmp client info
84      * @exception IOException if an exception occur with the ObjectOutput
85      */

86     public void receive_reply(JClientRequestInfo jri) throws IOException JavaDoc {
87     }
88
89     /**
90      * get the name of this interceptor
91      * @return name
92      */

93     public String JavaDoc name() {
94         return interceptorName;
95     }
96
97     // empty method
98
public void send_poll(JClientRequestInfo jri) throws IOException JavaDoc {
99     }
100
101     public void receive_exception(JClientRequestInfo jri) throws IOException JavaDoc {
102     }
103
104     public void receive_other(JClientRequestInfo jri) throws IOException JavaDoc {
105     }
106 }
107
108
Popular Tags