Class InstallerProperties

java.lang.Object
net.shibboleth.idp.installer.impl.InstallerProperties

public class InstallerProperties extends Object
Class which encapsulated all the properties/UI driven configuration of an install. NOTE Updated to this properties should be reflected in the "PropertyDriverInstallation" wiki page."/
  • Field Details

    • PROPERTY_SOURCE_FILE

      @Nonnull @NotEmpty public static final String PROPERTY_SOURCE_FILE
      The name of a property file to fill in some or all of the above. This file is deleted after processing.
      See Also:
    • IDP_PROPERTIES_MERGE

      @Nonnull @NotEmpty public static final String IDP_PROPERTIES_MERGE
      The name of a property file to merge with idp.properties.
      See Also:
    • LDAP_PROPERTIES_MERGE

      @Nonnull @NotEmpty public static final String LDAP_PROPERTIES_MERGE
      The name of a property file to merge with ldap.properties.
      See Also:
    • LDAP_PASSWORD

      @Nonnull @NotEmpty public static final String LDAP_PASSWORD
      The LDAP Password (usually associated with a username in ldap.properties).
      See Also:
    • TARGET_DIR

      @Nonnull @NotEmpty public static final String TARGET_DIR
      Where to install to. Default is basedir
      See Also:
    • ENTITY_ID

      @Nonnull @NotEmpty public static final String ENTITY_ID
      The entity ID.
      See Also:
    • NO_PROMPT

      @Nonnull @NotEmpty public static final String NO_PROMPT
      Do we cause a failure rather than a prompt.
      See Also:
    • HOST_NAME

      @Nonnull @NotEmpty public static final String HOST_NAME
      What is the installer host name?
      See Also:
    • SCOPE

      @Nonnull @NotEmpty public static final String SCOPE
      The scope to assert.
      See Also:
    • KEY_STORE_PASSWORD

      @Nonnull @NotEmpty public static final String KEY_STORE_PASSWORD
      The keystore password to use.
      See Also:
    • SEALER_PASSWORD

      @Nonnull @NotEmpty public static final String SEALER_PASSWORD
      The sealer password to use.
      See Also:
    • SEALER_ALIAS

      @Nonnull @NotEmpty public static final String SEALER_ALIAS
      The sealer alias to use.
      See Also:
    • SEALER_KEYSIZE

      @Nonnull @NotEmpty public static final String SEALER_KEYSIZE
      The keysize for the sealer.
      See Also:
    • KEY_SIZE

      @Nonnull @NotEmpty public static final String KEY_SIZE
      The the key size to generate.
      See Also:
    • MODE_CREDENTIAL_KEYS

      @Nonnull @NotEmpty public static final String MODE_CREDENTIAL_KEYS
      Mode to set on credential *key files.
      See Also:
    • GROUP_CONF_CREDENTIALS

      @Nonnull @NotEmpty public static final String GROUP_CONF_CREDENTIALS
      Group to set on files in the credential and conf directories.
      See Also:
    • PERFORM_SET_MODE

      @Nonnull @NotEmpty public static final String PERFORM_SET_MODE
      Do we do any chgrp/chmod work?
      See Also:
    • NO_TIDY

      @Nonnull @NotEmpty public static final String NO_TIDY
      Whether to tidy up after ourselves.
      See Also:
    • INITIAL_INSTALL_MODULES

      @Nonnull @NotEmpty public static final String INITIAL_INSTALL_MODULES
      Which modules to enable on initial install.
      Since:
      4.1.0
      See Also:
    • DEFAULT_KEY_SIZE

      public static final int DEFAULT_KEY_SIZE
      Whether to tidy up after ourselves.
      See Also:
    • CORE_MODULES

      @Nonnull public static final Set<String> CORE_MODULES
      Those modules which are "core".
    • DEFAULT_MODULES

      @Nonnull public static final Set<String> DEFAULT_MODULES
      Those modules enabled by default.
    • log

      @Nonnull private final org.slf4j.Logger log
      Class logger.
    • installerProperties

      @NonnullAfterInit private Properties installerProperties
      The properties driving the install.
    • targetDir

      @Nullable private Path targetDir
      The target Directory.
    • srcDir

      @Nonnull private final Path srcDir
      The sourceDirectory.
    • noPrompt

      private boolean noPrompt
      Do we allow prompting?
    • entityID

      @Nullable private String entityID
      The entity ID.
    • hostname

      @Nullable private String hostname
      Hostname.
    • scope

      @Nullable private String scope
      scope.
    • keyStorePassword

      @Nullable private String keyStorePassword
      Keystore Password.
    • sealerPassword

      @Nullable private String sealerPassword
      Sealer Password.
    • sealerAlias

      @Nullable private String sealerAlias
      Sealer Alias.
    • keySize

      private int keySize
      Key Size. (for signing, encryption and backchannel).
    • tidy

      private boolean tidy
      whether to tidy up.
    • setGroupAndMode

      private boolean setGroupAndMode
      whether to tidy up.
    • credentialsKeyFileMode

      @Nullable private String credentialsKeyFileMode
      credentials key file mode.
    • inputHandler

      @Nonnull private final org.apache.tools.ant.input.InputHandler inputHandler
      Input handler from the prompting.
  • Constructor Details

    • InstallerProperties

      public InstallerProperties(@Nonnull Path sourceDir)
      Constructor.
      Parameters:
      sourceDir - Where the *source* installation is
  • Method Details

    • getInputHandler

      @Nonnull protected org.apache.tools.ant.input.InputHandler getInputHandler()
      Get an InputHandler for the prompting.
      Returns:
      an input handler
    • doInitialize

      protected void doInitialize() throws ComponentInitializationException
      Initialization routine.
      Throws:
      ComponentInitializationException - if initialization fails
    • getValue

      @Nonnull protected String getValue(String propertyName, String prompt, NonnullSupplier<String> defaultSupplier) throws org.apache.tools.ant.BuildException
      Lookup a property; if it isn't defined then ask the user (if we are allowed).

      This is used by most (but all) getters that redirect through a property.

      Parameters:
      propertyName - the property to lookup
      prompt - what to say to the user
      defaultSupplier - how to get the default value. Using a Supplier allows this to be a reasonably heavyweight operation
      Returns:
      the value
      Throws:
      org.apache.tools.ant.BuildException - of anything goes wrong
    • getPassword

      @Nonnull protected String getPassword(String propertyName, String prompt) throws org.apache.tools.ant.BuildException
      Lookup a property; if it isn't defined then ask the user (if we are allowed) via a no-echo interface.

      Note that this does not work within a debugger.

      Parameters:
      propertyName - the property to lookup
      prompt - what to say to the user
      Returns:
      the value (this is not echoed to the terminal)
      Throws:
      org.apache.tools.ant.BuildException - of anything goes wrong
    • getTargetDir

      @Nonnull public Path getTargetDir() throws org.apache.tools.ant.BuildException
      Get where we are installing/updating/building the war.

      This is slightly complicated because the default depends on what we are doing.

      Returns:
      the target directory
      Throws:
      org.apache.tools.ant.BuildException - if something goes awry
    • getSourceDir

      @Nonnull public Path getSourceDir()
      Where is the install coming from?
      Returns:
      the source directory
    • getEntityID

      @Nonnull public String getEntityID()
      Get the EntityId for this install.
      Returns:
      the name
    • isNoTidy

      public boolean isNoTidy()
      Does the user want us to *not* tidy up?
      Returns:
      do we not tidy up?
    • hasHostName

      private boolean hasHostName(InetAddress addr)
      Is this address named?

      Helper method for bestHostName().

      Parameters:
      addr - what to look at
      Returns:
      true unless the name is the canonical name
    • bestHostName

      @Nonnull private String bestHostName()
      Find the most apposite network connector, taken from Ant.
      Returns:
      the best name we can work out
    • getHostName

      @Nonnull public String getHostName()
      Get the host name for this install.

      Defaults to information pulled from the network.

      Returns:
      the host name.
    • getCredentialsKeyFileMode

      @Nonnull public String getCredentialsKeyFileMode()
      Mode to set on all files in credentials.
      Returns:
      the mode
    • getCredentialsGroup

      @Nullable public String getCredentialsGroup()
      Group to set on all files in credentials and conf.
      Returns:
      the mode or null if none to be set
    • isSetGroupAndMode

      public boolean isSetGroupAndMode()
      Do we set the mode?
      Returns:
      do we the mode
    • defaultScope

      @Nonnull protected String defaultScope()
      Evaluate the default scope value.
      Returns:
      everything after the first '.' in getHostName()
    • getScope

      @Nonnull public String getScope()
      Get the scope for this installation.
      Returns:
      the scope
    • getLDAPPassword

      @Nullable public String getLDAPPassword() throws org.apache.tools.ant.BuildException
      Get the LDAP password iff one was provided. DO NOT PROMPT
      Returns:
      the password if provided by a properties
      Throws:
      org.apache.tools.ant.BuildException - if badness happens
    • getSubjectAltName

      @Nonnull public String getSubjectAltName()
      Get the SubjectAltName for the certificates.
      Returns:
      the SubjectAltName
    • getKeyStorePassword

      @Nonnull public String getKeyStorePassword()
      Get the password for the keystore for this installation.
      Returns:
      the password.
    • getSealerPassword

      @Nonnull public String getSealerPassword()
      Get the password for the sealer for this installation.
      Returns:
      the password.
    • getModulesToEnable

      @Nonnull @NotLive @Unmodifiable public Set<String> getModulesToEnable()
      Get the modules to enable after first install.
      Returns:
      the modules
    • getCoreModules

      @Nonnull @NotLive @Unmodifiable public Set<String> getCoreModules()
      Get the modules to enable before ant install.
      Returns:
      the modules
    • getSealerKeySize

      @Nullable Integer getSealerKeySize() throws org.apache.tools.ant.BuildException
      Return the sealer key size, if this has been specified.
      Returns:
      the key size or null if non specified
      Throws:
      org.apache.tools.ant.BuildException - if the size was not an integer
    • getSealerAlias

      @Nonnull public String getSealerAlias()
      Get the alias for the sealer key.
      Returns:
      the alias
    • getKeySize

      public int getKeySize()
      Get the key size for signing, encryption and backchannel
      Returns:
      the keysize, default is 3072.
    • getMergeFile

      @Nullable protected Path getMergeFile(String propName) throws org.apache.tools.ant.BuildException
      Get the file specified as the property as a File, or null if it doesn't exist.
      Parameters:
      propName - the name to lookup
      Returns:
      null if the property is not provided a Path otherwise
      Throws:
      org.apache.tools.ant.BuildException - if the property is supplied but the file doesn't exist.
    • getIdPMergeProperties

      @Nullable public Path getIdPMergeProperties() throws org.apache.tools.ant.BuildException
      Get the a file to merge with idp.properties or null.
      Returns:
      the file or null if it none required
      Throws:
      org.apache.tools.ant.BuildException - if badness happens
    • getLDAPMergeProperties

      @Nullable public Path getLDAPMergeProperties() throws org.apache.tools.ant.BuildException
      Get the a file to merge with ldap.properties or null.
      Returns:
      the path or null if it none required
      Throws:
      org.apache.tools.ant.BuildException - if badness happens