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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcontextualize(KeyMaterialContext context) Sets theKeyMaterialContextwithin which thisKeyMaterialFactorycanmaterialize()KeyMaterialinstances.protected final FilePathCreates a read-protected directory insideKeyMaterialContext.getBaseDir()suitable for storing secret files.protected final hudson.remoting.VirtualChannelprotected KeyMaterialContextDeprecated.Builds the key material environment variables needed to be passed when docker runs, to accessDockerServerCredentialsthat this object was created from.plus(KeyMaterialFactory... factories) Merge additionalKeyMaterialFactorys into one.
-
Field Details
-
NULL
-
-
Constructor Details
-
KeyMaterialFactory
public KeyMaterialFactory()
-
-
Method Details
-
checkContextualized
protected void checkContextualized() -
contextualize
Sets theKeyMaterialContextwithin which thisKeyMaterialFactorycanmaterialize()KeyMaterialinstances. Can only be called once.- Parameters:
context- theKeyMaterialContext.- Returns:
- must return
this(which is only returned to simplify use via method chaining)
-
getContext
-
getChannel
@NonNull protected final hudson.remoting.VirtualChannel getChannel() -
materialize
Deprecated.usematerialize2()- Throws:
IOExceptionInterruptedException
-
materialize2
Builds the key material environment variables needed to be passed when docker runs, to accessDockerServerCredentialsthat this object was created from.When you are done using the credentials, call
KeyMaterial2.close(hudson.remoting.VirtualChannel)to allow sensitive information to be removed from the disk.- Throws:
IOExceptionInterruptedException
-
createSecretsDirectory
Creates a read-protected directory insideKeyMaterialContext.getBaseDir()suitable for storing secret files. Be sure toFilePath.deleteRecursive()this inKeyMaterial.close().- Throws:
IOExceptionInterruptedException
-
plus
Merge additionalKeyMaterialFactorys into one.
-
materialize2()