001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999-2004 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: */package org.objectweb.jonas.security.interceptors.iiop;
021:
022: import org.objectweb.security.context.SecurityContext;
023: import org.objectweb.security.context.SecurityCurrent;
024: import org.omg.IOP.ServiceContext;
025: import org.omg.PortableInterceptor.ClientRequestInfo;
026: import org.omg.PortableInterceptor.ClientRequestInterceptor;
027: import org.omg.PortableInterceptor.ForwardRequest;
028: import org.omg.PortableInterceptor.ORBInitInfo;
029:
030: /**
031: * Class <code>CorbaClientSecurityInterceptor</code> is a Client Security
032: * Interceptor Java Client
033: * @author Guillaume Riviere (Guillaume.Riviere@inrialpes.fr)
034: * @version 1.0, 13/09/2002
035: */
036: public class CorbaClientSecurityInterceptor extends SecurityInterceptor
037: implements ClientRequestInterceptor {
038:
039: /**
040: * interceptor name
041: */
042: private String interceptorName = "CorbaClientSecurityInteceptor";
043:
044: /**
045: * constructor
046: */
047: public CorbaClientSecurityInterceptor(ORBInitInfo info) {
048: }
049:
050: /**
051: * get the name of this interceptor
052: * @return name
053: */
054: public String name() {
055: return interceptorName;
056: }
057:
058: public void destroy() {
059: }
060:
061: /**
062: * send client transaction context with the request, if existed.
063: * @param ClientRequestInfo iiop client info
064: * @exception IOException if an exception occured with the ObjectOutput
065: */
066: public void send_request(ClientRequestInfo jri)
067: throws ForwardRequest {
068: // Gets Current object (always existing in JOnAS Server)
069: SecurityCurrent current = SecurityCurrent.getCurrent();
070: if (current != null) {
071: SecurityContext jsc = current.getSecurityContext();
072: if (jsc != null) {
073: ServiceContext ssc = new ServiceContext(SEC_CTX_ID,
074: marshallSecurityContext(jsc));
075: jri.add_request_service_context(ssc, true);
076: }
077: }
078:
079: }
080:
081: /**
082: * Receive reply interception
083: * @param JClientRequestInfo jri client info
084: * @exception IOException if an exception occur with the ObjectOutput
085: */
086: public void receive_reply(ClientRequestInfo jri) {
087: }
088:
089: // empty method
090: public void send_poll(ClientRequestInfo jri) {
091: }
092:
093: public void receive_exception(ClientRequestInfo jri)
094: throws ForwardRequest {
095: }
096:
097: public void receive_other(ClientRequestInfo jri)
098: throws ForwardRequest {
099: }
100: }
|