Class KeyMaterialFactory
java.lang.Object
org.jenkinsci.plugins.docker.commons.credentials.KeyMaterialFactory
- Direct Known Subclasses:
CompositeKeyMaterialFactory
,NullKeyMaterialFactory
,RegistryKeyMaterialFactory
,ServerHostKeyMaterialFactory
,ServerKeyMaterialFactory
Represents a locally extracted credentials information.
Whenever you want to fork off docker directly or indirectly, use this object to set up environment variables so that docker will talk to the right daemon.
- Author:
- Kohsuke Kawaguchi
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
contextualize
(KeyMaterialContext context) Sets theKeyMaterialContext
within which thisKeyMaterialFactory
canmaterialize()
KeyMaterial
instances.protected final FilePath
Creates a read-protected directory insideKeyMaterialContext.getBaseDir()
suitable for storing secret files.protected KeyMaterialContext
abstract KeyMaterial
Builds the key material environment variables needed to be passed when docker runs, to accessDockerServerCredentials
that this object was created from.plus
(KeyMaterialFactory... factories) Merge additionalKeyMaterialFactory
s into one.
-
Field Details
-
NULL
-
-
Constructor Details
-
KeyMaterialFactory
public KeyMaterialFactory()
-
-
Method Details
-
checkContextualized
protected void checkContextualized() -
contextualize
Sets theKeyMaterialContext
within which thisKeyMaterialFactory
canmaterialize()
KeyMaterial
instances. Can only be called once.- Parameters:
context
- theKeyMaterialContext
.- Returns:
- must return
this
(which is only returned to simplify use via method chaining)
-
getContext
-
materialize
Builds the key material environment variables needed to be passed when docker runs, to accessDockerServerCredentials
that this object was created from.When you are done using the credentials, call
KeyMaterial.close()
to allow sensitive information to be removed from the disk.- Throws:
IOException
InterruptedException
-
createSecretsDirectory
Creates a read-protected directory insideKeyMaterialContext.getBaseDir()
suitable for storing secret files. Be sure toFilePath.deleteRecursive()
this inKeyMaterial.close()
.- Throws:
IOException
InterruptedException
-
plus
Merge additionalKeyMaterialFactory
s into one.
-