diff --git a/src/main/java/io/github/jopenlibs/vault/api/Auth.java b/src/main/java/io/github/jopenlibs/vault/api/Auth.java index d026a984..3179dbe0 100644 --- a/src/main/java/io/github/jopenlibs/vault/api/Auth.java +++ b/src/main/java/io/github/jopenlibs/vault/api/Auth.java @@ -1093,6 +1093,31 @@ public AuthResponse loginByKubernetes(final String role, final String jwt) return loginByJwt("kubernetes", role, jwt); } + /** + * Basic login operation to authenticate to a kubernetes backend with custom path. Example usage: + * + *
+ *
+ * {@code
+ * final AuthResponse response =
+ * vault.auth().loginByKubernetes("dev", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "customAuthPath");
+ *
+ * final String token = response.getAuthClientToken();
+ * }
+ *
+ *
+ * @param role The kubernetes role used for authentication
+ * @param jwt The JWT token for the role, typically read from
+ * /var/run/secrets/kubernetes.io/serviceaccount/token
+ * @param authPath The Authentication Path for Vault
+ * @return The auth token, with additional response metadata
+ * @throws VaultException If any error occurs, or unexpected response received from Vault
+ */
+ public AuthResponse loginByKubernetes(final String role, final String jwt, final String authPath)
+ throws VaultException {
+ return loginByJwt("kubernetes", role, jwt, authPath);
+ }
+
/**
* Basic login operation to authenticate using Vault's TLS Certificate auth backend. * Example usage: