-
Notifications
You must be signed in to change notification settings - Fork 225
Add kubernetes auth method #122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I have it compiling now. Both of the below commands now execute with out error.
Next step is to test it to see if if works. |
I have successfully tested the code, and it is working now. Ready for review. |
@steve-perkins this PR is now ready for review. Let me know if any changes are needed. |
Here is the example program I created for testing this. /*
*
* javac -cp ".:/home/sean/projects/vault-java-driver/build/libs/vault-java-driver-3.1.0.jar" HelloWorld.java
* java -cp ".:/home/sean/projects/vault-java-driver/build/libs/vault-java-driver-3.1.0.jar" HelloWorld
*
*/
import com.bettercloud.vault.*;
import java.nio.file.*;
public class HelloWorld {
public static void main(String[] args) throws Exception {
final VaultConfig config = new VaultConfig().address("http://192.168.1.193:8200").build();
final Vault vault = new Vault(config);
// read kube jwt from file
String jwt = new String(Files.readAllBytes(Paths.get("/var/run/secrets/kubernetes.io/serviceaccount/token")));
System.out.print(jwt);
// get vault token
String token = vault.auth().loginByKubernetes("demo", jwt, "foo").getAuthClientToken();
System.out.print(token);
}
} |
@seanmalloy seems #164 is the better approach? reusing what had JWT knowledge 😓 Duplicate of #164 |
Duplicate of #164 |
Thanks, @seanmalloy! We've had a number of PR's for this popular feature! It was ultimately merged as part of #164, and will go out to Maven Central in the next couple of days. |
This is a work in progress. I'm not really a Java programmer. I have not tested this code yet. I'll be testing this code in a next few days.
Any feedback on this pull request would be greatly appreciated.
https://www.vaultproject.io/docs/auth/kubernetes.html