1 | |
package org.apache.maven.wagon.providers.ssh.jsch; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import com.jcraft.jsch.UserInfo; |
23 | |
import org.apache.maven.wagon.authentication.AuthenticationInfo; |
24 | |
import org.apache.maven.wagon.providers.ssh.interactive.InteractiveUserInfo; |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
class WagonUserInfo |
32 | |
implements UserInfo |
33 | |
{ |
34 | |
private final InteractiveUserInfo userInfo; |
35 | |
|
36 | |
private String password; |
37 | |
|
38 | |
private String passphrase; |
39 | |
|
40 | |
WagonUserInfo( AuthenticationInfo authInfo, InteractiveUserInfo userInfo ) |
41 | 0 | { |
42 | 0 | this.userInfo = userInfo; |
43 | |
|
44 | 0 | this.password = authInfo.getPassword(); |
45 | |
|
46 | 0 | this.passphrase = authInfo.getPassphrase(); |
47 | 0 | } |
48 | |
|
49 | |
public String getPassphrase() |
50 | |
{ |
51 | 0 | return passphrase; |
52 | |
} |
53 | |
|
54 | |
public String getPassword() |
55 | |
{ |
56 | 0 | return password; |
57 | |
} |
58 | |
|
59 | |
public boolean promptPassphrase( String message ) |
60 | |
{ |
61 | 0 | if ( passphrase == null && userInfo != null ) |
62 | |
{ |
63 | 0 | passphrase = userInfo.promptPassphrase( message ); |
64 | |
} |
65 | 0 | return passphrase != null; |
66 | |
} |
67 | |
|
68 | |
public boolean promptPassword( String message ) |
69 | |
{ |
70 | 0 | if ( password == null && userInfo != null ) |
71 | |
{ |
72 | 0 | password = userInfo.promptPassword( message ); |
73 | |
} |
74 | 0 | return password != null; |
75 | |
} |
76 | |
|
77 | |
public boolean promptYesNo( String message ) |
78 | |
{ |
79 | 0 | return userInfo != null && userInfo.promptYesNo( message ); |
80 | |
} |
81 | |
|
82 | |
public void showMessage( String message ) |
83 | |
{ |
84 | 0 | if ( userInfo != null ) |
85 | |
{ |
86 | 0 | userInfo.showMessage( message ); |
87 | |
} |
88 | 0 | } |
89 | |
} |