Package ghidra.framework.client
Class HeadlessClientAuthenticator
java.lang.Object
ghidra.framework.client.HeadlessClientAuthenticator
- All Implemented Interfaces:
ClientAuthenticator,KeyStorePasswordProvider
HeadlessClientAuthenticator provides the ability to install a Ghidra Server
authenticator needed when operating in a headless mode.-
Method Summary
Modifier and TypeMethodDescriptionGet a standard Java authenticator for HTTP and other standard network connectionschar[]getKeyStorePassword(String keystorePath, boolean passwordError) Requests password for keystore filechar[]getNewPassword(Component parent, String serverInfo, String username) Get new user passwordstatic voidinstallHeadlessClientAuthenticator(String username, String keystorePath, boolean allowPasswordPrompt) Install headless client authenticator for Ghidra Server and when http/https connections require authentication and have not specified user information.booleanbooleanprocessPasswordCallbacks(String title, String serverType, String serverName, boolean allowUserNameEntry, NameCallback nameCb, PasswordCallback passCb, ChoiceCallback choiceCb, AnonymousCallback anonymousCb, String loginError) Process password authentication callbacks.booleanprocessSSHSignatureCallbacks(String serverName, NameCallback nameCb, SSHSignatureCallback sshCb) Process Ghidra Server SSH authentication callbacks.booleanpromptForReconnect(Component parent, String message) Prompt user for reconnect
-
Method Details
-
getAuthenticator
Description copied from interface:ClientAuthenticatorGet a standard Java authenticator for HTTP and other standard network connections- Specified by:
getAuthenticatorin interfaceClientAuthenticator- Returns:
- authenticator object
-
installHeadlessClientAuthenticator
public static void installHeadlessClientAuthenticator(String username, String keystorePath, boolean allowPasswordPrompt) throws IOException Install headless client authenticator for Ghidra Server and when http/https connections require authentication and have not specified user information.- Parameters:
username- optional username to be used with a Ghidra Server which allows username to be specified. If null,ClientUtil.getUserName()will be used.keystorePath- optional PKI or SSH keystore path. May also be specified as resource path for SSH key.allowPasswordPrompt- if true the user may be prompted for passwords via the console (stdin). Please note that the Java console will echo the password entry to the terminal which may be undesirable.- Throws:
IOException- if error occurs while opening specified keystorePath
-
getNewPassword
Description copied from interface:ClientAuthenticatorGet new user password- Specified by:
getNewPasswordin interfaceClientAuthenticator- Parameters:
parent- dialog parent component or null if not applicableserverInfo- server host infousername-- Returns:
- new password or null if password should not be changed, if not null array will be cleared by caller
-
processPasswordCallbacks
public boolean processPasswordCallbacks(String title, String serverType, String serverName, boolean allowUserNameEntry, NameCallback nameCb, PasswordCallback passCb, ChoiceCallback choiceCb, AnonymousCallback anonymousCb, String loginError) Description copied from interface:ClientAuthenticatorProcess password authentication callbacks.- Specified by:
processPasswordCallbacksin interfaceClientAuthenticator- Parameters:
title- password prompt title if GUI is usedserverType- type of server (label associated with serverName)serverName- name of serverallowUserNameEntry- if true user ID entry will be supported if nameCb is not null.nameCb- provides storage for user login name. A null indicates that the default user name will be used, @see ClientUtil#getUserName()passCb- provides storage for user password, @see PasswordCallback#setPassword(char[])choiceCb- specifies choice between NT Domain authentication (index=0) and local password file authentication (index=1). Set selected index to specify authenticator to be used,anonymousCb- may be used to request anonymous read-only access to the server. A null is specified if anonymous access has not been enabed on the server.loginError- previous login error message or null for first attempt- Returns:
- true if password provided, false if entry cancelled
- See Also:
-
promptForReconnect
Description copied from interface:ClientAuthenticatorPrompt user for reconnect- Specified by:
promptForReconnectin interfaceClientAuthenticator- Parameters:
parent- dialog parent component or null if not applicablemessage-- Returns:
- return true if reconnect should be attempted
-
getKeyStorePassword
Description copied from interface:KeyStorePasswordProviderRequests password for keystore file- Specified by:
getKeyStorePasswordin interfaceKeyStorePasswordProvider- Parameters:
keystorePath- keystore file pathpasswordError- if true this is a repeated prompt due to a password use failure- Returns:
- password or null, if not null caller will clear array when no longer needed.
-
processSSHSignatureCallbacks
public boolean processSSHSignatureCallbacks(String serverName, NameCallback nameCb, SSHSignatureCallback sshCb) Description copied from interface:ClientAuthenticatorProcess Ghidra Server SSH authentication callbacks.- Specified by:
processSSHSignatureCallbacksin interfaceClientAuthenticator- Parameters:
serverName- name of servernameCb- provides storage for user login name. A null indicates that the default user name will be used, @see ClientUtil#getUserName().sshCb- provides authentication token to be signed with private key, @see SSHAuthenticationCallback#sign(SSHPrivateKey)- Returns:
-
isSSHKeyAvailable
public boolean isSSHKeyAvailable()- Specified by:
isSSHKeyAvailablein interfaceClientAuthenticator- Returns:
- true if SSH private key is available for authentication
-