You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ad...@apache.org on 2004/05/30 03:27:36 UTC

cvs commit: incubator-geronimo/modules/security/src/test/org/apache/geronimo/security/network/protocol SubjectCarryingProtocolTest.java

adc         2004/05/29 18:27:36

  Modified:    modules/security project.xml
               modules/security/src/java/org/apache/geronimo/security/jaas
                        ConfigurationEntry.java
                        ConfigurationEntryLocal.java
                        ConfigurationEntryRealmLocal.java
                        ConfigurationEntryRealmRemote.java
               modules/security/src/test/org/apache/geronimo/security/jaas
                        ConfigurationEntryTest.java
                        LoginKerberosNonGeronimoTest.java
                        LoginPropertiesFileTest.java
               modules/security/src/test/org/apache/geronimo/security/network/protocol
                        SubjectCarryingProtocolTest.java
  Added:       modules/security/src/java/org/apache/geronimo/security/jaas
                        LoginModuleControlFlag.java
                        LoginModuleControlFlagEditor.java
  Log:
  Added PropertyEditor for LoginModuleControlFlag.
  
  Revision  Changes    Path
  1.18      +7 -1      incubator-geronimo/modules/security/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/security/project.xml,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- project.xml	1 May 2004 06:40:20 -0000	1.17
  +++ project.xml	30 May 2004 01:27:35 -0000	1.18
  @@ -64,6 +64,12 @@
   
           <dependency>
               <groupId>geronimo</groupId>
  +            <artifactId>geronimo-common</artifactId>
  +            <version>${pom.currentVersion}</version>
  +        </dependency>
  +
  +        <dependency>
  +            <groupId>geronimo</groupId>
               <artifactId>geronimo-kernel</artifactId>
               <version>${pom.currentVersion}</version>
           </dependency>
  
  
  
  1.3       +6 -7      incubator-geronimo/modules/security/src/java/org/apache/geronimo/security/jaas/ConfigurationEntry.java
  
  Index: ConfigurationEntry.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/security/src/java/org/apache/geronimo/security/jaas/ConfigurationEntry.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ConfigurationEntry.java	25 Feb 2004 09:58:08 -0000	1.2
  +++ ConfigurationEntry.java	30 May 2004 01:27:35 -0000	1.3
  @@ -19,8 +19,7 @@
   
   import javax.management.MBeanServer;
   import javax.security.auth.login.AppConfigurationEntry;
  -
  -import java.util.Collections;
  +import java.util.HashMap;
   import java.util.Map;
   
   import org.apache.geronimo.gbean.GAttributeInfo;
  @@ -53,8 +52,8 @@
   
       protected GBeanMBeanContext context;
       protected String JAASId;
  -    protected AppConfigurationEntry.LoginModuleControlFlag controlFlag;
  -    protected Map options = Collections.EMPTY_MAP;
  +    protected LoginModuleControlFlag controlFlag;
  +    protected Map options = new HashMap();
   
       /**
        * Get the JAAS config id for this configuration entry.
  @@ -74,11 +73,11 @@
           this.JAASId = JAASId;
       }
   
  -    public AppConfigurationEntry.LoginModuleControlFlag getControlFlag() {
  +    public LoginModuleControlFlag getControlFlag() {
           return controlFlag;
       }
   
  -    public void setControlFlag(AppConfigurationEntry.LoginModuleControlFlag controlFlag) {
  +    public void setControlFlag(LoginModuleControlFlag controlFlag) {
           this.controlFlag = controlFlag;
       }
   
  
  
  
  1.3       +2 -2      incubator-geronimo/modules/security/src/java/org/apache/geronimo/security/jaas/ConfigurationEntryLocal.java
  
  Index: ConfigurationEntryLocal.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/security/src/java/org/apache/geronimo/security/jaas/ConfigurationEntryLocal.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ConfigurationEntryLocal.java	25 Feb 2004 09:58:08 -0000	1.2
  +++ ConfigurationEntryLocal.java	30 May 2004 01:27:35 -0000	1.3
  @@ -58,7 +58,7 @@
           try {
               return new AppConfigurationEntry[]{
                   new AppConfigurationEntry(loginModuleName,
  -                                          getControlFlag(),
  +                                          getControlFlag().getFlag(),
                                             getOptions())};
           } catch (Exception e) {
           }
  
  
  
  1.3       +2 -2      incubator-geronimo/modules/security/src/java/org/apache/geronimo/security/jaas/ConfigurationEntryRealmLocal.java
  
  Index: ConfigurationEntryRealmLocal.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/security/src/java/org/apache/geronimo/security/jaas/ConfigurationEntryRealmLocal.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ConfigurationEntryRealmLocal.java	25 Feb 2004 09:58:08 -0000	1.2
  +++ ConfigurationEntryRealmLocal.java	30 May 2004 01:27:35 -0000	1.3
  @@ -69,7 +69,7 @@
           try {
               return new AppConfigurationEntry[]{
                   new AppConfigurationEntry("org.apache.geronimo.security.jaas.LocalLoginModule",
  -                                          getControlFlag(),
  +                                          getControlFlag().getFlag(),
                                             getOptions())};
           } catch (Exception e) {
           }
  
  
  
  1.3       +2 -2      incubator-geronimo/modules/security/src/java/org/apache/geronimo/security/jaas/ConfigurationEntryRealmRemote.java
  
  Index: ConfigurationEntryRealmRemote.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/security/src/java/org/apache/geronimo/security/jaas/ConfigurationEntryRealmRemote.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ConfigurationEntryRealmRemote.java	25 Feb 2004 09:58:09 -0000	1.2
  +++ ConfigurationEntryRealmRemote.java	30 May 2004 01:27:35 -0000	1.3
  @@ -59,7 +59,7 @@
           try {
               return new AppConfigurationEntry[]{
                   new AppConfigurationEntry("org.apache.geronimo.security.jaas.LocalLoginModule",
  -                                          getControlFlag(),
  +                                          getControlFlag().getFlag(),
                                             getOptions())};
           } catch (Exception e) {
           }
  
  
  
  1.1                  incubator-geronimo/modules/security/src/java/org/apache/geronimo/security/jaas/LoginModuleControlFlag.java
  
  Index: LoginModuleControlFlag.java
  ===================================================================
  /**
   *
   * Copyright 2004 The Apache Software Foundation
   *
   *  Licensed under the Apache License, Version 2.0 (the "License");
   *  you may not use this file except in compliance with the License.
   *  You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   *  Unless required by applicable law or agreed to in writing, software
   *  distributed under the License is distributed on an "AS IS" BASIS,
   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *  See the License for the specific language governing permissions and
   *  limitations under the License.
   */
  
  package org.apache.geronimo.security.jaas;
  
  import javax.security.auth.login.AppConfigurationEntry;
  import java.io.Serializable;
  import java.io.ObjectStreamException;
  
  
  /**
   *
   * @version $Revision: 1.1 $ $Date: 2004/05/30 01:27:35 $
   */
  public class LoginModuleControlFlag implements Serializable {
  
      private static final LoginModuleControlFlag[] values = new LoginModuleControlFlag[4];
  
      public static final LoginModuleControlFlag REQUIRED = new LoginModuleControlFlag(0, AppConfigurationEntry.LoginModuleControlFlag.REQUIRED);
      public static final LoginModuleControlFlag REQUISITE = new LoginModuleControlFlag(1, AppConfigurationEntry.LoginModuleControlFlag.REQUISITE);
      public static final LoginModuleControlFlag SUFFICIENT = new LoginModuleControlFlag(2, AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT);
      public static final LoginModuleControlFlag OPTIONAL = new LoginModuleControlFlag(3, AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL);
  
      private final int ordinal;
      private final transient AppConfigurationEntry.LoginModuleControlFlag flag;
  
      private LoginModuleControlFlag(int ordinal, AppConfigurationEntry.LoginModuleControlFlag flag) {
          this.ordinal = ordinal;
          this.flag = flag;
          values[ordinal] = this;
      }
  
      public AppConfigurationEntry.LoginModuleControlFlag getFlag() {
          return flag;
      }
  
      Object readResolve() throws ObjectStreamException {
          return values[ordinal];
      }
  }
  
  
  
  1.1                  incubator-geronimo/modules/security/src/java/org/apache/geronimo/security/jaas/LoginModuleControlFlagEditor.java
  
  Index: LoginModuleControlFlagEditor.java
  ===================================================================
  /**
   *
   * Copyright 2004 The Apache Software Foundation
   *
   *  Licensed under the Apache License, Version 2.0 (the "License");
   *  you may not use this file except in compliance with the License.
   *  You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   *  Unless required by applicable law or agreed to in writing, software
   *  distributed under the License is distributed on an "AS IS" BASIS,
   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *  See the License for the specific language governing permissions and
   *  limitations under the License.
   */
  
  package org.apache.geronimo.security.jaas;
  
  import org.apache.geronimo.common.propertyeditor.TextPropertyEditorSupport;
  import org.apache.geronimo.common.propertyeditor.PropertyEditorException;
  
  
  /**
   *
   * @version $Revision: 1.1 $ $Date: 2004/05/30 01:27:35 $
   */
  public class LoginModuleControlFlagEditor extends TextPropertyEditorSupport {
  
      public LoginModuleControlFlagEditor() {
          super();
      }
  
      public LoginModuleControlFlagEditor(final Object source) {
          super(source);
      }
  
      public Object getValue() {
          if ("REQUIRED".equals(getAsText())) {
              return LoginModuleControlFlag.REQUIRED;
          } else if ("REQUISITE".equals(getAsText())) {
              return LoginModuleControlFlag.REQUISITE;
          } else if ("SUFFICIENT".equals(getAsText())) {
              return LoginModuleControlFlag.SUFFICIENT;
          } else if ("OPTIONAL".equals(getAsText())) {
              return LoginModuleControlFlag.OPTIONAL;
          }
          throw new PropertyEditorException("Illegal value: '" + getAsText() + "'");
      }
  }
  
  
  
  1.5       +2 -3      incubator-geronimo/modules/security/src/test/org/apache/geronimo/security/jaas/ConfigurationEntryTest.java
  
  Index: ConfigurationEntryTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/security/src/test/org/apache/geronimo/security/jaas/ConfigurationEntryTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ConfigurationEntryTest.java	28 May 2004 22:22:40 -0000	1.4
  +++ ConfigurationEntryTest.java	30 May 2004 01:27:36 -0000	1.5
  @@ -19,7 +19,6 @@
   
   import javax.management.ObjectName;
   import javax.security.auth.Subject;
  -import javax.security.auth.login.AppConfigurationEntry;
   import javax.security.auth.login.Configuration;
   import javax.security.auth.login.LoginContext;
   
  @@ -102,7 +101,7 @@
           testCE = new ObjectName("geronimo.security:type=ConfigurationEntry,jaasId=properties");
           gbean.setAttribute("JAASId", "properties");
           gbean.setAttribute("RealmName", "properties-realm");
  -        gbean.setAttribute("ControlFlag", AppConfigurationEntry.LoginModuleControlFlag.REQUIRED);
  +        gbean.setAttribute("ControlFlag", LoginModuleControlFlag.REQUIRED);
           gbean.setAttribute("Options", new HashMap());
           kernel.loadGBean(testCE, gbean);
   
  
  
  
  1.3       +2 -3      incubator-geronimo/modules/security/src/test/org/apache/geronimo/security/jaas/LoginKerberosNonGeronimoTest.java
  
  Index: LoginKerberosNonGeronimoTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/security/src/test/org/apache/geronimo/security/jaas/LoginKerberosNonGeronimoTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LoginKerberosNonGeronimoTest.java	25 Feb 2004 09:58:10 -0000	1.2
  +++ LoginKerberosNonGeronimoTest.java	30 May 2004 01:27:36 -0000	1.3
  @@ -19,7 +19,6 @@
   
   import javax.management.ObjectName;
   import javax.security.auth.Subject;
  -import javax.security.auth.login.AppConfigurationEntry;
   import javax.security.auth.login.Configuration;
   import javax.security.auth.login.LoginContext;
   import javax.security.auth.login.LoginException;
  @@ -67,7 +66,7 @@
           kerberosCE = new ObjectName("geronimo.security:type=ConfigurationEntry,jaasId=kerberos-foobar");
           gbean.setAttribute("JAASId", "kerberos-foobar");
           gbean.setAttribute("LoginModuleName", "com.sun.security.auth.module.Krb5LoginModule");
  -        gbean.setAttribute("ControlFlag", AppConfigurationEntry.LoginModuleControlFlag.REQUIRED);
  +        gbean.setAttribute("ControlFlag", LoginModuleControlFlag.REQUIRED);
           gbean.setAttribute("Options", options);
           kernel.loadGBean(kerberosCE, gbean);
   
  
  
  
  1.5       +2 -3      incubator-geronimo/modules/security/src/test/org/apache/geronimo/security/jaas/LoginPropertiesFileTest.java
  
  Index: LoginPropertiesFileTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/security/src/test/org/apache/geronimo/security/jaas/LoginPropertiesFileTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- LoginPropertiesFileTest.java	28 May 2004 22:22:40 -0000	1.4
  +++ LoginPropertiesFileTest.java	30 May 2004 01:27:36 -0000	1.5
  @@ -19,7 +19,6 @@
   
   import javax.management.ObjectName;
   import javax.security.auth.Subject;
  -import javax.security.auth.login.AppConfigurationEntry;
   import javax.security.auth.login.Configuration;
   import javax.security.auth.login.LoginContext;
   
  @@ -71,7 +70,7 @@
           propertiesCE = new ObjectName("geronimo.security:type=ConfigurationEntry,jaasId=properties");
           gbean.setAttribute("JAASId", "properties");
           gbean.setAttribute("RealmName", "properties-realm");
  -        gbean.setAttribute("ControlFlag", AppConfigurationEntry.LoginModuleControlFlag.REQUIRED);
  +        gbean.setAttribute("ControlFlag", LoginModuleControlFlag.REQUIRED);
           gbean.setAttribute("Options", new HashMap());
           kernel.loadGBean(propertiesCE, gbean);
   
  
  
  
  1.9       +3 -3      incubator-geronimo/modules/security/src/test/org/apache/geronimo/security/network/protocol/SubjectCarryingProtocolTest.java
  
  Index: SubjectCarryingProtocolTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/security/src/test/org/apache/geronimo/security/network/protocol/SubjectCarryingProtocolTest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SubjectCarryingProtocolTest.java	28 May 2004 22:22:40 -0000	1.8
  +++ SubjectCarryingProtocolTest.java	30 May 2004 01:27:36 -0000	1.9
  @@ -19,7 +19,6 @@
   
   import javax.management.ObjectName;
   import javax.security.auth.Subject;
  -import javax.security.auth.login.AppConfigurationEntry;
   import javax.security.auth.login.Configuration;
   import javax.security.auth.login.LoginContext;
   
  @@ -53,6 +52,7 @@
   import org.apache.geronimo.network.protocol.control.ControlServerProtocolWaiter;
   import org.apache.geronimo.security.AbstractTest;
   import org.apache.geronimo.security.jaas.GeronimoLoginConfiguration;
  +import org.apache.geronimo.security.jaas.LoginModuleControlFlag;
   import org.apache.geronimo.system.ClockPool;
   import org.apache.geronimo.system.ThreadPool;
   import org.apache.geronimo.system.serverinfo.ServerInfo;
  @@ -292,7 +292,7 @@
           propertiesCE = new ObjectName("geronimo.security:type=ConfigurationEntry,jaasId=properties");
           gbean.setAttribute("JAASId", "properties");
           gbean.setAttribute("RealmName", "properties-realm");
  -        gbean.setAttribute("ControlFlag", AppConfigurationEntry.LoginModuleControlFlag.REQUIRED);
  +        gbean.setAttribute("ControlFlag", LoginModuleControlFlag.REQUIRED);
           gbean.setAttribute("Options", new HashMap());
           kernel.loadGBean(propertiesCE, gbean);