![]() |
filechampion4j 0.9.8.3
File validation library for Java
|
Public Member Functions | |
CredentialsManager (Path credsPath, List< String > credsNamesList) throws IllegalArgumentException | |
void | setExpirationTime (long expirationTime) throws IllegalArgumentException |
char[] | getCredentials (String credsName) throws IllegalArgumentException, IOException |
Private Member Functions | |
char[] | getCredFileChars (Path credFilePath) throws IOException |
void | logInfo (StringBuilder message) |
void | logSevere (StringBuilder message) |
void | logFine (StringBuilder message) |
void | generateRandomString () |
char[] | addSalt (char[] charString) |
void | checkCredExpiration () |
Private Attributes | |
StringBuilder | logMessage = new StringBuilder() |
long | credsExpirationTime = 300000 |
Path | credsPath |
List< String > | credsNamesList |
List< char[]> | credsList = new LinkedList<>() |
Map< String, Map< Integer, Long > > | credsMap = new HashMap<>() |
SecureRandom | random = new SecureRandom() |
String | randomString = "" |
int | randomStringIndex = 0 |
boolean | expirationTimerStarted = false |
Static Private Attributes | |
static final Logger | LOGGER = Logger.getLogger(CredentialsManager.class.getName()) |
CredentialsManager class is used to manage any credendials that are needed for plugins, such as API keys, etc.
Definition at line 27 of file CredentialsManager.java.
dev.filechampion.filechampion4j.CredentialsManager.CredentialsManager | ( | Path | credsPath, |
List< String > | credsNamesList | ||
) | throws IllegalArgumentException |
Constructor for CredentialsManager class.
credsPath | (Path) - Path to the directory where the credentials files are stored. |
credsNamesList | (List <String>) - List of the names of the credentials names/files. |
IllegalArgumentException | - If the credsPath is null or does not exist, or if the credsNamesList is null or empty, or if any of the credentials files are not found. |
Definition at line 59 of file CredentialsManager.java.
References dev.filechampion.filechampion4j.CredentialsManager.credsNamesList, dev.filechampion.filechampion4j.CredentialsManager.credsPath, dev.filechampion.filechampion4j.CredentialsManager.logInfo(), dev.filechampion.filechampion4j.CredentialsManager.logMessage, and dev.filechampion.filechampion4j.CredentialsManager.logSevere().
|
private |
Add unique salt to a given string.
charString | (char[]) - The string to add salt to. |
Definition at line 223 of file CredentialsManager.java.
|
private |
This method is used to check if any credential is expired, and remove them from the list if it is.
Definition at line 242 of file CredentialsManager.java.
|
private |
Generate a random string of a given length
Definition at line 206 of file CredentialsManager.java.
char[] dev.filechampion.filechampion4j.CredentialsManager.getCredentials | ( | String | credsName | ) | throws IllegalArgumentException, IOException |
This method is used to retrieve a credential from the cached credentials list or read it from the file and add it to the list.
credsName | (String) - Name of the credentials name/file to retrieve. |
IllegalArgumentException | - If the credsName is null or empty, or if the credsName is not found in the credsNamesList. |
IOException | - If there is an error reading the credentials file. |
Definition at line 112 of file CredentialsManager.java.
|
private |
This method is used to read a single credential file into a char[] for storage in the Map. char[] grows dynamically as the file is read using 64 byte chunks.
credFilePath | (Path) - Path to the credentials file to read. |
IOException | - If there is an error reading the credentials file. |
Definition at line 145 of file CredentialsManager.java.
|
private |
LOGGER.fine wrapper
message | (StringBuilder) - message to log |
Definition at line 197 of file CredentialsManager.java.
|
private |
LOGGER.info wrapper
message | (String) - message to log |
Definition at line 177 of file CredentialsManager.java.
Referenced by dev.filechampion.filechampion4j.CredentialsManager.CredentialsManager(), and dev.filechampion.filechampion4j.CredentialsManager.setExpirationTime().
|
private |
LOGGER.severe wrapper
message | (String) - message to log |
Definition at line 187 of file CredentialsManager.java.
Referenced by dev.filechampion.filechampion4j.CredentialsManager.CredentialsManager(), and dev.filechampion.filechampion4j.CredentialsManager.setExpirationTime().
void dev.filechampion.filechampion4j.CredentialsManager.setExpirationTime | ( | long | expirationTime | ) | throws IllegalArgumentException |
This method allows the user to set the expiration time for credentials in milliseconds, overriding the default of 300000 (5 minutes).
expirationTime | (long) - The expiration time in milliseconds. |
IllegalArgumentException | - If the expirationTime is less than or equal to 0. |
Definition at line 87 of file CredentialsManager.java.
References dev.filechampion.filechampion4j.CredentialsManager.logInfo(), dev.filechampion.filechampion4j.CredentialsManager.logMessage, and dev.filechampion.filechampion4j.CredentialsManager.logSevere().
|
private |
Definition at line 43 of file CredentialsManager.java.
|
private |
Definition at line 46 of file CredentialsManager.java.
|
private |
Definition at line 47 of file CredentialsManager.java.
|
private |
Definition at line 45 of file CredentialsManager.java.
Referenced by dev.filechampion.filechampion4j.CredentialsManager.CredentialsManager().
|
private |
Definition at line 44 of file CredentialsManager.java.
Referenced by dev.filechampion.filechampion4j.CredentialsManager.CredentialsManager().
|
private |
Definition at line 51 of file CredentialsManager.java.
|
staticprivate |
Definition at line 41 of file CredentialsManager.java.
|
private |
Definition at line 42 of file CredentialsManager.java.
Referenced by dev.filechampion.filechampion4j.CredentialsManager.CredentialsManager(), and dev.filechampion.filechampion4j.CredentialsManager.setExpirationTime().
|
private |
Definition at line 48 of file CredentialsManager.java.
|
private |
Definition at line 49 of file CredentialsManager.java.
|
private |
Definition at line 50 of file CredentialsManager.java.