|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.maverick.ssh2.KBIAuthentication
keyboard-interactive authentication implementation as specified in draft-ietf-secsh-auth-kbdinteract-04.txt. Keyboard interactive provides a challenge-response type authentication which allows clients to support authentication mechanisms where the actual specification is not known.
The process works by the client first requesting the keyboard-interactive method; the server then responds with any number of prompts to which the user must provide an answer. This is acheived through the use of the KBIRequestHandler interface.
KBIAuthentication kbi = new KBIAuthentication(); kbi.setKBIRequestHandler(new KBIRequestHandler() { public void showPrompts(String name, String instruction, KBIPrompt[] prompts) { try { System.out.println(name); System.out.println(instruction); for(int i=0;i<prompts.length;i++) { System.out.print(prompts[i].getPrompt()); prompts[i].setResponse(reader.readLine()); } } catch (IOException e) { e.printStackTrace(); } } }); ssh.authenticate(kbi);
Special care should be taken to check the echo flag of the KBIPrompt if set to false the user reponse entered by the user should not be echo'd back to the screen, for example in the process of entering a password.
Field Summary |
Fields inherited from interface com.maverick.ssh.SshAuthentication |
CANCELLED, COMPLETE, FAILED, FURTHER_AUTHENTICATION_REQUIRED, PUBLIC_KEY_ACCEPTABLE |
Constructor Summary | |
KBIAuthentication()
|
Method Summary | |
void |
authenticate(AuthenticationProtocol authentication,
java.lang.String servicename)
Perform the authentication according to the specification. |
java.lang.String |
getMethod()
The SSH authentication method name |
java.lang.String |
getMethodName()
|
java.lang.String |
getUsername()
Get the username for this authentication attempt. |
void |
setKBIRequestHandler(KBIRequestHandler handler)
Set the KBIRequestHandler for this authentication attempt. |
void |
setUsername(java.lang.String username)
Set the username for this authentication attempt. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public KBIAuthentication()
Method Detail |
public java.lang.String getUsername()
SshAuthentication
getUsername
in interface SshAuthentication
public void setUsername(java.lang.String username)
SshAuthentication
setUsername
in interface SshAuthentication
username
- public java.lang.String getMethod()
SshAuthentication
getMethod
in interface SshAuthentication
public void setKBIRequestHandler(KBIRequestHandler handler)
handler
- public void authenticate(AuthenticationProtocol authentication, java.lang.String servicename) throws SshException, com.maverick.ssh2.AuthenticationResult
AuthenticationClient
authenticate
in interface AuthenticationClient
authentication
- servicename
-
SshException
com.maverick.ssh2.AuthenticationResult
public java.lang.String getMethodName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |