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
Modifier and TypeFieldDescriptionstatic final String
Default path to the service account token file. -
Constructor Summary
ConstructorDescriptionCreate a newKubernetesServiceAccountTokenFile
pointing to theDEFAULT_KUBERNETES_SERVICE_ACCOUNT_TOKEN_FILE
.Create a newKubernetesServiceAccountTokenFile
KubernetesServiceAccountTokenFile
from aFile
handle.KubernetesServiceAccountTokenFile
(Resource resource) Create a newKubernetesServiceAccountTokenFile
KubernetesServiceAccountTokenFile
from aResource
handle. -
Method Summary
Methods inherited from class org.springframework.vault.authentication.ResourceCredentialSupplier
get
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.vault.authentication.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 newKubernetesServiceAccountTokenFile
pointing 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_FILE
does not exist.
-
KubernetesServiceAccountTokenFile
- Parameters:
path
- path to the service account token file.- Throws:
IllegalArgumentException
- if thepath
does not exist.
-
KubernetesServiceAccountTokenFile
Create a newKubernetesServiceAccountTokenFile
KubernetesServiceAccountTokenFile
from aFile
handle.- Parameters:
file
- path to the service account token file.- Throws:
IllegalArgumentException
- if thepath
does not exist.
-
KubernetesServiceAccountTokenFile
Create a newKubernetesServiceAccountTokenFile
KubernetesServiceAccountTokenFile
from aResource
handle.- Parameters:
resource
- resource pointing to the service account token file.- Throws:
IllegalArgumentException
- if thepath
does not exist.
-