@@ -41,7 +41,7 @@ public abstract class Authenticator {
41
41
protected Authenticator () { }
42
42
43
43
/**
44
- * Base class for return type from authenticate() method
44
+ * Base class for return type from {@link # authenticate(HttpExchange)} method.
45
45
*/
46
46
public abstract static class Result {
47
47
@@ -51,8 +51,6 @@ public abstract static class Result {
51
51
protected Result () {}
52
52
}
53
53
54
-
55
-
56
54
/**
57
55
* Indicates an authentication failure. The authentication
58
56
* attempt has completed.
@@ -64,17 +62,17 @@ public static class Failure extends Result {
64
62
/**
65
63
* Creates a {@code Failure} instance with given response code.
66
64
*
67
- * @param responseCode The response code to associate with this
65
+ * @param responseCode the response code to associate with this
68
66
* {@code Failure} instance
69
67
*/
70
68
public Failure (int responseCode ) {
71
69
this .responseCode = responseCode ;
72
70
}
73
71
74
72
/**
75
- * returns the response code to send to the client
73
+ * Returns the response code to send to the client.
76
74
*
77
- * @return The response code associated with this {@code Failure} instance
75
+ * @return the response code associated with this {@code Failure} instance
78
76
*/
79
77
public int getResponseCode () {
80
78
return responseCode ;
@@ -83,24 +81,25 @@ public int getResponseCode() {
83
81
84
82
/**
85
83
* Indicates an authentication has succeeded and the
86
- * authenticated user principal can be acquired by calling
87
- * getPrincipal().
84
+ * authenticated user {@linkplain HttpPrincipal principal} can be acquired by calling
85
+ * {@link # getPrincipal()} .
88
86
*/
89
87
public static class Success extends Result {
90
88
private HttpPrincipal principal ;
91
89
92
90
/**
93
91
* Creates a {@code Success} instance with given {@code Principal}.
94
92
*
95
- * @param p The authenticated user you wish to set as Principal
93
+ * @param p the authenticated user you wish to set as {@code Principal}
96
94
*/
97
95
public Success (HttpPrincipal p ) {
98
96
principal = p ;
99
97
}
98
+
100
99
/**
101
- * returns the authenticated user Principal
100
+ * Returns the authenticated user {@code Principal}.
102
101
*
103
- * @return The {@code Principal} instance associated with the authenticated user
102
+ * @return the {@code Principal} instance associated with the authenticated user
104
103
*
105
104
*/
106
105
public HttpPrincipal getPrincipal () {
@@ -111,9 +110,9 @@ public HttpPrincipal getPrincipal() {
111
110
/**
112
111
* Indicates an authentication must be retried. The
113
112
* response code to be sent back is as returned from
114
- * getResponseCode(). The Authenticator must also have
115
- * set any necessary response headers in the given HttpExchange
116
- * before returning this Retry object.
113
+ * {@link # getResponseCode()} . The {@code Authenticator} must also have
114
+ * set any necessary response headers in the given {@link HttpExchange}
115
+ * before returning this {@code Retry} object.
117
116
*/
118
117
public static class Retry extends Result {
119
118
@@ -122,41 +121,40 @@ public static class Retry extends Result {
122
121
/**
123
122
* Creates a {@code Retry} instance with given response code.
124
123
*
125
- * @param responseCode The response code to associate with this
124
+ * @param responseCode the response code to associate with this
126
125
* {@code Retry} instance
127
126
*/
128
127
public Retry (int responseCode ) {
129
128
this .responseCode = responseCode ;
130
129
}
131
130
132
131
/**
133
- * returns the response code to send to the client
132
+ * Returns the response code to send to the client.
134
133
*
135
- * @return The response code associated with this {@code Retry} instance
134
+ * @return the response code associated with this {@code Retry} instance
136
135
*/
137
136
public int getResponseCode () {
138
137
return responseCode ;
139
138
}
140
139
}
141
140
142
141
/**
143
- * called to authenticate each incoming request. The implementation
144
- * must return a Failure, Success or Retry object as appropriate :-
145
- * <p>
146
- * Failure means the authentication has completed, but has failed
147
- * due to invalid credentials.
148
- * <p>
149
- * Sucess means that the authentication
150
- * has succeeded, and a Principal object representing the user
151
- * can be retrieved by calling Sucess.getPrincipal() .
152
- * <p>
153
- * Retry means that another HTTP exchange is required. Any response
154
- * headers needing to be sent back to the client are set in the
155
- * given HttpExchange. The response code to be returned must be provided
156
- * in the Retry object. Retry may occur multiple times.
142
+ * Called to authenticate each incoming request. The implementation
143
+ * must return a {@link Failure}, {@link Success} or {@link Retry} object as appropriate:
144
+ * <ul>
145
+ * <li> {@code Failure} means the authentication has completed, but has
146
+ * failed due to invalid credentials.
147
+ * <li> {@code Success} means that the authentication has succeeded,
148
+ * and a {@code Principal} object representing the user can be retrieved
149
+ * by calling {@link Success#getPrincipal()}.
150
+ * <li> {@code Retry} means that another HTTP {@linkplain HttpExchange exchange}
151
+ * is required. Any response headers needing to be sent back to the client are set
152
+ * in the given {@code HttpExchange}. The response code to be returned must be
153
+ * provided in the {@code Retry} object. {@code Retry} may occur multiple times.
154
+ * <ul/>
157
155
*
158
- * @param exch The HttpExchange upon which authenticate is called
159
- * @return The result
156
+ * @param exch the {@code HttpExchange} upon which authenticate is called
157
+ * @return the result
160
158
*/
161
159
public abstract Result authenticate (HttpExchange exch );
162
160
}
0 commit comments