Skip to content

Commit

Permalink
Add overloading method loginByKubernetes() with custom authPath (#29)
Browse files Browse the repository at this point in the history
Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg>
  • Loading branch information
dttung2905 authored Apr 16, 2023
1 parent f4c4da7 commit 72eba45
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/main/java/io/github/jopenlibs/vault/api/Auth.java
Original file line number Diff line number Diff line change
Expand Up @@ -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:
*
* <blockquote>
*
* <pre>{@code
* final AuthResponse response =
* vault.auth().loginByKubernetes("dev", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "customAuthPath");
*
* final String token = response.getAuthClientToken();
* }</pre>
* </blockquote>
*
* @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);
}

/**
* <p>Basic login operation to authenticate using Vault's TLS Certificate auth backend.
* Example usage:</p>
Expand Down

0 comments on commit 72eba45

Please sign in to comment.