Class FileSystemEncryptRealmCommand


  • class FileSystemEncryptRealmCommand
    extends Command
    Elytron-Tool command to convert un-encrypted FileSystemRealms into an encrypted realm with the use of a SecretKey. Also, optionally provides a WildFly CLI script to register the FileSystemRealm and corresponding security-domain in WildFly.
    Author:
    Ashpan Raskar
    • Constructor Detail

      • FileSystemEncryptRealmCommand

        FileSystemEncryptRealmCommand()
    • Method Detail

      • help

        public void help()
        Displays the help for the command
        Overrides:
        help in class Command
      • warningHandler

        private void warningHandler​(String warning)
        Prints out a warning message if silentMode is not enabled and adds the warning to the summary if summaryMode is enabled
        Parameters:
        warning - The warning to be shown
      • errorHandler

        private void errorHandler​(Exception e)
                           throws Exception
        Determines if a summary needs to be printed and prints summary after an error is thrown
        Parameters:
        e - The exception thrown during execution
        Throws:
        Exception - The exception to be handled by Elytron Tool
      • printDescriptorBlocks

        private void printDescriptorBlocks​(int count)
        Prints out information found in a descriptor file for summary mode
        Parameters:
        count - The amount of descriptor blocks in the file
      • getDescriptorParam

        private String getDescriptorParam​(String param,
                                          FileSystemEncryptRealmCommand.Descriptor descriptor)
        Returns the value for a given param in a Descriptor object
        Parameters:
        param - The parameter to be obtained from the Descriptor object
        descriptor - The Descriptor object to be used
        Returns:
        The value of the given parameter
      • parseDescriptorFile

        private void parseDescriptorFile​(String file)
                                  throws Exception
        Handles input being given as a descriptor file
        Throws:
        Exception - Exception to be handled by Elytron Tool
      • copyAddResetDescriptor

        private void copyAddResetDescriptor​(FileSystemEncryptRealmCommand.Descriptor original)
        Copies a Descriptor into a temporary one for it can be cloned into the list of descriptors
        Parameters:
        original - The original descriptor that is continually modified
      • findMissingRequiredValuesAndSetValues

        private void findMissingRequiredValuesAndSetValues​(int count,
                                                           FileSystemEncryptRealmCommand.Descriptor descriptor)
        Determines if the current descriptor block is missing any required values and then if it is, prints out a warning message and sets that required value and the optional values to null
        Parameters:
        count - The index of the current descriptor block
      • createFileSystemRealm

        private void createFileSystemRealm()
                                    throws Exception
        Handles creating the Elytron filesystem-realm from the descriptor array
        Throws:
        Exception - Exception to be handled by Elytron Tool
      • createWildFlyScript

        private void createWildFlyScript()
                                  throws Exception
        Creates the script/commands the user must run for Elytron to recognize and use the new filesystem-realm
        Throws:
        Exception