1 | /******************************************************************************
|
---|
2 | *
|
---|
3 | * Copyright (c) 1998,99 by Mindbright Technology AB, Stockholm, Sweden.
|
---|
4 | * www.mindbright.se, [email protected]
|
---|
5 | *
|
---|
6 | * This program is free software; you can redistribute it and/or modify
|
---|
7 | * it under the terms of the GNU General Public License as published by
|
---|
8 | * the Free Software Foundation; either version 2 of the License, or
|
---|
9 | * (at your option) any later version.
|
---|
10 | *
|
---|
11 | * This program is distributed in the hope that it will be useful,
|
---|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
14 | * GNU General Public License for more details.
|
---|
15 | *
|
---|
16 | *****************************************************************************
|
---|
17 | * $Author: mats $
|
---|
18 | * $Date: 1999/08/22 13:57:54 $
|
---|
19 | * $Name: rel1-2-1 $
|
---|
20 | *****************************************************************************/
|
---|
21 | package mindbright.ssh;
|
---|
22 |
|
---|
23 | import java.net.*;
|
---|
24 | import java.io.*;
|
---|
25 |
|
---|
26 | import mindbright.security.RSAPublicKey;
|
---|
27 |
|
---|
28 | public class SSHPasswordAuthenticator implements SSHAuthenticator {
|
---|
29 | protected String username;
|
---|
30 | protected String password;
|
---|
31 | protected int cipher;
|
---|
32 |
|
---|
33 | public SSHPasswordAuthenticator(String username, String password, String cipher) {
|
---|
34 | this.username = username;
|
---|
35 | this.password = password;
|
---|
36 | this.cipher = SSH.getCipherType(cipher);
|
---|
37 | }
|
---|
38 |
|
---|
39 | public SSHPasswordAuthenticator(String username, String password) {
|
---|
40 | this.username = username;
|
---|
41 | this.password = password;
|
---|
42 | this.cipher = SSH.CIPHER_DEFAULT;
|
---|
43 | }
|
---|
44 |
|
---|
45 | public String getUsername(SSHClientUser origin) {
|
---|
46 | return username;
|
---|
47 | }
|
---|
48 |
|
---|
49 | public String getPassword(SSHClientUser origin) {
|
---|
50 | return password;
|
---|
51 | }
|
---|
52 |
|
---|
53 | public String getChallengeResponse(SSHClientUser origin, String challenge) {
|
---|
54 | return password;
|
---|
55 | }
|
---|
56 |
|
---|
57 | public int[] getAuthTypes(SSHClientUser origin) {
|
---|
58 | int[] types = new int[1];
|
---|
59 | types[0] = SSH.AUTH_PASSWORD;
|
---|
60 | return types;
|
---|
61 | }
|
---|
62 |
|
---|
63 | public int getCipher(SSHClientUser origin) {
|
---|
64 | return cipher;
|
---|
65 | }
|
---|
66 |
|
---|
67 | public String getIdentityPassword(SSHClientUser origin) {
|
---|
68 | return "";
|
---|
69 | }
|
---|
70 |
|
---|
71 | public SSHRSAKeyFile getIdentityFile(SSHClientUser origin) {
|
---|
72 | return null;
|
---|
73 | }
|
---|
74 |
|
---|
75 | public boolean verifyKnownHosts(RSAPublicKey hostPub) {
|
---|
76 | return true;
|
---|
77 | }
|
---|
78 |
|
---|
79 | }
|
---|
80 |
|
---|