Class FileSystemRealmCommand


  • class FileSystemRealmCommand
    extends Command
    Elytron-Tool command to convert legacy properties file into a FileSystemRealm. Also, optionally provides a WildFly CLI script to register the FileSystemRealm and corresponding security-domain in WildFly.
    Author:
    Justin Cook
    • Constructor Detail

      • FileSystemRealmCommand

        FileSystemRealmCommand()
    • 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,
                                          FileSystemRealmCommand.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​(FileSystemRealmCommand.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,
                                                           FileSystemRealmCommand.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
      • parseInputFile

        private List<String> parseInputFile​(FileSystemRealmCommand.Descriptor descriptor,
                                            String param,
                                            int count)
                                     throws Exception
        Parses a uses or roles properties file to get the user mappings (users-password for users files and users-roles for roles files).
        Parameters:
        descriptor - The descriptor class holding the information for this block
        param - The type of input file (either users-file or roles-file)
        count - The index of the current descriptor block
        Returns:
        The String list of each user mapping in the file
        Throws:
        Exception - Exception to be handled by Elytron Tool
      • createFileSystemRealm

        private void createFileSystemRealm()
                                    throws Exception
        Handles creating the Elytron filesystem-realm from the input arrays
        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