Class KubernetesServiceAccountTokenFile
java.lang.Object
org.springframework.vault.authentication.ResourceCredentialSupplier
org.springframework.vault.authentication.KubernetesServiceAccountTokenFile
- All Implemented Interfaces:
Supplier<String>, CredentialSupplier, KubernetesJwtSupplier
public class KubernetesServiceAccountTokenFile
extends ResourceCredentialSupplier
implements KubernetesJwtSupplier
Mechanism to retrieve a Kubernetes service account token.
A file containing a token for a pod's service account is automatically mounted at
/var/run/secrets/kubernetes.io/serviceaccount/token.
- Since:
- 2.0
- Author:
- Michal Budzyn, Mark Paluch
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDefault path to the service account token file. -
Constructor Summary
ConstructorsConstructorDescriptionCreate a newKubernetesServiceAccountTokenFilepointing to theDEFAULT_KUBERNETES_SERVICE_ACCOUNT_TOKEN_FILE.Create a newKubernetesServiceAccountTokenFileKubernetesServiceAccountTokenFilefrom aFilehandle.KubernetesServiceAccountTokenFile(Resource resource) Create a newKubernetesServiceAccountTokenFileKubernetesServiceAccountTokenFilefrom aResourcehandle. -
Method Summary
Methods inherited from class ResourceCredentialSupplier
getMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface CredentialSupplier
cached, get
-
Field Details
-
DEFAULT_KUBERNETES_SERVICE_ACCOUNT_TOKEN_FILE
Default path to the service account token file.- See Also:
-
-
Constructor Details
-
KubernetesServiceAccountTokenFile
public KubernetesServiceAccountTokenFile()Create a newKubernetesServiceAccountTokenFilepointing to theDEFAULT_KUBERNETES_SERVICE_ACCOUNT_TOKEN_FILE. Construction fails with an exception if the file does not exist.- Throws:
IllegalArgumentException- if theDEFAULT_KUBERNETES_SERVICE_ACCOUNT_TOKEN_FILEdoes not exist.
-
KubernetesServiceAccountTokenFile
- Parameters:
path- path to the service account token file.- Throws:
IllegalArgumentException- if thepathdoes not exist.
-
KubernetesServiceAccountTokenFile
Create a newKubernetesServiceAccountTokenFileKubernetesServiceAccountTokenFilefrom aFilehandle.- Parameters:
file- path to the service account token file.- Throws:
IllegalArgumentException- if thepathdoes not exist.
-
KubernetesServiceAccountTokenFile
Create a newKubernetesServiceAccountTokenFileKubernetesServiceAccountTokenFilefrom aResourcehandle.- Parameters:
resource- resource pointing to the service account token file.- Throws:
IllegalArgumentException- if thepathdoes not exist.
-