Class MigrationAuthenticator

All Implemented Interfaces:
Closeable, AutoCloseable, Authenticator

public class MigrationAuthenticator extends MultiAuthenticator
An Authenticator used to migrate user data from one Directory to another. When a user is sucessfully authenticated by the first ("source") authenticator, the directory name and password are written into the second ("destination") authenticator and deleted from the source.
Since:
1.0
Version:
11.1
Author:
Luke
  • Constructor Details

    • MigrationAuthenticator

      public MigrationAuthenticator()
      Loads the Authenticator.
  • Method Details

    • init

      public void init(String propsFile) throws SecurityException
      Initializes the Authenticator.
      Specified by:
      init in interface Authenticator
      Overrides:
      init in class SQLAuthenticator
      Parameters:
      propsFile - the name of the proeprties file to load
      Throws:
      SecurityException - if an error occurs
    • authenticate

      public void authenticate(Person usr, String pwd) throws SecurityException
      Authenticates the user. This authenticator will check the destination Directory to see if it contains an entry for the user. If it does, then authentication proceeds normally. If not, then the credentials are authenticated against the source Directory. If authentication succeeds, they are used to add credentials to the destnation Directory.
      Parameters:
      usr - the User bean
      pwd - the user's password
      Throws:
      SecurityException - if authentication fails for any reason, contained within the cause of the exception.
      See Also:
    • accepts

      public boolean accepts(Person usr)
      Returns whether the destination Authenticator will accept a user.
      Specified by:
      accepts in interface Authenticator
      Overrides:
      accepts in class MultiAuthenticator
      Parameters:
      usr - the user bean
      Returns:
      whether the destination Authenticator will accept the person
    • contains

      public boolean contains(Person usr) throws SecurityException
      Checks if a particular name exists in either Directory.
      Parameters:
      usr - the user bean
      Returns:
      TRUE if the user exists in either Authenticator, otherwise FALSE
      Throws:
      SecurityException - if an error occurs
    • updatePassword

      public void updatePassword(Person usr, String pwd) throws SecurityException
      Updates a user's password. This user must be present in the destination directory.
      Parameters:
      usr - the User bean
      pwd - the new password
      Throws:
      SecurityException - if an error occurs, or the user is not in the Destination directory
    • add

      public void add(Person usr, String pwd) throws SecurityException
      Adds a User to the Destination Directory.
      Parameters:
      usr - the User bean
      pwd - the User's password
      Throws:
      SecurityException - if an error occurs
    • remove

      public void remove(Person usr) throws SecurityException
      Removes a User from the Directory. This will remove from the first directory containing the user, first the Destination, then the Source.
      Parameters:
      usr - the user bean
      Throws:
      SecurityException - if an error occurs or the user does not exist
    • rename

      public void rename(Person usr, String newName) throws SecurityException
      Renames a user in the Destination Directory.
      Parameters:
      usr - the user bean
      newName - the new fully-qualified directory
      Throws:
      SecurityException - if an error occurs
    • disable

      public void disable(Person usr) throws SecurityException
      Disables a user in the source and/or destination authenticators.
      Parameters:
      usr - the user bean
      Throws:
      SecurityException - if an error occurs