moved TrivialCatalinaRealm to src/example tree
authormaxcooper <maxcooper>
Mon, 9 Jun 2003 11:14:18 +0000 (11:14 +0000)
committermaxcooper <maxcooper>
Mon, 9 Jun 2003 11:14:18 +0000 (11:14 +0000)
moved example app realms into new packages

src/catalina-example/org/securityfilter/example/catalina/TrivialCatalinaRealm.java [deleted file]
src/example/org/securityfilter/example/TrivialSecurityRealm.java [deleted file]
src/example/org/securityfilter/example/realm/TrivialSecurityRealm.java [new file with mode: 0644]
src/example/org/securityfilter/example/realm/catalina/TrivialCatalinaRealm.java [new file with mode: 0644]

diff --git a/src/catalina-example/org/securityfilter/example/catalina/TrivialCatalinaRealm.java b/src/catalina-example/org/securityfilter/example/catalina/TrivialCatalinaRealm.java
deleted file mode 100644 (file)
index 3f0cfff..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * $Header: /cvsroot/securityfilter/securityfilter/src/catalina-example/org/securityfilter/example/catalina/Attic/TrivialCatalinaRealm.java,v 1.4 2003/02/07 11:17:38 maxcooper Exp $
- * $Revision: 1.4 $
- * $Date: 2003/02/07 11:17:38 $
- *
- * ====================================================================
- * The SecurityFilter Software License, Version 1.1
- *
- * (this license is derived and fully compatible with the Apache Software
- * License - see http://www.apache.org/LICENSE.txt)
- *
- * Copyright (c) 2002 SecurityFilter.org. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 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 end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by
- *        SecurityFilter.org (http://www.securityfilter.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The name "SecurityFilter" must not be used to endorse or promote
- *    products derived from this software without prior written permission.
- *    For written permission, please contact license@securityfilter.org .
- *
- * 5. Products derived from this software may not be called "SecurityFilter",
- *    nor may "SecurityFilter" appear in their name, without prior written
- *    permission of SecurityFilter.org.
- *
- * THIS SOFTWARE IS PROVIDED ``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 SECURITY FILTER PROJECT 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.
- * ====================================================================
- */
-
-package org.securityfilter.example.catalina;
-
-import org.apache.catalina.realm.GenericPrincipal;
-import org.apache.catalina.realm.RealmBase;
-
-import java.security.Principal;
-import java.util.ArrayList;
-
-/**
- * TrivialCatalinaRealm - Trivial Catalina Realm implementation to demonstrate
- * org.securityfilter.realm.catalina.CatalinaRealmAdapter adapter class.
- *
- * @author Max Cooper (max@maxcooper.com)
- * @version $Revision: 1.4 $ $Date: 2003/02/07 11:17:38 $
- */
-public class TrivialCatalinaRealm extends RealmBase {
-   private static final String THE_USERNAME = "username";
-   private static final String THE_PASSWORD = "password";
-   private static final String THE_ROLE = "inthisrole";
-
-   private String exampleProperty;
-
-   /**
-    * Return a short name for this Realm implementation.
-    */
-   protected String getName() {
-      return null;
-   }
-
-   /**
-    * Return the password associated with the given principal's user name.
-    */
-   protected String getPassword(String s) {
-      return (THE_USERNAME.equals(s) ? THE_PASSWORD : null);
-   }
-
-   /**
-    * Return the Principal associated with the given user name.
-    */
-   protected Principal getPrincipal(String s) {
-      if (THE_USERNAME.equals(s)) {
-         ArrayList roleList = new ArrayList();
-         roleList.add(THE_ROLE);
-         return new GenericPrincipal(this, THE_USERNAME, THE_PASSWORD, roleList);
-      } else {
-         return null;
-      }
-   }
-
-   /**
-    * Setter for exampleProperty to deomonstrate setting realm properties from config file.
-    *
-    * This has no effect other than printing a message when the property is set.
-    *
-    * @param value example property value
-    */
-   public void setExampleProperty(String value) {
-      exampleProperty = value;
-      System.out.println(this.getClass().getName() + ": exampleProperty set to \'" + value + "\'");
-   }
-
-   /**
-    * Getter for exampleProperty.
-    *
-    * @return the value of exampleProperty
-    */
-   public String getExampleProperty() {
-      return exampleProperty;
-   }   
-}
-
-// ----------------------------------------------------------------------------
-// EOF
diff --git a/src/example/org/securityfilter/example/TrivialSecurityRealm.java b/src/example/org/securityfilter/example/TrivialSecurityRealm.java
deleted file mode 100644 (file)
index 25bf409..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * $Header: /cvsroot/securityfilter/securityfilter/src/example/org/securityfilter/example/Attic/TrivialSecurityRealm.java,v 1.8 2003/06/09 10:59:42 maxcooper Exp $
- * $Revision: 1.8 $
- * $Date: 2003/06/09 10:59:42 $
- *
- * ====================================================================
- * The SecurityFilter Software License, Version 1.1
- *
- * (this license is derived and fully compatible with the Apache Software
- * License - see http://www.apache.org/LICENSE.txt)
- *
- * Copyright (c) 2002 SecurityFilter.org. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 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 end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by
- *        SecurityFilter.org (http://www.securityfilter.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The name "SecurityFilter" must not be used to endorse or promote
- *    products derived from this software without prior written permission.
- *    For written permission, please contact license@securityfilter.org .
- *
- * 5. Products derived from this software may not be called "SecurityFilter",
- *    nor may "SecurityFilter" appear in their name, without prior written
- *    permission of SecurityFilter.org.
- *
- * THIS SOFTWARE IS PROVIDED ``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 SECURITY FILTER PROJECT 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.
- * ====================================================================
- */
-
-package org.securityfilter.example;
-
-import org.securityfilter.realm.SimpleSecurityRealmBase;
-
-/**
- * Trivial implementation of the SecurityRealmInterface.
- *
- * There is one user: username is 'username', password is 'password'
- * And this user is in one role: 'inthisrole'
- *
- * @author Max Cooper (max@maxcooper.com)
- * @version $Revision: 1.8 $ $Date: 2003/06/09 10:59:42 $
- */
-public class TrivialSecurityRealm extends SimpleSecurityRealmBase {
-
-   private String exampleProperty;
-
-   /**
-    * Authenticate a user.
-    *
-    * Implement this method in a subclass to avoid dealing with Principal objects.
-    *
-    * @param username a username
-    * @param password a plain text password, as entered by the user
-    *
-    * @return null if the user cannot be authenticated, otherwise a Pricipal object is returned
-    */
-   public boolean booleanAuthenticate(String username, String password) {
-      return Constants.VALID_USERNAME.equals(username) && Constants.VALID_PASSWORD.equals(password);
-   }
-
-   /**
-    * Test for role membership.
-    *
-    * Implement this method in a subclass to avoid dealing with Principal objects.
-    *
-    * @param username The name of the user
-    * @param role name of a role to test for membership
-    * @return true if the user is in the role, false otherwise
-    */
-   public boolean isUserInRole(String username, String role) {
-      return Constants.VALID_USERNAME.equals(username) && Constants.VALID_ROLE.equals(role);
-   }
-
-   /**
-    * Setter for exampleProperty to deomonstrate setting realm properties from config file.
-    *
-    * This has no effect other than printing a message when the property is set.
-    *
-    * @param value example property value
-    */
-   public void setExampleProperty(String value) {
-      exampleProperty = value;
-      System.out.println(this.getClass().getName() + ": exampleProperty set to \'" + value + "\'");
-   }
-
-   /**
-    * Getter for exampleProperty.
-    *
-    * @return the value of exampleProperty
-    */
-   public String getExampleProperty() {
-      return exampleProperty;
-   }
-}
-
-// ----------------------------------------------------------------------------
-// EOF
diff --git a/src/example/org/securityfilter/example/realm/TrivialSecurityRealm.java b/src/example/org/securityfilter/example/realm/TrivialSecurityRealm.java
new file mode 100644 (file)
index 0000000..a1b9db5
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ * $Header: /cvsroot/securityfilter/securityfilter/src/example/org/securityfilter/example/realm/TrivialSecurityRealm.java,v 1.1 2003/06/09 11:14:18 maxcooper Exp $
+ * $Revision: 1.1 $
+ * $Date: 2003/06/09 11:14:18 $
+ *
+ * ====================================================================
+ * The SecurityFilter Software License, Version 1.1
+ *
+ * (this license is derived and fully compatible with the Apache Software
+ * License - see http://www.apache.org/LICENSE.txt)
+ *
+ * Copyright (c) 2002 SecurityFilter.org. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 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 end-user documentation included with the redistribution,
+ *    if any, must include the following acknowledgment:
+ *       "This product includes software developed by
+ *        SecurityFilter.org (http://www.securityfilter.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself,
+ *    if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The name "SecurityFilter" must not be used to endorse or promote
+ *    products derived from this software without prior written permission.
+ *    For written permission, please contact license@securityfilter.org .
+ *
+ * 5. Products derived from this software may not be called "SecurityFilter",
+ *    nor may "SecurityFilter" appear in their name, without prior written
+ *    permission of SecurityFilter.org.
+ *
+ * THIS SOFTWARE IS PROVIDED ``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 SECURITY FILTER PROJECT 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.
+ * ====================================================================
+ */
+
+package org.securityfilter.example.realm;
+
+import org.securityfilter.realm.SimpleSecurityRealmBase;
+import org.securityfilter.example.Constants;
+
+/**
+ * Trivial implementation of the SecurityRealmInterface.
+ *
+ * There is one user: username is 'username', password is 'password'
+ * And this user is in one role: 'inthisrole'
+ *
+ * @author Max Cooper (max@maxcooper.com)
+ * @version $Revision: 1.1 $ $Date: 2003/06/09 11:14:18 $
+ */
+public class TrivialSecurityRealm extends SimpleSecurityRealmBase {
+
+   private String exampleProperty;
+
+   /**
+    * Authenticate a user.
+    *
+    * Implement this method in a subclass to avoid dealing with Principal objects.
+    *
+    * @param username a username
+    * @param password a plain text password, as entered by the user
+    *
+    * @return null if the user cannot be authenticated, otherwise a Pricipal object is returned
+    */
+   public boolean booleanAuthenticate(String username, String password) {
+      return Constants.VALID_USERNAME.equals(username) && Constants.VALID_PASSWORD.equals(password);
+   }
+
+   /**
+    * Test for role membership.
+    *
+    * Implement this method in a subclass to avoid dealing with Principal objects.
+    *
+    * @param username The name of the user
+    * @param role name of a role to test for membership
+    * @return true if the user is in the role, false otherwise
+    */
+   public boolean isUserInRole(String username, String role) {
+      return Constants.VALID_USERNAME.equals(username) && Constants.VALID_ROLE.equals(role);
+   }
+
+   /**
+    * Setter for exampleProperty to deomonstrate setting realm properties from config file.
+    *
+    * This has no effect other than printing a message when the property is set.
+    *
+    * @param value example property value
+    */
+   public void setExampleProperty(String value) {
+      exampleProperty = value;
+      System.out.println(this.getClass().getName() + ": exampleProperty set to \'" + value + "\'");
+   }
+
+   /**
+    * Getter for exampleProperty.
+    *
+    * @return the value of exampleProperty
+    */
+   public String getExampleProperty() {
+      return exampleProperty;
+   }
+}
+
+// ----------------------------------------------------------------------------
+// EOF
diff --git a/src/example/org/securityfilter/example/realm/catalina/TrivialCatalinaRealm.java b/src/example/org/securityfilter/example/realm/catalina/TrivialCatalinaRealm.java
new file mode 100644 (file)
index 0000000..9879e30
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * $Header: /cvsroot/securityfilter/securityfilter/src/example/org/securityfilter/example/realm/catalina/TrivialCatalinaRealm.java,v 1.1 2003/06/09 11:14:18 maxcooper Exp $
+ * $Revision: 1.1 $
+ * $Date: 2003/06/09 11:14:18 $
+ *
+ * ====================================================================
+ * The SecurityFilter Software License, Version 1.1
+ *
+ * (this license is derived and fully compatible with the Apache Software
+ * License - see http://www.apache.org/LICENSE.txt)
+ *
+ * Copyright (c) 2002 SecurityFilter.org. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 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 end-user documentation included with the redistribution,
+ *    if any, must include the following acknowledgment:
+ *       "This product includes software developed by
+ *        SecurityFilter.org (http://www.securityfilter.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself,
+ *    if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The name "SecurityFilter" must not be used to endorse or promote
+ *    products derived from this software without prior written permission.
+ *    For written permission, please contact license@securityfilter.org .
+ *
+ * 5. Products derived from this software may not be called "SecurityFilter",
+ *    nor may "SecurityFilter" appear in their name, without prior written
+ *    permission of SecurityFilter.org.
+ *
+ * THIS SOFTWARE IS PROVIDED ``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 SECURITY FILTER PROJECT 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.
+ * ====================================================================
+ */
+
+package org.securityfilter.example.realm.catalina;
+
+import org.apache.catalina.realm.GenericPrincipal;
+import org.apache.catalina.realm.RealmBase;
+
+import java.security.Principal;
+import java.util.ArrayList;
+
+/**
+ * TrivialCatalinaRealm - Trivial Catalina Realm implementation to demonstrate
+ * org.securityfilter.realm.catalina.CatalinaRealmAdapter adapter class.
+ *
+ * @author Max Cooper (max@maxcooper.com)
+ * @version $Revision: 1.1 $ $Date: 2003/06/09 11:14:18 $
+ */
+public class TrivialCatalinaRealm extends RealmBase {
+   private static final String THE_USERNAME = "username";
+   private static final String THE_PASSWORD = "password";
+   private static final String THE_ROLE = "inthisrole";
+
+   private String exampleProperty;
+
+   /**
+    * Return a short name for this Realm implementation.
+    */
+   protected String getName() {
+      return null;
+   }
+
+   /**
+    * Return the password associated with the given principal's user name.
+    */
+   protected String getPassword(String s) {
+      return (THE_USERNAME.equals(s) ? THE_PASSWORD : null);
+   }
+
+   /**
+    * Return the Principal associated with the given user name.
+    */
+   protected Principal getPrincipal(String s) {
+      if (THE_USERNAME.equals(s)) {
+         ArrayList roleList = new ArrayList();
+         roleList.add(THE_ROLE);
+         return new GenericPrincipal(this, THE_USERNAME, THE_PASSWORD, roleList);
+      } else {
+         return null;
+      }
+   }
+
+   /**
+    * Setter for exampleProperty to deomonstrate setting realm properties from config file.
+    *
+    * This has no effect other than printing a message when the property is set.
+    *
+    * @param value example property value
+    */
+   public void setExampleProperty(String value) {
+      exampleProperty = value;
+      System.out.println(this.getClass().getName() + ": exampleProperty set to \'" + value + "\'");
+   }
+
+   /**
+    * Getter for exampleProperty.
+    *
+    * @return the value of exampleProperty
+    */
+   public String getExampleProperty() {
+      return exampleProperty;
+   }
+}
+
+// ----------------------------------------------------------------------------
+// EOF