4 import dolda.dolcon.protocol.Response;
5 import dolda.dolcon.protocol.Command;
7 public abstract class InteractiveAuth implements Authenticator {
8 public String handles(List<String> name) {
9 if(name.contains("pam"))
14 public Command step(Response resp) throws AuthException, ProtocolException, InterruptedException {
15 if(resp.code == 301) {
16 return(new Command("pass", promptnoecho(resp.token(0, 0))));
17 } else if(resp.code == 302) {
18 return(new Command("pass", promptecho(resp.token(0, 0))));
19 } else if(resp.code == 303) {
20 info(resp.token(0, 0));
21 return(new Command("pass", ""));
22 } else if(resp.code == 304) {
23 error(resp.token(0, 0));
24 return(new Command("pass", ""));
26 throw(new ResponseException(resp, 0));
30 public abstract String promptecho(String msg) throws AuthException;
31 public abstract String promptnoecho(String msg) throws AuthException;
32 public abstract void info(String msg) throws AuthException;
33 public abstract void error(String msg) throws AuthException;