1
2
3
4
5
6
7
8
9
10 package org.eclipse.jgit.internal.transport.sshd.proxy;
11
12 import java.util.Collections;
13 import java.util.LinkedHashMap;
14 import java.util.Map;
15
16 import org.eclipse.jgit.annotations.NonNull;
17
18
19
20
21
22
23
24
25
26
27 public class AuthenticationChallenge {
28
29 private final String mechanism;
30
31 private String token;
32
33 private Map<String, String> arguments;
34
35
36
37
38
39
40
41 public AuthenticationChallenge(String mechanism) {
42 this.mechanism = mechanism;
43 }
44
45
46
47
48
49
50
51 public String getMechanism() {
52 return mechanism;
53 }
54
55
56
57
58
59
60 public String getToken() {
61 return token;
62 }
63
64
65
66
67
68
69 @NonNull
70 public Map<String, String> getArguments() {
71 return arguments == null ? Collections.emptyMap() : arguments;
72 }
73
74 void addArgument(String key, String value) {
75 if (arguments == null) {
76 arguments = new LinkedHashMap<>();
77 }
78 arguments.put(key, value);
79 }
80
81 void setToken(String token) {
82 this.token = token;
83 }
84
85 @Override
86 public String toString() {
87 return "AuthenticationChallenge[" + mechanism + ',' + token + ','
88 + (arguments == null ? "<none>" : arguments.toString()) + ']';
89 }
90 }