maguro      2005/03/26 21:04:41

  Modified:    modules/core/src/java/org/openejb/corba/security
                        ClientSecurityInterceptor.java
                        IORSecurityInterceptor.java SSLSessionManager.java
                        SecurityInitializer.java
                        ServerSecurityInterceptor.java
  Added:       modules/core/src/java/org/openejb/corba/security
                        SASConflictingEvidenceException.java
                        SASException.java SASInvalidEvidenceException.java
                        SASInvalidMechanismException.java
                        SASNoContextException.java SASReplyManager.java
  Log:

  Updated to use the default Sun ORB.
  
  Revision  Changes    Path
  1.5       +10 -7     
openejb/modules/core/src/java/org/openejb/corba/security/ClientSecurityInterceptor.java
  
  Index: ClientSecurityInterceptor.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/corba/security/ClientSecurityInterceptor.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ClientSecurityInterceptor.java    20 Mar 2005 23:13:32 -0000      1.4
  +++ ClientSecurityInterceptor.java    27 Mar 2005 02:04:41 -0000      1.5
  @@ -49,17 +49,18 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.omg.CORBA.LocalObject;
  +import org.omg.CORBA.Policy;
   import org.omg.IOP.ServiceContext;
   import org.omg.IOP.TAG_CSI_SEC_MECH_LIST;
   import org.omg.IOP.TaggedComponent;
   import org.omg.PortableInterceptor.ClientRequestInfo;
   import org.omg.PortableInterceptor.ClientRequestInterceptor;
  -import org.openorb.orb.net.AbstractServerRequest;
   
   import org.openejb.corba.security.config.css.CSSCompoundSecMechConfig;
   import org.openejb.corba.security.config.css.CSSConfig;
   import org.openejb.corba.security.config.tss.TSSCompoundSecMechListConfig;
   import org.openejb.corba.util.Util;
  +import org.openejb.corba.ClientContextManager;
   
   
   /**
  @@ -70,20 +71,23 @@
       private final Log log = 
LogFactory.getLog(ClientSecurityInterceptor.class);
   
       public ClientSecurityInterceptor() {
  -        AbstractServerRequest.disableServiceContextExceptions();
           if (log.isDebugEnabled()) log.debug("Registered");
       }
   
       public void receive_exception(ClientRequestInfo ri) {
  +        int i = 0;
       }
   
       public void receive_other(ClientRequestInfo ri) {
  +        int i = 0;
       }
   
       public void receive_reply(ClientRequestInfo ri) {
  +        int i = 0;
       }
   
       public void send_poll(ClientRequestInfo ri) {
  +        int i = 0;
       }
   
       public void send_request(ClientRequestInfo ri) {
  @@ -96,12 +100,11 @@
   
               if (log.isDebugEnabled()) log.debug("Target has a security 
policy");
   
  -            ClientPolicy policy = (ClientPolicy) 
ri.get_request_policy(ClientPolicyFactory.POLICY_TYPE);
  -            if (policy.getConfig() == null) return;
  +            CSSConfig config = 
ClientContextManager.getClientContext().getSecurityConfig();
  +            if (config == null) return;
   
               if (log.isDebugEnabled()) log.debug("Client has a security 
policy");
   
  -            CSSConfig config = policy.getConfig();
               List compat = config.findCompatibleSet(csml);
   
               if (compat.size() == 0) return;
  
  
  
  1.4       +3 -3      
openejb/modules/core/src/java/org/openejb/corba/security/IORSecurityInterceptor.java
  
  Index: IORSecurityInterceptor.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/corba/security/IORSecurityInterceptor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- IORSecurityInterceptor.java       8 Mar 2005 04:08:27 -0000       1.3
  +++ IORSecurityInterceptor.java       27 Mar 2005 02:04:41 -0000      1.4
  @@ -67,7 +67,7 @@
           try {
               ServerPolicy policy = (ServerPolicy) 
info.get_effective_policy(ServerPolicyFactory.POLICY_TYPE);
   
  -            if (policy.getConfig() == null) return;
  +            if (policy == null || policy.getConfig() == null) return;
   
               
info.add_ior_component_to_profile(policy.getConfig().generateIOR(Util.getORB(), 
Util.getCodec()), TAG_INTERNET_IOP.value);
           } catch (INV_POLICY e) {
  
  
  
  1.2       +4 -4      
openejb/modules/core/src/java/org/openejb/corba/security/SSLSessionManager.java
  
  Index: SSLSessionManager.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/corba/security/SSLSessionManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SSLSessionManager.java    8 Mar 2005 04:41:51 -0000       1.1
  +++ SSLSessionManager.java    27 Mar 2005 02:04:41 -0000      1.2
  @@ -71,7 +71,7 @@
           requestSSLSessions.put(new Integer(requestId), session);
       }
   
  -    public static void clearSSLSession(int requestId) {
  -        requestSSLSessions.remove(new Integer(requestId));
  +    public static SSLSession clearSSLSession(int requestId) {
  +        return (SSLSession) requestSSLSessions.remove(new 
Integer(requestId));
       }
   }
  
  
  
  1.5       +32 -19    
openejb/modules/core/src/java/org/openejb/corba/security/SecurityInitializer.java
  
  Index: SecurityInitializer.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/corba/security/SecurityInitializer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SecurityInitializer.java  12 Mar 2005 17:04:54 -0000      1.4
  +++ SecurityInitializer.java  27 Mar 2005 02:04:41 -0000      1.5
  @@ -66,6 +66,10 @@
   
       private final Log log = LogFactory.getLog(SecurityInitializer.class);
   
  +    public SecurityInitializer() {
  +        if (log.isDebugEnabled()) log.debug("SecurityInitializer.<init>");
  +    }
  +
       /**
        * Called during ORB initialization.  If it is expected that initial
        * services registered by an interceptor will be used by other
  @@ -99,26 +103,35 @@
        */
       public void post_init(ORBInitInfo info) {
   
  -        Subject defaultSubject = null;
  -        String[] strings = info.arguments();
  -        for (int i = 0; i < strings.length; i++) {
  -            String arg = strings[i];
  -            if (arg.startsWith("default-principal::")) {
  -                defaultSubject = generateDefaultSubject(arg);
  -                break;
  +        try {
  +            if (log.isDebugEnabled()) log.debug("Registering interceptors 
and policy factories");
  +
  +            Subject defaultSubject = null;
  +            String[] strings = info.arguments();
  +            for (int i = 0; i < strings.length; i++) {
  +                String arg = strings[i];
  +                if (arg.startsWith("default-principal::")) {
  +                    defaultSubject = generateDefaultSubject(arg);
  +                    break;
  +                }
               }
  -        }
   
  -        try {
  -            info.add_client_request_interceptor(new 
ClientSecurityInterceptor());
  -            info.add_server_request_interceptor(new 
ServerSecurityInterceptor(info.allocate_slot_id(), defaultSubject));
  -            info.add_ior_interceptor(new IORSecurityInterceptor());
  -        } catch (DuplicateName dn) {
  -            log.error("Error registering interceptor", dn);
  -        }
  +            if (log.isDebugEnabled()) log.debug("Default subject: " + 
defaultSubject);
   
  -        info.register_policy_factory(ClientPolicyFactory.POLICY_TYPE, new 
ClientPolicyFactory());
  -        info.register_policy_factory(ServerPolicyFactory.POLICY_TYPE, new 
ServerPolicyFactory());
  +            try {
  +                info.add_client_request_interceptor(new 
ClientSecurityInterceptor());
  +                info.add_server_request_interceptor(new 
ServerSecurityInterceptor(info.allocate_slot_id(), info.allocate_slot_id(), 
defaultSubject));
  +                info.add_ior_interceptor(new IORSecurityInterceptor());
  +            } catch (DuplicateName dn) {
  +                log.error("Error registering interceptor", dn);
  +            }
  +
  +            info.register_policy_factory(ClientPolicyFactory.POLICY_TYPE, 
new ClientPolicyFactory());
  +            info.register_policy_factory(ServerPolicyFactory.POLICY_TYPE, 
new ServerPolicyFactory());
  +        } catch (RuntimeException re) {
  +            log.error("Error registering interceptor", re);
  +            throw re;
  +        }
       }
   
       private Subject generateDefaultSubject(String argument) {
  
  
  
  1.7       +94 -50    
openejb/modules/core/src/java/org/openejb/corba/security/ServerSecurityInterceptor.java
  
  Index: ServerSecurityInterceptor.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/corba/security/ServerSecurityInterceptor.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ServerSecurityInterceptor.java    14 Mar 2005 23:02:02 -0000      1.6
  +++ ServerSecurityInterceptor.java    27 Mar 2005 02:04:41 -0000      1.7
  @@ -44,7 +44,9 @@
    */
   package org.openejb.corba.security;
   
  +import java.util.Set;
   import javax.security.auth.Subject;
  +import javax.security.auth.DestroyFailedException;
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  @@ -52,22 +54,26 @@
   import org.omg.CORBA.INTERNAL;
   import org.omg.CORBA.INV_POLICY;
   import org.omg.CORBA.LocalObject;
  -import org.omg.CSI.MTCompleteEstablishContext;
  -import org.omg.CSI.MTContextError;
  -import org.omg.CSI.MTEstablishContext;
  -import org.omg.CSI.MTMessageInContext;
  -import org.omg.CSI.SASContextBody;
  -import org.omg.CSI.SASContextBodyHelper;
  +import org.omg.CORBA.MARSHAL;
  +import org.omg.CORBA.ORB;
  +import org.omg.CORBA.BAD_PARAM;
   import org.omg.IOP.CodecPackage.FormatMismatch;
  +import org.omg.IOP.CodecPackage.InvalidTypeForEncoding;
   import org.omg.IOP.CodecPackage.TypeMismatch;
   import org.omg.IOP.SecurityAttributeService;
   import org.omg.IOP.ServiceContext;
  -import org.omg.PortableInterceptor.InvalidSlot;
   import org.omg.PortableInterceptor.ServerRequestInfo;
   import org.omg.PortableInterceptor.ServerRequestInterceptor;
  -import org.openorb.orb.net.AbstractServerRequest;
   
   import org.apache.geronimo.security.ContextManager;
  +import org.apache.geronimo.interop.CSI.SASContextBodyHelper;
  +import org.apache.geronimo.interop.CSI.SASContextBody;
  +import org.apache.geronimo.interop.CSI.MTEstablishContext;
  +import org.apache.geronimo.interop.CSI.ContextError;
  +import org.apache.geronimo.interop.CSI.CompleteEstablishContext;
  +import org.apache.geronimo.interop.CSI.MTCompleteEstablishContext;
  +import org.apache.geronimo.interop.CSI.MTContextError;
  +import org.apache.geronimo.interop.CSI.MTMessageInContext;
   
   import org.openejb.corba.security.config.tss.TSSConfig;
   import org.openejb.corba.util.Util;
  @@ -80,23 +86,26 @@
   
       private final Log log = 
LogFactory.getLog(ServerSecurityInterceptor.class);
   
  -    private final int slotId;
  +    private final int subjectSlot;
  +    private final int replySlot;
       private final Subject defaultSubject;
   
  -    public ServerSecurityInterceptor(int slotId, Subject defaultSubject) {
  -        this.slotId = slotId;
  +    public ServerSecurityInterceptor(int subjectSlot, int replySlot, Subject 
defaultSubject) {
  +        this.subjectSlot = subjectSlot;
  +        this.replySlot = replySlot;
           this.defaultSubject = defaultSubject;
   
           if (defaultSubject != null) 
ContextManager.registerSubject(defaultSubject);
  -        AbstractServerRequest.disableServiceContextExceptions();
       }
   
       public void receive_request(ServerRequestInfo ri) {
   
           Subject identity = null;
  +        long contextId = 0;
   
           try {
               ServerPolicy serverPolicy = (ServerPolicy) 
ri.get_server_policy(ServerPolicyFactory.POLICY_TYPE);
  +            if (serverPolicy == null) return;
               TSSConfig tssPolicy = serverPolicy.getConfig();
               if (tssPolicy == null) return;
   
  @@ -109,10 +118,14 @@
               short msgType = contextBody.discriminator();
               switch (msgType) {
                   case MTEstablishContext.value:
  +                    contextId = 
contextBody.establish_msg().client_context_id;
  +
                       identity = 
tssPolicy.check(SSLSessionManager.getSSLSession(ri.request_id()), 
contextBody.establish_msg());
   
                       ContextManager.registerSubject(identity);
   
  +                    SASReplyManager.setSASReply(ri.request_id(), 
generateContextEstablished(identity, contextId, false));
  +
                       break;
   
                   case MTCompleteEstablishContext.value:
  @@ -125,33 +138,34 @@
   
                   case MTMessageInContext.value:
                       log.error("The CSIv2 TSS is not supposed to receive a 
CompleteEstablishContext message.");
  -                    throw new INTERNAL("MessageInContext is currently not 
supported by this implementation.");
  -            }
   
  +                    contextId = 
contextBody.in_context_msg().client_context_id;
  +                    throw new SASNoContextException();
  +            }
  +        } catch (BAD_PARAM e) {
  +            identity = defaultSubject;
           } catch (INV_POLICY e) {
               identity = defaultSubject;
           } catch (TypeMismatch tm) {
               log.error("TypeMismatch thrown", tm);
  -            throw new INTERNAL("TypeMismatch thrown: " + tm);
  +            throw new MARSHAL("TypeMismatch thrown: " + tm);
           } catch (FormatMismatch fm) {
               log.error("FormatMismatch thrown", fm);
  -            throw new INTERNAL("FormatMismatch thrown: " + fm);
  +            throw new MARSHAL("FormatMismatch thrown: " + fm);
  +        } catch (SASException e) {
  +            log.error("SASException", e);
  +            SASReplyManager.setSASReply(ri.request_id(), 
generateContextError(e, contextId));
  +            throw (RuntimeException) e.getCause();
  +        } catch (Exception e) {
  +            log.error("Exception", e);
  +            throw (RuntimeException) e.getCause();
           }
   
           if (identity != null) {
  -            try {
  -                ContextManager.setCurrentCaller(identity);
  -                ContextManager.setNextCaller(identity);
  +            ContextManager.setCurrentCaller(identity);
  +            ContextManager.setNextCaller(identity);
   
  -                Any subjectAny = ri.get_slot(slotId);
  -                subjectAny.insert_Value(identity);
  -                ri.set_slot(slotId, subjectAny);
  -
  -                SubjectManager.setSubject(ri.request_id(), identity);
  -            } catch (InvalidSlot is) {
  -                log.error("InvalidSlot thrown", is);
  -                throw new INTERNAL("InvalidSlot thrown: " + is);
  -            }
  +            SubjectManager.setSubject(ri.request_id(), identity);
           }
       }
   
  @@ -159,32 +173,20 @@
       }
   
       public void send_exception(ServerRequestInfo ri) {
  -        try {
  -            Any subjectAny = ri.get_slot(slotId);
  -//            Subject identity = (Subject) subjectAny.extract_Value();
  -            Subject identity = SubjectManager.clearSubject(ri.request_id());
  -
  -            if (identity != null && identity != defaultSubject) 
ContextManager.unregisterSubject(identity);
  -        } catch (InvalidSlot is) {
  -            log.error("InvalidSlot thrown", is);
  -            throw new INTERNAL("InvalidSlot thrown: " + is);
  -        }
  +        Subject identity = SubjectManager.clearSubject(ri.request_id());
  +        if (identity != null && identity != defaultSubject) 
ContextManager.unregisterSubject(identity);
  +
  +        insertServiceContext(ri);
       }
   
       public void send_other(ServerRequestInfo ri) {
       }
   
       public void send_reply(ServerRequestInfo ri) {
  -        try {
  -            Any subjectAny = ri.get_slot(slotId);
  -//            Subject identity = (Subject) subjectAny.extract_Value();
  -            Subject identity = SubjectManager.clearSubject(ri.request_id());
  -
  -            if (identity != null && identity != defaultSubject) 
ContextManager.unregisterSubject(identity);
  -        } catch (InvalidSlot is) {
  -            log.error("InvalidSlot thrown", is);
  -            throw new INTERNAL("InvalidSlot thrown: " + is);
  -        }
  +        Subject identity = SubjectManager.clearSubject(ri.request_id());
  +        if (identity != null && identity != defaultSubject) 
ContextManager.unregisterSubject(identity);
  +
  +        insertServiceContext(ri);
       }
   
       public void destroy() {
  @@ -193,5 +195,47 @@
   
       public String name() {
           return "org.openejb.corba.security.ServerSecurityInterceptor";
  +    }
  +
  +    protected SASContextBody generateContextError(SASException e, long 
contextId) {
  +        SASContextBody reply = new SASContextBody();
  +
  +        reply.error_msg(new ContextError(contextId, e.getMajor(), 
e.getMinor(), e.getErrorToken()));
  +
  +        return reply;
  +    }
  +
  +    protected SASContextBody generateContextEstablished(Subject identity, 
long contextId, boolean stateful) {
  +        SASContextBody reply = new SASContextBody();
  +
  +        byte[] finalContextToken = null;
  +        Set credentials = 
identity.getPrivateCredentials(FinalContextToken.class);
  +        if (!credentials.isEmpty()) {
  +            try {
  +                FinalContextToken token = (FinalContextToken) 
credentials.iterator().next();
  +                finalContextToken = token.getToken();
  +                token.destroy();
  +            } catch (DestroyFailedException e) {
  +                // do nothing
  +            }
  +        }
  +        if (finalContextToken == null) finalContextToken = new byte[0];
  +        reply.complete_msg(new CompleteEstablishContext(contextId, stateful, 
finalContextToken));
  +
  +        return reply;
  +    }
  +
  +    protected void insertServiceContext(ServerRequestInfo ri) {
  +        try {
  +            SASContextBody sasContextBody = 
SASReplyManager.clearSASReply(ri.request_id());
  +            if (sasContextBody != null) {
  +                Any any = ORB.init().create_any();
  +                SASContextBodyHelper.insert(any, sasContextBody);
  +                ri.add_reply_service_context(new 
ServiceContext(SecurityAttributeService.value, 
Util.getCodec().encode_value(any)), true);
  +            }
  +        } catch (InvalidTypeForEncoding itfe) {
  +            log.error("InvalidTypeForEncoding thrown", itfe);
  +            throw new INTERNAL("InvalidTypeForEncoding thrown: " + itfe);
  +        }
       }
   }
  
  
  
  1.1                  
openejb/modules/core/src/java/org/openejb/corba/security/SASConflictingEvidenceException.java
  
  Index: SASConflictingEvidenceException.java
  ===================================================================
  /**
   * Redistribution and use of this software and associated documentation
   * ("Software"), with or without modification, are permitted provided
   * that the following conditions are met:
   *
   * 1. Redistributions of source code must retain copyright
   *    statements and notices.  Redistributions must also contain a
   *    copy of this document.
   *
   * 2. Redistributions in binary form must reproduce the
   *    above copyright notice, this list of conditions and the
   *    following disclaimer in the documentation and/or other
   *    materials provided with the distribution.
   *
   * 3. The name "OpenEJB" must not be used to endorse or promote
   *    products derived from this Software without prior written
   *    permission of The OpenEJB Group.  For written permission,
   *    please contact [EMAIL PROTECTED]
   *
   * 4. Products derived from this Software may not be called "OpenEJB"
   *    nor may "OpenEJB" appear in their names without prior written
   *    permission of The OpenEJB Group. OpenEJB is a registered
   *    trademark of The OpenEJB Group.
   *
   * 5. Due credit should be given to the OpenEJB Project
   *    (http://openejb.sf.net/).
   *
   * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
   * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
   * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
   * THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
   * OF THE POSSIBILITY OF SUCH DAMAGE.
   *
   * Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.
   *
   * $Id: SASConflictingEvidenceException.java,v 1.1 2005/03/27 02:04:41 maguro 
Exp $
   */
  package org.openejb.corba.security;
  
  import org.omg.CORBA.NO_PERMISSION;
  
  
  /**
   * @version $Revision: 1.1 $ $Date: 2005/03/27 02:04:41 $
   */
  public class SASConflictingEvidenceException extends SASException {
  
      public SASConflictingEvidenceException() {
          super(3, new NO_PERMISSION());
      }
      
  }
  
  
  
  1.1                  
openejb/modules/core/src/java/org/openejb/corba/security/SASException.java
  
  Index: SASException.java
  ===================================================================
  /**
   * Redistribution and use of this software and associated documentation
   * ("Software"), with or without modification, are permitted provided
   * that the following conditions are met:
   *
   * 1. Redistributions of source code must retain copyright
   *    statements and notices.  Redistributions must also contain a
   *    copy of this document.
   *
   * 2. Redistributions in binary form must reproduce the
   *    above copyright notice, this list of conditions and the
   *    following disclaimer in the documentation and/or other
   *    materials provided with the distribution.
   *
   * 3. The name "OpenEJB" must not be used to endorse or promote
   *    products derived from this Software without prior written
   *    permission of The OpenEJB Group.  For written permission,
   *    please contact [EMAIL PROTECTED]
   *
   * 4. Products derived from this Software may not be called "OpenEJB"
   *    nor may "OpenEJB" appear in their names without prior written
   *    permission of The OpenEJB Group. OpenEJB is a registered
   *    trademark of The OpenEJB Group.
   *
   * 5. Due credit should be given to the OpenEJB Project
   *    (http://openejb.sf.net/).
   *
   * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
   * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
   * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
   * THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
   * OF THE POSSIBILITY OF SUCH DAMAGE.
   *
   * Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.
   *
   * $Id: SASException.java,v 1.1 2005/03/27 02:04:41 maguro Exp $
   */
  package org.openejb.corba.security;
  
  
  /**
   * @version $Revision: 1.1 $ $Date: 2005/03/27 02:04:41 $
   */
  public class SASException extends Exception {
  
      private final int major;
  
      public SASException(int major) {
          this.major = major;
      }
  
      public SASException(int major, Throwable cause) {
          super(cause);
  
          this.major = major;
      }
  
      public int getMajor() {
          return major;
      }
  
      public int getMinor() {
          return 1;
      }
  
      public byte[] getErrorToken() {
          return null;
      }
  }
  
  
  
  1.1                  
openejb/modules/core/src/java/org/openejb/corba/security/SASInvalidEvidenceException.java
  
  Index: SASInvalidEvidenceException.java
  ===================================================================
  /**
   * Redistribution and use of this software and associated documentation
   * ("Software"), with or without modification, are permitted provided
   * that the following conditions are met:
   *
   * 1. Redistributions of source code must retain copyright
   *    statements and notices.  Redistributions must also contain a
   *    copy of this document.
   *
   * 2. Redistributions in binary form must reproduce the
   *    above copyright notice, this list of conditions and the
   *    following disclaimer in the documentation and/or other
   *    materials provided with the distribution.
   *
   * 3. The name "OpenEJB" must not be used to endorse or promote
   *    products derived from this Software without prior written
   *    permission of The OpenEJB Group.  For written permission,
   *    please contact [EMAIL PROTECTED]
   *
   * 4. Products derived from this Software may not be called "OpenEJB"
   *    nor may "OpenEJB" appear in their names without prior written
   *    permission of The OpenEJB Group. OpenEJB is a registered
   *    trademark of The OpenEJB Group.
   *
   * 5. Due credit should be given to the OpenEJB Project
   *    (http://openejb.sf.net/).
   *
   * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
   * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
   * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
   * THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
   * OF THE POSSIBILITY OF SUCH DAMAGE.
   *
   * Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.
   *
   * $Id: SASInvalidEvidenceException.java,v 1.1 2005/03/27 02:04:41 maguro Exp 
$
   */
  package org.openejb.corba.security;
  
  import org.omg.CORBA.NO_PERMISSION;
  
  
  /**
   * @version $Revision: 1.1 $ $Date: 2005/03/27 02:04:41 $
   */
  public class SASInvalidEvidenceException extends SASException {
  
      public SASInvalidEvidenceException() {
          super(1, new NO_PERMISSION());
      }
      
  }
  
  
  
  1.1                  
openejb/modules/core/src/java/org/openejb/corba/security/SASInvalidMechanismException.java
  
  Index: SASInvalidMechanismException.java
  ===================================================================
  /**
   * Redistribution and use of this software and associated documentation
   * ("Software"), with or without modification, are permitted provided
   * that the following conditions are met:
   *
   * 1. Redistributions of source code must retain copyright
   *    statements and notices.  Redistributions must also contain a
   *    copy of this document.
   *
   * 2. Redistributions in binary form must reproduce the
   *    above copyright notice, this list of conditions and the
   *    following disclaimer in the documentation and/or other
   *    materials provided with the distribution.
   *
   * 3. The name "OpenEJB" must not be used to endorse or promote
   *    products derived from this Software without prior written
   *    permission of The OpenEJB Group.  For written permission,
   *    please contact [EMAIL PROTECTED]
   *
   * 4. Products derived from this Software may not be called "OpenEJB"
   *    nor may "OpenEJB" appear in their names without prior written
   *    permission of The OpenEJB Group. OpenEJB is a registered
   *    trademark of The OpenEJB Group.
   *
   * 5. Due credit should be given to the OpenEJB Project
   *    (http://openejb.sf.net/).
   *
   * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
   * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
   * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
   * THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
   * OF THE POSSIBILITY OF SUCH DAMAGE.
   *
   * Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.
   *
   * $Id: SASInvalidMechanismException.java,v 1.1 2005/03/27 02:04:41 maguro 
Exp $
   */
  package org.openejb.corba.security;
  
  import org.omg.CORBA.NO_PERMISSION;
  
  
  /**
   * @version $Revision: 1.1 $ $Date: 2005/03/27 02:04:41 $
   */
  public class SASInvalidMechanismException extends SASException {
  
      public SASInvalidMechanismException() {
          super(2, new NO_PERMISSION());
      }
      
  }
  
  
  
  1.1                  
openejb/modules/core/src/java/org/openejb/corba/security/SASNoContextException.java
  
  Index: SASNoContextException.java
  ===================================================================
  /**
   * Redistribution and use of this software and associated documentation
   * ("Software"), with or without modification, are permitted provided
   * that the following conditions are met:
   *
   * 1. Redistributions of source code must retain copyright
   *    statements and notices.  Redistributions must also contain a
   *    copy of this document.
   *
   * 2. Redistributions in binary form must reproduce the
   *    above copyright notice, this list of conditions and the
   *    following disclaimer in the documentation and/or other
   *    materials provided with the distribution.
   *
   * 3. The name "OpenEJB" must not be used to endorse or promote
   *    products derived from this Software without prior written
   *    permission of The OpenEJB Group.  For written permission,
   *    please contact [EMAIL PROTECTED]
   *
   * 4. Products derived from this Software may not be called "OpenEJB"
   *    nor may "OpenEJB" appear in their names without prior written
   *    permission of The OpenEJB Group. OpenEJB is a registered
   *    trademark of The OpenEJB Group.
   *
   * 5. Due credit should be given to the OpenEJB Project
   *    (http://openejb.sf.net/).
   *
   * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
   * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
   * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
   * THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
   * OF THE POSSIBILITY OF SUCH DAMAGE.
   *
   * Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.
   *
   * $Id: SASNoContextException.java,v 1.1 2005/03/27 02:04:41 maguro Exp $
   */
  package org.openejb.corba.security;
  
  import org.omg.CORBA.NO_PERMISSION;
  
  
  /**
   * @version $Revision: 1.1 $ $Date: 2005/03/27 02:04:41 $
   */
  public class SASNoContextException extends SASException {
  
      public SASNoContextException() {
          super(4, new NO_PERMISSION());
      }
  
  }
  
  
  
  1.1                  
openejb/modules/core/src/java/org/openejb/corba/security/SASReplyManager.java
  
  Index: SASReplyManager.java
  ===================================================================
  /**
   * Redistribution and use of this software and associated documentation
   * ("Software"), with or without modification, are permitted provided
   * that the following conditions are met:
   *
   * 1. Redistributions of source code must retain copyright
   *    statements and notices.  Redistributions must also contain a
   *    copy of this document.
   *
   * 2. Redistributions in binary form must reproduce the
   *    above copyright notice, this list of conditions and the
   *    following disclaimer in the documentation and/or other
   *    materials provided with the distribution.
   *
   * 3. The name "OpenEJB" must not be used to endorse or promote
   *    products derived from this Software without prior written
   *    permission of The OpenEJB Group.  For written permission,
   *    please contact [EMAIL PROTECTED]
   *
   * 4. Products derived from this Software may not be called "OpenEJB"
   *    nor may "OpenEJB" appear in their names without prior written
   *    permission of The OpenEJB Group. OpenEJB is a registered
   *    trademark of The OpenEJB Group.
   *
   * 5. Due credit should be given to the OpenEJB Project
   *    (http://openejb.sf.net/).
   *
   * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
   * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
   * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
   * THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
   * OF THE POSSIBILITY OF SUCH DAMAGE.
   *
   * Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.
   *
   * $Id: SASReplyManager.java,v 1.1 2005/03/27 02:04:41 maguro Exp $
   */
  package org.openejb.corba.security;
  
  import java.util.Hashtable;
  import java.util.Map;
  
  import org.apache.geronimo.interop.CSI.SASContextBody;
  
  
  /**
   * Stores requests' SASContextBody because get/setSlot does not seem to work 
in
   * OpenORB.
   * <p/>
   * TODO: There may be an error where the interceptor does not remove the
   * registered subjects.  We should have a daemon that cleans up old requests.
   *
   * @version $Revision: 1.1 $ $Date: 2005/03/27 02:04:41 $
   */
  public final class SASReplyManager {
      private final static Map requestSASMsgs = new Hashtable();
  
      public static SASContextBody getSASReply(int requestId) {
          return (SASContextBody) requestSASMsgs.get(new Integer(requestId));
      }
  
      public static void setSASReply(int requestId, SASContextBody sasMsg) {
          requestSASMsgs.put(new Integer(requestId), sasMsg);
      }
  
      public static SASContextBody clearSASReply(int requestId) {
          return (SASContextBody) requestSASMsgs.remove(new Integer(requestId));
      }
  }
  
  
  

Reply via email to