maguro      2005/03/07 23:08:33

  Added:       modules/core/src/java/org/openejb/corba/security/config/css
                        CSSASMechConfig.java CSSCompoundSecMechConfig.java
                        CSSCompoundSecMechListConfig.java CSSConfig.java
                        CSSNULLASMechConfig.java CSSSASMechConfig.java
                        CSSSSLTransportConfig.java
                        CSSTransportMechConfig.java
  Log:

  Intermediate CORBA checkin.
  
  Revision  Changes    Path
  1.1                  
openejb/modules/core/src/java/org/openejb/corba/security/config/css/CSSASMechConfig.java
  
  Index: CSSASMechConfig.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 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.org/).
   *
   * 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.
   *
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the OpenEJB Project.  For more information
   * please see <http://openejb.org/>.
   *
   * ====================================================================
   */
  package org.openejb.corba.security.config.css;
  
  import java.io.Serializable;
  
  import org.openejb.corba.security.config.tss.TSSASMechConfig;
  
  
  /**
   * @version $Rev: $ $Date: 2005/03/08 04:08:33 $
   */
  public interface CSSASMechConfig extends Serializable {
  
      public short getSupports();
  
      public short getRequires();
  
      public boolean canHandle(TSSASMechConfig asMech);
  
      public byte[] encode();
  }
  
  
  
  1.1                  
openejb/modules/core/src/java/org/openejb/corba/security/config/css/CSSCompoundSecMechConfig.java
  
  Index: CSSCompoundSecMechConfig.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 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.org/).
   *
   * 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.
   *
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the OpenEJB Project.  For more information
   * please see <http://openejb.org/>.
   *
   * ====================================================================
   */
  package org.openejb.corba.security.config.css;
  
  import java.io.Serializable;
  
  import org.omg.CORBA.Any;
  import org.omg.CORBA.UserException;
  import org.omg.CSI.EstablishContext;
  import org.omg.CSI.SASContextBody;
  import org.omg.CSI.SASContextBodyHelper;
  import org.omg.IOP.SecurityAttributeService;
  import org.omg.IOP.ServiceContext;
  
  import org.openejb.corba.security.config.tss.TSSCompoundSecMechConfig;
  import org.openejb.corba.util.Util;
  
  
  /**
   * @version $Rev: $ $Date: 2005/03/08 04:08:33 $
   */
  public class CSSCompoundSecMechConfig implements Serializable {
  
      private short supports;
      private short requires;
      private CSSTransportMechConfig transport_mech;
      private CSSASMechConfig as_mech;
      private CSSSASMechConfig sas_mech;
  
      public CSSTransportMechConfig getTransport_mech() {
          return transport_mech;
      }
  
      public void setTransport_mech(CSSTransportMechConfig transport_mech) {
          this.transport_mech = transport_mech;
          this.supports |= transport_mech.getSupports();
          this.requires |= transport_mech.getRequires();
      }
  
      public CSSASMechConfig getAs_mech() {
          return as_mech;
      }
  
      public void setAs_mech(CSSASMechConfig as_mech) {
          this.as_mech = as_mech;
          this.supports |= as_mech.getSupports();
          this.requires |= as_mech.getRequires();
      }
  
      public CSSSASMechConfig getSas_mech() {
          return sas_mech;
      }
  
      public void setSas_mech(CSSSASMechConfig sas_mech) {
          this.sas_mech = sas_mech;
          this.supports |= sas_mech.getSupports();
          this.requires |= sas_mech.getRequires();
      }
  
      public boolean canHandle(TSSCompoundSecMechConfig requirement) {
          if ((supports & requirement.getRequires()) != 
requirement.getRequires()) return false;
          if ((requires & requirement.getSupports()) != requires) return false;
  
          if (!transport_mech.canHandle(requirement.getTransport_mech())) 
return false;
          if (!as_mech.canHandle(requirement.getAs_mech())) return false;
          if (!sas_mech.canHandle(requirement.getSas_mech())) return false;
  
          return true;
      }
  
      public ServiceContext generateServiceContext() throws UserException {
          EstablishContext msg = new EstablishContext();
  
          msg.client_context_id = 0;
          msg.client_authentication_token = new byte[0];
          msg.authorization_token = sas_mech.encodeAuthorizationElement();
          msg.identity_token = sas_mech.encodseIdentityToken();
  
          ServiceContext context = new ServiceContext();
  
          SASContextBody sas = new SASContextBody();
          sas.establish_msg(msg);
          Any sas_any = Util.getORB().create_any();
          SASContextBodyHelper.insert(sas_any, sas);
          context.context_data = Util.getCodec().encode_value(sas_any);
  
          context.context_id = SecurityAttributeService.value;
  
          return context;
      }
  }
  
  
  
  1.1                  
openejb/modules/core/src/java/org/openejb/corba/security/config/css/CSSCompoundSecMechListConfig.java
  
  Index: CSSCompoundSecMechListConfig.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 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.org/).
   *
   * 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.
   *
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the OpenEJB Project.  For more information
   * please see <http://openejb.org/>.
   *
   * ====================================================================
   */
  package org.openejb.corba.security.config.css;
  
  import java.io.Serializable;
  import java.util.ArrayList;
  import java.util.Iterator;
  import java.util.List;
  
  import org.openejb.corba.security.config.tss.TSSCompoundSecMechConfig;
  import org.openejb.corba.security.config.tss.TSSCompoundSecMechListConfig;
  
  
  /**
   * @version $Rev: $ $Date: 2005/03/08 04:08:33 $
   */
  public class CSSCompoundSecMechListConfig implements Serializable {
  
      private boolean stateful;
      private final ArrayList mechs = new ArrayList();
  
      public boolean isStateful() {
          return stateful;
      }
  
      public void setStateful(boolean stateful) {
          this.stateful = stateful;
      }
  
      public void add(CSSCompoundSecMechConfig mech) {
          mechs.add(mech);
      }
  
      public CSSCompoundSecMechConfig mechAt(int i) {
          return (CSSCompoundSecMechConfig) mechs.get(i);
      }
  
      public int size() {
          return mechs.size();
      }
  
      public List findCompatibleSet(TSSCompoundSecMechListConfig mechList) {
          List result = new ArrayList();
  
          for (Iterator availMechs = mechs.iterator(); availMechs.hasNext();) {
              CSSCompoundSecMechConfig aConfig = (CSSCompoundSecMechConfig) 
availMechs.next();
  
              int size = mechList.size();
              for (int i = 0; i < size; i++) {
                  TSSCompoundSecMechConfig requirement = mechList.mechAt(i);
  
                  if (aConfig.canHandle(requirement)) {
                      result.add(aConfig);
                  }
              }
  
          }
  
          return result;
      }
  }
  
  
  
  1.1                  
openejb/modules/core/src/java/org/openejb/corba/security/config/css/CSSConfig.java
  
  Index: CSSConfig.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: CSSConfig.java,v 1.1 2005/03/08 04:08:33 maguro Exp $
   */
  package org.openejb.corba.security.config.css;
  
  import java.io.Serializable;
  import java.util.List;
  
  import org.openejb.corba.security.config.tss.TSSCompoundSecMechListConfig;
  
  
  /**
   * @version $Revision: 1.1 $ $Date: 2005/03/08 04:08:33 $
   */
  public final class CSSConfig implements Serializable {
      private final CSSCompoundSecMechListConfig mechList = new 
CSSCompoundSecMechListConfig();
  
      public CSSCompoundSecMechListConfig getMechList() {
          return mechList;
      }
  
      public List findCompatibleSet(TSSCompoundSecMechListConfig 
mechListConfig) {
          return mechList.findCompatibleSet(mechListConfig);
      }
  }
  
  
  
  1.1                  
openejb/modules/core/src/java/org/openejb/corba/security/config/css/CSSNULLASMechConfig.java
  
  Index: CSSNULLASMechConfig.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: CSSNULLASMechConfig.java,v 1.1 2005/03/08 04:08:33 maguro Exp $
   */
  package org.openejb.corba.security.config.css;
  
  import org.openejb.corba.security.config.tss.TSSASMechConfig;
  import org.openejb.corba.security.config.tss.TSSNULLASMechConfig;
  
  
  /**
   * @version $Revision: 1.1 $ $Date: 2005/03/08 04:08:33 $
   */
  public class CSSNULLASMechConfig implements CSSASMechConfig {
  
      public short getSupports() {
          return 0;
      }
  
      public short getRequires() {
          return 0;
      }
  
      public boolean canHandle(TSSASMechConfig asMech) {
          if (asMech instanceof TSSNULLASMechConfig) return true;
          if (asMech.getRequires() == 0) return true;
  
          return false;
      }
  
      public byte[] encode() {
          return new byte[0];
      }
  }
  
  
  
  1.1                  
openejb/modules/core/src/java/org/openejb/corba/security/config/css/CSSSASMechConfig.java
  
  Index: CSSSASMechConfig.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 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.org/).
   *
   * 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.
   *
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the OpenEJB Project.  For more information
   * please see <http://openejb.org/>.
   *
   * ====================================================================
   */
  package org.openejb.corba.security.config.css;
  
  import java.io.Serializable;
  import java.util.ArrayList;
  
  import org.omg.CSI.ITTAbsent;
  import org.omg.CSI.ITTPrincipalName;
  import org.omg.CSI.AuthorizationElement;
  import org.omg.CSI.IdentityToken;
  import org.omg.CSIIOP.DelegationByClient;
  import org.omg.CSIIOP.IdentityAssertion;
  
  import org.openejb.corba.security.config.tss.TSSSASMechConfig;
  import org.openejb.corba.security.config.tss.TSSServiceConfigurationConfig;
  
  
  /**
   * @version $Rev: $ $Date: 2005/03/08 04:08:33 $
   */
  public class CSSSASMechConfig implements Serializable {
  
      private short supports;
      private short requires;
      private boolean required;
      private final ArrayList privilegeAuthorities = new ArrayList();
      private final ArrayList namingMechanisms = new ArrayList();
      private int identityTypes = ITTAbsent.value;
  
  
      public void addServiceConfigurationConfig(TSSServiceConfigurationConfig 
config) {
          privilegeAuthorities.add(config);
  
          supports |= DelegationByClient.value;
          if (required) requires = DelegationByClient.value;
      }
  
      public TSSServiceConfigurationConfig serviceConfigurationAt(int i) {
          return (TSSServiceConfigurationConfig) privilegeAuthorities.get(i);
      }
  
      public int paSize() {
          return privilegeAuthorities.size();
      }
  
      public void addnamingMechanism(String mech) {
          namingMechanisms.add(mech);
  
          identityTypes |= ITTPrincipalName.value;
          supports |= IdentityAssertion.value;
      }
  
      public String namingMechanismAt(int i) {
          return (String) namingMechanisms.get(i);
      }
  
      public int nmSize() {
          return namingMechanisms.size();
      }
  
      public int getIdentityTypes() {
          return identityTypes;
      }
  
      public void setIdentityTypes(int identityTypes) {
          this.identityTypes = identityTypes;
          if (identityTypes != 0) supports |= IdentityAssertion.value;
      }
  
      public short getSupports() {
          return supports;
      }
  
      public short getRequires() {
          return requires;
      }
  
      public boolean isRequired() {
          return required;
      }
  
      public void setRequired(boolean required) {
          this.required = required;
  
          if (required) requires = (short) (supports & 
DelegationByClient.value);
      }
  
      public boolean canHandle(TSSSASMechConfig sasMech) {
          if ((supports & sasMech.getRequires()) != sasMech.getRequires()) 
return false;
          if ((requires & sasMech.getSupports()) != requires) return false;
  
          // TODO: FILL THIS IN
  
          return true;
      }
  
      public AuthorizationElement[] encodeAuthorizationElement() {
          return new AuthorizationElement[0];
      }
  
      public IdentityToken encodseIdentityToken() {
          IdentityToken token = new IdentityToken();
  
          token.anonymous(true);
  
          return token;
      }
  }
  
  
  
  1.1                  
openejb/modules/core/src/java/org/openejb/corba/security/config/css/CSSSSLTransportConfig.java
  
  Index: CSSSSLTransportConfig.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 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.org/).
   *
   * 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.
   *
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the OpenEJB Project.  For more information
   * please see <http://openejb.org/>.
   *
   * ====================================================================
   */
  package org.openejb.corba.security.config.css;
  
  import org.openejb.corba.security.config.tss.TSSTransportMechConfig;
  
  
  /**
   * At the moment, this config class can only handle a single address.
   *
   * @version $Rev: $ $Date: 2005/03/08 04:08:33 $
   */
  public class CSSSSLTransportConfig implements CSSTransportMechConfig {
  
      private short supports;
      private short requires;
  
      public short getSupports() {
          return supports;
      }
  
      public void setSupports(short supports) {
          this.supports = supports;
      }
  
      public short getRequires() {
          return requires;
      }
  
      public boolean canHandle(TSSTransportMechConfig transMech) {
          if ((supports & transMech.getRequires()) != transMech.getRequires()) 
return false;
          if ((requires & transMech.getSupports()) != requires) return false;
  
          return true;
      }
  
      public void setRequires(short requires) {
          this.requires = requires;
      }
  }
  
  
  
  1.1                  
openejb/modules/core/src/java/org/openejb/corba/security/config/css/CSSTransportMechConfig.java
  
  Index: CSSTransportMechConfig.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 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.org/).
   *
   * 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.
   *
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the OpenEJB Project.  For more information
   * please see <http://openejb.org/>.
   *
   * ====================================================================
   */
  package org.openejb.corba.security.config.css;
  
  import java.io.Serializable;
  
  import org.openejb.corba.security.config.tss.TSSTransportMechConfig;
  
  
  /**
   * @version $Rev: $ $Date: 2005/03/08 04:08:33 $
   */
  public interface CSSTransportMechConfig extends Serializable {
  
      public short getSupports();
  
      public short getRequires();
  
      public boolean canHandle(TSSTransportMechConfig transMech);
  }
  
  
  

Reply via email to