You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If no auth provider config found or auth provider is not OIDC, the new Config should inherit the oauth token from the old Config, but with current logic, it'll always be empty.
if (newestConfig.getAuthProvider() != null && newestConfig.getAuthProvider().getName().equalsIgnoreCase("oidc")) {
newAccessToken = OpenIDConnectionUtils.resolveOIDCTokenFromAuthConfig(newestConfig.getAuthProvider().getConfig(),
factory.newBuilder());
} else {
**newAccessToken = CompletableFuture.completedFuture(newestConfig.getOauthToken());** // newAccessToken will always be empty.
}
Config config = new ConfigBuilder().withMasterUrl("https://k8s.url")
.withCaCertData("xxx...xxx")
.withOauthToken("valid-token")
.build();
KubernetesClient client = new KubernetesClientBuilder().withConfig(config).build();
client.apps().deployments().list().getItems().forEach(System.out::println); // works
Thread.sleep(2 * 60 * 1000);
client.apps().deployments().list().getItems().forEach(System.out::println); // will fail with 401 as TokenRefreshInterceptor will overwrite oauth token to empty string
Expected behavior
If no auth provider config found or auth provider is not OIDC, the new Config should inherit the oauth token from the old Config
Runtime
Kubernetes (vanilla)
Kubernetes API Server version
1.23
Environment
Azure
Fabric8 Kubernetes Client Logs
No response
Additional context
No response
The text was updated successfully, but these errors were encountered:
Describe the bug
If no auth provider config found or auth provider is not OIDC, the new Config should inherit the oauth token from the old Config, but with current logic, it'll always be empty.
code link:
kubernetes-client/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/TokenRefreshInterceptor.java
Lines 70 to 75 in 0bd34f8
Fabric8 Kubernetes Client version
6.1.1
Steps to reproduce
Config config = new ConfigBuilder().withMasterUrl("https://k8s.url")
.withCaCertData("xxx...xxx")
.withOauthToken("valid-token")
.build();
KubernetesClient client = new KubernetesClientBuilder().withConfig(config).build();
client.apps().deployments().list().getItems().forEach(System.out::println); // works
Thread.sleep(2 * 60 * 1000);
client.apps().deployments().list().getItems().forEach(System.out::println); // will fail with 401 as TokenRefreshInterceptor will overwrite oauth token to empty string
Expected behavior
If no auth provider config found or auth provider is not OIDC, the new Config should inherit the oauth token from the old Config
Runtime
Kubernetes (vanilla)
Kubernetes API Server version
1.23
Environment
Azure
Fabric8 Kubernetes Client Logs
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: