@@ -222,7 +222,8 @@ public String getAccessToken() {
222
222
}
223
223
}
224
224
}
225
- String tokenViaExecCredential = tokenViaExecCredential ((Map <String , Object >) currentUser .get ("exec" ));
225
+ String tokenViaExecCredential =
226
+ tokenViaExecCredential ((Map <String , Object >) currentUser .get ("exec" ));
226
227
if (tokenViaExecCredential != null ) {
227
228
return tokenViaExecCredential ;
228
229
}
@@ -243,14 +244,18 @@ public String getAccessToken() {
243
244
244
245
/**
245
246
* Attempt to create an access token by running a configured external program.
246
- * @see <a href="https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins">Authenticating » client-go credential plugins</a>
247
+ *
248
+ * @see <a
249
+ * href="https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins">
250
+ * Authenticating » client-go credential plugins</a>
247
251
*/
248
252
private String tokenViaExecCredential (Map <String , Object > execMap ) {
249
253
if (execMap == null ) {
250
254
return null ;
251
255
}
252
256
String apiVersion = (String ) execMap .get ("apiVersion" );
253
- if (!"client.authentication.k8s.io/v1beta1" .equals (apiVersion )) { // TODO or v1alpha1 is apparently identical and could be supported
257
+ if (!"client.authentication.k8s.io/v1beta1" .equals (apiVersion )) {
258
+ // TODO or v1alpha1 is apparently identical and could be supported
254
259
log .error ("Unrecognized user.exec.apiVersion: {}" , apiVersion );
255
260
return null ;
256
261
}
@@ -272,7 +277,7 @@ private String tokenViaExecCredential(Map<String, Object> execMap) {
272
277
Process proc = pb .start ();
273
278
JsonElement root ;
274
279
try (InputStream is = proc .getInputStream ();
275
- Reader r = new InputStreamReader (is , StandardCharsets .UTF_8 )) {
280
+ Reader r = new InputStreamReader (is , StandardCharsets .UTF_8 )) {
276
281
root = new JsonParser ().parse (r );
277
282
} catch (JsonParseException x ) {
278
283
log .error ("Failed to parse output of " + command , x );
@@ -287,7 +292,8 @@ private String tokenViaExecCredential(Map<String, Object> execMap) {
287
292
JsonObject status = root .getAsJsonObject ().get ("status" ).getAsJsonObject ();
288
293
JsonElement token = status .get ("token" );
289
294
if (token == null ) {
290
- // TODO handle clientCertificateData/clientKeyData (KubeconfigAuthentication is not yet set up for that to be dynamic)
295
+ // TODO handle clientCertificateData/clientKeyData
296
+ // (KubeconfigAuthentication is not yet set up for that to be dynamic)
291
297
log .warn ("No token produced by {}" , command );
292
298
return null ;
293
299
}
@@ -297,8 +303,10 @@ private String tokenViaExecCredential(Map<String, Object> execMap) {
297
303
return null ;
298
304
}
299
305
// TODO cache tokens between calls, up to .status.expirationTimestamp
300
- // TODO a 401 is supposed to force a refresh, but KubeconfigAuthentication hard-codes AccessTokenAuthentication which does not support that
301
- // and anyway ClientBuilder only calls Authenticator.provide once per ApiClient; we would need to do it on every request
306
+ // TODO a 401 is supposed to force a refresh,
307
+ // but KubeconfigAuthentication hardcodes AccessTokenAuthentication which does not support that
308
+ // and anyway ClientBuilder only calls Authenticator.provide once per ApiClient;
309
+ // we would need to do it on every request
302
310
}
303
311
304
312
public boolean verifySSL () {
0 commit comments