How to Add a New Database Password Manager
CopyStorm supports reading Database credentials from a user-supplied Database password manager.
This feature was introduced to eliminate the need to:
- Change the saved password in many CopyStorm configuration files.
- Provide the password to CopyStorm on the command line due to security rules.
In addition to security benefits, this feature allows you to use your own company-wide password manager.
The process to add a new Database password manager to CopyStorm is to:
- Write a Java class that extends the class com.aslan.sfdc.connect.credentials.AbstractJDBCUserPasswordCredentials
- Package the new Java class in a jar and place it in the “lib” subdirectory of the CopyStorm installation.
- Add a new CredentialsRegistry.xml file to CopyStorm’s config directory to register thenew credential manager with CopyStorm.
Writing the Java Class
The Java class needs to extend com.aslan.sfdc.connect.credentials.AbstractJDBCUserPasswordCredentials, and will need to override/implement the following methods:
|String getUsername()||Yes||Returns the username used when authenticating with the Database.|
|String getPassword()||Yes||Returns the password used when authenticating with the Database.|
|boolean setRequired(boolean required)||Yes||Update the credentials editor to indicate that the connection type does not require credential information (e.g. when using SQL/Server’s integrated security).|
|int injectIntoUI(JPanel panel, int startRow)||No||Adds any UI elements needed by the password manager to the CopyStorm UI.|
|boolean isAvailable()||No||Returns true if the password manager should appear as an option in the UI.|
|void saveState(Element e, boolean savePasswords)||Yes||Adds XML attributes to the provided Element to save any information needed to restore system state. This information is saved to CopyStorm’s configuration file.|
|void restoreState(Element e)||Yes||Restore XML state saved via saveState()|
|String getFingerprint()||Yes||Returns a value used to determine whether or not credentials have changed. This is used to determine whether or not a cached session may be used when connecting with the Database.|
|boolean isComplete()||Yes||Returns true when information provided by the user is enough to attempt a connection to the Database.|
|void clear()||Yes||Clears out any internal state kept by the password manager.|
In addition to the required methods above, there are several convenience methods which may be used by credential managers:
|void fireCredentialsComplete(boolean complete)||Enables or disables the “Test Database Connection” button.|
|void addRowToUI(String label, String toltip, JComponent editor, JPanel panel, int row||Adds a new editor to the UI.
This method can be used in the injectIntoUI() method to maintain consistent styling with the rest of the CopyStorm UI.
|String encrypt(String text)||Encrypts text.
This method can be used in the saveState() function to avoid implementing a custom encryption scheme to support encrypting saved passwords.
|String decrypt(String encryptedText)||Decrypts text encrypted with encrypt().
This method can be used in the restoreState() function to avoid implementing a custom encryption scheme.
|void saveXMLAttribute(Element e, String key, String value)||Adds a new attribute to an XML element.
This method can be used in the saveState() function to avoid interacting with the Element directly.
|String loadXMLAttribute(Element e, String key)||Retrieves an attribute to an XML element
This method can be used in the restoreState() function to avoid interacting with the Element directly.
Example Credential Manager: Keepass
Click Here to view the Java source of Capstorm’s built-in Keepass Database password manager.