epugh       2003/08/23 15:00:33

  Added:       security/src/java/org/apache/fulcrum/security/spi/passive
                        PassiveUserManager.java
  Log:
  
  
  Revision  Changes    Path
  1.1                  
jakarta-turbine-fulcrum/security/src/java/org/apache/fulcrum/security/spi/passive/PassiveUserManager.java
  
  Index: PassiveUserManager.java
  ===================================================================
  package org.apache.fulcrum.security.spi.passive;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001-2003 The Apache Software Foundation.  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 the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Turbine" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Turbine", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * 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 APACHE SOFTWARE FOUNDATION 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 Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import java.util.List;
  
  import org.apache.fulcrum.security.entity.User;
  import org.apache.fulcrum.security.spi.torque.impl.TorqueUserManagerImpl;
  import org.apache.fulcrum.security.util.DataBackendException;
  import org.apache.fulcrum.security.util.EntityExistsException;
  import org.apache.fulcrum.security.util.PasswordMismatchException;
  import org.apache.fulcrum.security.util.UnknownEntityException;
  import org.apache.torque.util.Criteria;
  
  /**
   * Void user manager can be used where no data storage is needed
   * by the application.
   * It's methods don't provide any useful functionality  except throwing
   * DataBackendExceptions. Security service will be still able to create
   * anonymous User objects when this UserManager is used.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Rafal Krzewski</a>
   * @version $Id: PassiveUserManager.java,v 1.1 2003/08/23 22:00:33 epugh Exp $
   */
  public class PassiveUserManager extends TorqueUserManagerImpl
  {
      /**
       * Check whether a specified user's account exists.
       *
       * The login name is used for looking up the account.
       *
       * @param user The user to be checked.
       * @return true if the specified account exists
       * @throws DataBackendException if there was an error accessing the data backend.
       */
      public boolean accountExists(User user)
          throws DataBackendException
      {
          throw new DataBackendException("PassiveUserManager knows no users");
      }
  
      /**
       * Check whether a specified user's account exists.
       *
       * The login name is used for looking up the account.
       *
       * @param userName The name of the user to be checked.
       * @return true if the specified account exists
       * @throws DataBackendException if there was an error accessing the data backend.
       */
      public boolean accountExists(String userName)
          throws DataBackendException
      {
          throw new DataBackendException("PassiveUserManager knows no users");
      }
  
      /**
       * Retrieve a user from persistent storage using username as the
       * key.
       *
       * @param username the name of the user.
       * @return an User object.
       * @exception UnknownEntityException if the user's record does not
       *            exist in the database.
       * @exception DataBackendException if there is a problem accessing the
       *            storage.
       */
      public User retrieve(String username)
          throws UnknownEntityException, DataBackendException
      {
          throw new DataBackendException("PassiveUserManager knows no users");
      }
  
  
  
      /**
       * Retrieve a set of users that meet the specified criteria.
       *
       * As the keys for the criteria, you should use the constants that
       * are defined in [EMAIL PROTECTED] User} interface, plus the names
       * of the custom attributes you added to your user representation
       * in the data storage. Use verbatim names of the attributes -
       * without table name prefix in case of DB implementation.
       *
       * @param criteria The criteria of selection.
       * @return a List of users meeting the criteria.
       * @throws DataBackendException if there is a problem accessing the
       *         storage.
       */
      public List retrieveList(Criteria criteria)
              throws DataBackendException
      {
          throw new DataBackendException("PassiveUserManager knows no users");
      }
  
      /**
       * Retrieve a user from persistent storage using username as the
       * key, and authenticate the user. The implementation may chose
       * to authenticate to the server as the user whose data is being
       * retrieved.
       *
       * @param username the name of the user.
       * @param password the user supplied password.
       * @return an User object.
       * @exception PasswordMismatchException if the supplied password was
       *            incorrect.
       * @exception UnknownEntityException if the user's record does not
       *            exist in the database.
       * @exception DataBackendException if there is a problem accessing the
       *            storage.
       */
      public User retrieve(String username, String password)
          throws PasswordMismatchException, UnknownEntityException,
                 DataBackendException
      {
          throw new DataBackendException("PassiveUserManager knows no users");
      }
  
      /**
       * Save an User object to persistent storage. User's record is
       * required to exist in the storage.
       *
       * @param user an User object to store.
       * @exception UnknownEntityException if the user's record does not
       *            exist in the database.
       * @exception DataBackendException if there is a problem accessing the
       *            storage.
       */
      public void store(User user)
          throws UnknownEntityException, DataBackendException
      {
          throw new DataBackendException("PassiveUserManager does not support saving 
user data");
      }
  
      /**
       * Saves User data when the session is unbound. The user account is required
       * to exist in the storage.
       *
       * LastLogin, AccessCounter, persistent pull tools, and any data stored
       * in the permData hashtable that is not mapped to a column will be saved.
       *
       * @exception UnknownEntityException if the user's account does not
       *            exist in the database.
       * @exception DataBackendException if there is a problem accessing the
       *            storage.
       */
      public void saveOnSessionUnbind(User user)
              throws UnknownEntityException, DataBackendException
      {
          throw new DataBackendException("PassiveUserManager does not support saving 
user data");
      }
  
      /**
       * Authenticate an User with the specified password. If authentication
       * is successful the method returns nothing. If there are any problems,
       * exception was thrown.
       *
       * @param user an User object to authenticate.
       * @param password the user supplied password.
       * @exception PasswordMismatchException if the supplied password was
       *            incorrect.
       * @exception UnknownEntityException if the user's record does not
       *            exist in the database.
       * @exception DataBackendException if there is a problem accessing the
       *            storage.
       */
      public void authenticate(User user, String password)
          throws PasswordMismatchException, UnknownEntityException,
                 DataBackendException
      {
          throw new DataBackendException("PassiveUserManager knows no users");
      }
  
      /**
       * Creates new user account with specified attributes.
       *
       * @param user the object describing account to be created.
       * @param initialPassword The password to use for the object creation
       *
       * @throws DataBackendException if there was an error accessing the data backend.
       * @throws EntityExistsException if the user account already exists.
       */
      public void createAccount(User user, String initialPassword)
              throws EntityExistsException, DataBackendException
      {
          throw new DataBackendException("PassiveUserManager does not support"
                  + " creating accounts");
      }
  
      /**
       * Removes an user account from the system.
       *
       * @param user the object describing the account to be removed.
       * @throws DataBackendException if there was an error accessing the data backend.
       * @throws UnknownEntityException if the user account is not present.
       */
      public void removeAccount(User user)
          throws UnknownEntityException, DataBackendException
      {
          throw new DataBackendException("PassiveUserManager does not support removing 
accounts");
      }
  
      /**
       * Change the password for an User.
       *
       * @param user an User to change password for.
       * @param oldPassword the current password supplied by the user.
       * @param newPassword the current password requested by the user.
       * @exception PasswordMismatchException if the supplied password was
       *            incorrect.
       * @exception UnknownEntityException if the user's record does not
       *            exist in the database.
       * @exception DataBackendException if there is a problem accessing the
       *            storage.
       */
      public void changePassword(User user, String oldPassword,
                                 String newPassword)
              throws PasswordMismatchException, UnknownEntityException,
                 DataBackendException
      {
          throw new DataBackendException("PassiveUserManager does not support setting 
passwords");
      }
  
      /**
       * Forcibly sets new password for an User.
       *
       * This is supposed by the administrator to change the forgotten or
       * compromised passwords. Certain implementatations of this feature
       * would require administrative level access to the authenticating
       * server / program.
       *
       * @param user an User to change password for.
       * @param password the new password.
       * @exception UnknownEntityException if the user's record does not
       *            exist in the database.
       * @exception DataBackendException if there is a problem accessing the
       *            storage.
       */
      public void forcePassword(User user, String password)
          throws UnknownEntityException, DataBackendException
      {
          throw new DataBackendException("PassiveUserManager does not support setting 
passwords");
      }
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to