@@ -35,17 +35,15 @@ public class HttpClient {
35
35
private static final LoggingFacade LOGGER = LoggingFactory .getLogger ("Operator" , "Operator" );
36
36
37
37
private Client httpClient ;
38
- private String principal ;
39
38
private String encodedCredentials ;
40
39
41
40
private static final String HTTP_PROTOCOL = "http://" ;
42
41
43
42
// for debugging
44
43
private static final String SERVICE_URL = System .getProperty ("oracle.kubernetes.operator.http.HttpClient.SERVICE_URL" );
45
44
46
- private HttpClient (Client httpClient , String principal , String encodedCredentials ) {
45
+ private HttpClient (Client httpClient , String encodedCredentials ) {
47
46
this .httpClient = httpClient ;
48
- this .principal = principal ;
49
47
this .encodedCredentials = encodedCredentials ;
50
48
}
51
49
@@ -144,14 +142,13 @@ public Result executePostUrlOnServiceClusterIP(String requestUrl, String service
144
142
145
143
/**
146
144
* Asynchronous {@link Step} for creating an authenticated HTTP client targeted at a server instance
147
- * @param principal Principal
148
145
* @param namespace Namespace
149
146
* @param adminSecretName Admin secret name
150
147
* @param next Next processing step
151
148
* @return step to create client
152
149
*/
153
- public static Step createAuthenticatedClientForServer (String principal , String namespace , String adminSecretName , Step next ) {
154
- return new AuthenticatedClientForServerStep (namespace , adminSecretName , new WithSecretDataStep (principal , next ));
150
+ public static Step createAuthenticatedClientForServer (String namespace , String adminSecretName , Step next ) {
151
+ return new AuthenticatedClientForServerStep (namespace , adminSecretName , new WithSecretDataStep (next ));
155
152
}
156
153
157
154
private static class AuthenticatedClientForServerStep extends Step {
@@ -172,11 +169,9 @@ public NextAction apply(Packet packet) {
172
169
}
173
170
174
171
private static class WithSecretDataStep extends Step {
175
- private final String principal ;
176
172
177
- public WithSecretDataStep (String principal , Step next ) {
173
+ public WithSecretDataStep (Step next ) {
178
174
super (next );
179
- this .principal = principal ;
180
175
}
181
176
182
177
@ Override
@@ -189,7 +184,7 @@ public NextAction apply(Packet packet) {
189
184
username = secretData .get (SecretHelper .ADMIN_SERVER_CREDENTIALS_USERNAME );
190
185
password = secretData .get (SecretHelper .ADMIN_SERVER_CREDENTIALS_PASSWORD );
191
186
}
192
- packet .put (KEY , createAuthenticatedClient (principal , username , password ));
187
+ packet .put (KEY , createAuthenticatedClient (username , password ));
193
188
194
189
Arrays .fill (username , (byte ) 0 );
195
190
Arrays .fill (password , (byte ) 0 );
@@ -199,12 +194,11 @@ public NextAction apply(Packet packet) {
199
194
200
195
/**
201
196
* Create authenticated client specifically targeted at an admin server
202
- * @param principal Principal
203
197
* @param namespace Namespace
204
198
* @param adminSecretName Admin secret name
205
199
* @return authenticated client
206
200
*/
207
- public static HttpClient createAuthenticatedClientForServer (String principal , String namespace , String adminSecretName ) {
201
+ public static HttpClient createAuthenticatedClientForServer (String namespace , String adminSecretName ) {
208
202
SecretHelper secretHelper = new SecretHelper (namespace );
209
203
Map <String , byte []> secretData =
210
204
secretHelper .getSecretData (SecretHelper .SecretType .AdminCredentials , adminSecretName );
@@ -215,18 +209,16 @@ public static HttpClient createAuthenticatedClientForServer(String principal, St
215
209
username = secretData .get (SecretHelper .ADMIN_SERVER_CREDENTIALS_USERNAME );
216
210
password = secretData .get (SecretHelper .ADMIN_SERVER_CREDENTIALS_PASSWORD );
217
211
}
218
- return createAuthenticatedClient (principal , username , password );
212
+ return createAuthenticatedClient (username , password );
219
213
}
220
214
221
215
/**
222
216
* Create authenticated HTTP client
223
- * @param principal Principal
224
217
* @param username Username
225
218
* @param password Password
226
219
* @return authenticated client
227
220
*/
228
- public static HttpClient createAuthenticatedClient (String principal ,
229
- final byte [] username ,
221
+ public static HttpClient createAuthenticatedClient (final byte [] username ,
230
222
final byte [] password ) {
231
223
// build client with authentication information.
232
224
Client client = ClientBuilder .newClient ();
@@ -238,18 +230,17 @@ public static HttpClient createAuthenticatedClient(String principal,
238
230
System .arraycopy (password , 0 , usernameAndPassword , username .length + 1 , password .length );
239
231
encodedCredentials = java .util .Base64 .getEncoder ().encodeToString (usernameAndPassword );
240
232
}
241
- return new HttpClient (client , principal , encodedCredentials );
233
+ return new HttpClient (client , encodedCredentials );
242
234
}
243
235
244
236
/**
245
237
* Returns the URL to access the service; using the service clusterIP and port.
246
238
*
247
- * @param principal The principal that will be used to call the Kubernetes API.
248
239
* @param name The name of the Service that you want the URL for.
249
240
* @param namespace The Namespace in which the Service you want the URL for is defined.
250
- * @return The URL of the Service, or null if it is not found or principal does not have sufficient permissions.
241
+ * @return The URL of the Service, or null if it is not found
251
242
*/
252
- public static String getServiceURL (String principal , String name , String namespace ) {
243
+ public static String getServiceURL (String name , String namespace ) {
253
244
try {
254
245
CallBuilderFactory factory = ContainerResolver .getInstance ().getContainer ().getSPI (CallBuilderFactory .class );
255
246
return getServiceURL (factory .create ().readService (name , namespace ));
0 commit comments