Class AuthPropertiesDelegate

java.lang.Object
edu.ucsb.nceas.metacat.properties.AuthPropertiesDelegate

public class AuthPropertiesDelegate extends Object
AuthPropertiesDelegate handles Authentication-related properties for metacat configuration. Since it is a singleton class that has a private constructor, a shared instance of AuthPropertiesDelegate can be obtained by a call to the static method AuthPropertiesDelegate.getInstance(). However, PropertyService should be the only class instantiating AuthPropertiesDelegate and calling its methods. When PropertyService receives Authentication-related method calls, they are simply "passed through" and delegated directly to the corresponding methods in AuthPropertiesDelegate. This pattern was used to improve encapsulation, separation of concerns, readability, and reasoning about how the codebase works.
See Also:
  • Field Details

    • AUTH_METADATA_FILE_NAME

      protected static final String AUTH_METADATA_FILE_NAME
      See Also:
    • AUTH_BACKUP_FILE_NAME

      protected static final String AUTH_BACKUP_FILE_NAME
      See Also:
    • authMetadataFilePath

      protected static String authMetadataFilePath
    • authPropertiesMetadata

      protected static edu.ucsb.nceas.utilities.PropertiesMetaData authPropertiesMetadata
    • authBackupFilePath

      protected static String authBackupFilePath
    • authBackupProperties

      protected static edu.ucsb.nceas.utilities.SortedProperties authBackupProperties
  • Method Details

    • getInstance

      protected static AuthPropertiesDelegate getInstance() throws edu.ucsb.nceas.utilities.GeneralPropertyException
      Get a shared singleton AuthPropertiesDelegate instance by calling AuthPropertiesDelegate.getInstance(). If the instance does not already exist, it will be created on the first call. Subsequent calls will return this same instance.
      Returns:
      a shared singleton AuthPropertiesDelegate instance
      Throws:
      edu.ucsb.nceas.utilities.GeneralPropertyException - if an XML TransformerException or an IOException are thrown when trying to load the auth-related properties
    • getAuthBackupProperties

      protected edu.ucsb.nceas.utilities.SortedProperties getAuthBackupProperties()
      Get the auth backup properties file. These are configurable properties that are stored outside the metacat install directories so the user does not need to re-enter all the configuration information every time they do an upgrade.
      Returns:
      a SortedProperties object with the backup properties
    • getAuthPropertiesMetadata

      protected edu.ucsb.nceas.utilities.PropertiesMetaData getAuthPropertiesMetadata()
      Get the auth properties metadata. This is retrieved from an xml file that describes the attributes of configurable properties.
      Returns:
      a PropertiesMetaData object with the organization properties metadata
    • persistAuthBackupProperties

      protected void persistAuthBackupProperties() throws edu.ucsb.nceas.utilities.GeneralPropertyException
      Writes out configurable properties to a backup file outside the metacat install directory, so they are not lost if metacat installation is overwritten during an upgrade. These backup properties are used by the admin page to populate defaults when the configuration is edited. (They are also used to overwrite the main properties if bypassAuthConfiguration() is called)
      Throws:
      edu.ucsb.nceas.utilities.GeneralPropertyException
    • bypassAuthConfiguration

      protected void bypassAuthConfiguration()
      (for dev use only) Bypasses the auth properties configuration utility by using the auth backup properties to overwrite the main properties.