Package uk.ac.starlink.table.jdbc
Class TerminalAuthenticator
java.lang.Object
uk.ac.starlink.table.jdbc.TerminalAuthenticator
- All Implemented Interfaces:
JDBCAuthenticator
Provides JDBC authentication using the terminal; assumes that someone
is sitting at
System.in
.-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new authenticator which uses System.err for prompting.TerminalAuthenticator
(PrintStream promptStrm) Constructs a new authenticator with a given stream to use for writing prompts. -
Method Summary
-
Constructor Details
-
TerminalAuthenticator
Constructs a new authenticator with a given stream to use for writing prompts.- Parameters:
promptStrm
- output stream for prompting
-
TerminalAuthenticator
public TerminalAuthenticator()Constructs a new authenticator which uses System.err for prompting.
-
-
Method Details
-
authenticate
Description copied from interface:JDBCAuthenticator
Obtains username and password. The return value is a two-element array containing the username and password to be used, in that order. Either or both of these may benull
.- Specified by:
authenticate
in interfaceJDBCAuthenticator
- Returns:
String[]{username,password}
- Throws:
IOException
- if there is some error
-
readUser
Prompts to the prompt stream and reads the user name from standard input.- Returns:
- user name obtained from user
- Throws:
IOException
-
readPassword
Prompts to the prompt stream and reads the password from standard input.- Returns:
- password obtained from user
- Throws:
IOException
-