Package codes.grow.packages.vault
Class KubernetesAuth
java.lang.Object
codes.grow.packages.vault.KubernetesAuth
- All Implemented Interfaces:
AuthMethod
Kubernetes login:
POST auth/<mount>/login {role, jwt} with the service account token read
from jwtPath (default "/var/run/secrets/kubernetes.io/serviceaccount/token") at login time.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDefault service account token path inside a pod. -
Constructor Summary
ConstructorsConstructorDescriptionKubernetesAuth(String role) Creates the method on mountkuberneteswith the default token path.KubernetesAuth(String role, String jwtPath) Creates the method on mountkubernetes.KubernetesAuth(String role, Path jwtPath, String mount) Creates the method. -
Method Summary
Modifier and TypeMethodDescriptionjwtPath()Returns the service account token path.login(LoginContext context) Performs the login.method()Returns the method name, e.g.toString()static KubernetesAuthCreates the method with an explicit service account token instead of a file.
-
Field Details
-
DEFAULT_JWT_PATH
Default service account token path inside a pod.- See Also:
-
-
Constructor Details
-
KubernetesAuth
Creates the method on mountkuberneteswith the default token path.- Parameters:
role- role name
-
KubernetesAuth
Creates the method on mountkubernetes.- Parameters:
role- role namejwtPath- service account token file
-
KubernetesAuth
Creates the method.- Parameters:
role- role namejwtPath- service account token filemount- auth mount path
-
-
Method Details
-
withJwt
Creates the method with an explicit service account token instead of a file.- Parameters:
role- role namejwt- service account tokenmount- auth mount path- Returns:
- the method
- Throws:
ConfigException- when the JWT is empty
-
jwtPath
Returns the service account token path.- Returns:
- the path
-
method
Description copied from interface:AuthMethodReturns the method name, e.g.approle.- Specified by:
methodin interfaceAuthMethod- Returns:
- the name
-
login
Description copied from interface:AuthMethodPerforms the login.- Specified by:
loginin interfaceAuthMethod- Parameters:
context- login helpers of the client- Returns:
- a future with the auth info
-
toString
-