Class MultiAuthenticator

java.lang.Object
org.deltava.security.SQLAuthenticator
org.deltava.security.MultiAuthenticator
All Implemented Interfaces:
Closeable, AutoCloseable, Authenticator
Direct Known Subclasses:
MigrationAuthenticator, MirrorAuthenticator

public abstract class MultiAuthenticator extends SQLAuthenticator
An abstract Authenticator that supports multiple authenticators.
Since:
1.0
Version:
11.1
Author:
Luke
  • Field Details

  • Constructor Details

    • MultiAuthenticator

      protected MultiAuthenticator(Class<?> logClass)
      Initializes the Authentiactor.
      Parameters:
      logClass - the log4j log class name
  • Method Details

    • init

      protected void init(String propsFile, String authPrefix) throws SecurityException
      Initializes the authenticator.
      Parameters:
      propsFile - the properties file to use
      authPrefix - the property prefix
      Throws:
      SecurityException - if an error occurs
    • getSource

      public final Authenticator getSource()
      Returns the Source Authenticator.
      Returns:
      the Source Authenticator
    • getDestination

      public final Collection<Authenticator> getDestination()
      Returns the Destination Authenticators.
      Returns:
      the destination Authenticator
    • setConnection

      protected void setConnection(Authenticator... auths)
      Checks if authenticators are a SQLAuthenticator and if so passes in an explicit Connection to use.
      Parameters:
      auths - the Authenticators to check and update
    • clearConnection

      protected static void clearConnection(Authenticator... auths)
      Checks if authenticators are a SQLAuthenticator and if so clears the an explicit Connection to use.
      Parameters:
      auths - the Authenticators to check and update
    • sync

      protected void sync(Person usr, String pwd) throws SecurityException
      Synchronizes user information between the source and destination authenticators. If the supplied credentials cannot be used to authenticate against the destination authenticator, then they are called via an Authenticator.add(org.deltava.beans.Person, java.lang.String) or Authenticator.updatePassword(org.deltava.beans.Person, java.lang.String) call to syncrhonize the two authenticators. This should only be called from a subclass' Authenticator.authenticate(org.deltava.beans.Person, java.lang.String) method since the credentials are presumed to be valid in the source authenticator.
      Parameters:
      usr - the Person bean
      pwd - the user's password
      Throws:
      SecurityException - if an error occurs
    • removeDestination

      public void removeDestination(Person usr) throws SecurityException
      Removes the specified user from any destination Authenticators, while retaining the user in the source directory.
      Parameters:
      usr - the user bean
      Throws:
      SecurityException - if the user does not exist
    • accepts

      public boolean accepts(Person usr)
      Returns whether this Authenticator will accept a new User. This defaults to TRUE, although subclasses may override this default.
      Parameters:
      usr - the user bean
      Returns:
      TRUE always