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
package net.conjur.api.authn;
/*
* K8S Authn provider
*
* This should be used with the cyberark/conjur-kubernetes-authenticator sidecar or init container
* The auth token will be published by the sidecar allowing the container app to bypass the authentication step.
*
*/
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
public class AuthnK8sClient implements AuthnProvider {
private Token token;
public AuthnK8sClient(Token token) {
this.token = token;
}
public AuthnK8sClient(Path tokenFilePath) throws IOException {
this.token = getTokenFromFile(tokenFilePath);
}
public Token authenticate() {
return token;
}
public Token authenticate(boolean useCachedToken) {
return this.authenticate();
}
private Token getTokenFromFile(Path tokenFilePath) throws IOException {
String jsonToken = new String(Files.readAllBytes(tokenFilePath));
Token token = Token.fromJson(jsonToken);
return token;
}
}
Ryan Smith @ USAA wrote the attached to retrieve the access token in OpenShift using the Java API. He wanted to contribute this and see it added to the client library. Can that happen?
The text was updated successfully, but these errors were encountered:
Please let me know when the Java API can be updated to support reading the access token directly. If not, we will need to create a custom overlay jar to add the needed support in our environment.
Thanks,
Ryan Smith
Ryan Smith | Software Development Lead | Information Security
Core Security Infrastructure, Enterprise Security Group, USAA
AuthnK8sClient.java
Ryan Smith @ USAA wrote the attached to retrieve the access token in OpenShift using the Java API. He wanted to contribute this and see it added to the client library. Can that happen?
The text was updated successfully, but these errors were encountered: