Package org.postgresql.jdbcurlresolver
Class PgPassParser
java.lang.Object
org.postgresql.jdbcurlresolver.PgPassParser
helps to read Password File.
https://www.postgresql.org/docs/current/libpq-pgpass.html
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
checkFilePermissions
(Path path) private String
checkForPattern
(String line, String value) private String
evaluateLine
(String fullLine, int currentLine) private String
extractPassword
(String line) private String
(package private) static String
Read .pgpass resourceprivate InputStream
openInputStream
(String resourceName) private String
parseInputStream
(InputStream inputStream)
-
Field Details
-
LOGGER
-
SEPARATOR
private static final char SEPARATOR- See Also:
-
fileName
-
hostname
-
port
-
database
-
user
-
-
Constructor Details
-
PgPassParser
-
-
Method Details
-
getPassword
static String getPassword(String fileName, String hostname, String port, String database, String user) Read .pgpass resource- Parameters:
fileName
- fileNamehostname
- hostnameport
- portdatabase
- databaseuser
- username- Returns:
- password or null
-
findPassword
-
openInputStream
- Throws:
IOException
-
checkFilePermissions
- Throws:
IOException
-
parseInputStream
- Throws:
IOException
-
evaluateLine
-
extractPassword
-
checkForPattern
-