Package com.atlassian.bamboo.credentials
Class AbstractCredentialType
java.lang.Object
com.atlassian.bamboo.credentials.AbstractCredentialType
- All Implemented Interfaces:
CredentialType,InitablePluginModule<CredentialTypeModuleDescriptor>,BambooPluginModule
- Direct Known Subclasses:
SshCredentialType,UsernamePasswordCredentialType
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected org.apache.struts2.text.TextProvider -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongenerateCredentialsConfigMap(@NotNull Map<String, String> params) Convert the given map into a config map of the shared credential to be stored in the database.getCredentialsConfigurationMap(@NotNull CredentialsData credentialsData) Convert an existingCredentialsDatato a map.voidinit(@NotNull CredentialTypeModuleDescriptor moduleDescriptor) Initialises the Plugin with the plugin module descriptorvoidpopulateContextForCreate(@NotNull Map<String, Object> context) Provide any required context to be used when rendering the freemarker template for creating credentials.voidpopulateContextForEdit(@NotNull Map<String, Object> context, @NotNull CredentialsData previousCredentialsData) Provide any required context to be used when rendering the freemarker template for editing credentials.voidsetTextProvider(org.apache.struts2.text.TextProvider textProvider) voidvalidate(@NotNull ActionParametersMap params, @Nullable CredentialsData previousCredentialsData, @NotNull ErrorCollection errorCollection) Validate configuration.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.bamboo.credentials.CredentialType
generateCredentialsConfigMap
-
Field Details
-
CFG_CREDENTIALS_NAME
- See Also:
-
textProvider
protected org.apache.struts2.text.TextProvider textProvider
-
-
Constructor Details
-
AbstractCredentialType
public AbstractCredentialType()
-
-
Method Details
-
init
Description copied from interface:InitablePluginModuleInitialises the Plugin with the plugin module descriptor- Specified by:
initin interfaceInitablePluginModule<CredentialTypeModuleDescriptor>- Parameters:
moduleDescriptor- Plugin module descriptor
-
populateContextForCreate
Description copied from interface:CredentialTypeProvide any required context to be used when rendering the freemarker template for creating credentials. Allows you to add any default values for initial creation- Specified by:
populateContextForCreatein interfaceCredentialType- Parameters:
context- map to put your context in.
-
populateContextForEdit
public void populateContextForEdit(@NotNull @NotNull Map<String, Object> context, @NotNull @NotNull CredentialsData previousCredentialsData) Description copied from interface:CredentialTypeProvide any required context to be used when rendering the freemarker template for editing credentials.- Specified by:
populateContextForEditin interfaceCredentialType- Parameters:
context- map to put your context in.previousCredentialsData- existing credentials
-
validate
public void validate(@NotNull @NotNull ActionParametersMap params, @Nullable @Nullable CredentialsData previousCredentialsData, @NotNull @NotNull ErrorCollection errorCollection) Description copied from interface:CredentialTypeValidate configuration.- Specified by:
validatein interfaceCredentialType- Parameters:
params- configuration to be validatedpreviousCredentialsData- the previous immutableCredentialsDatabefore saving or null if credentials are being created.errorCollection- error collection to be set on validation failure
-
setTextProvider
public void setTextProvider(org.apache.struts2.text.TextProvider textProvider) -
getCredentialsConfigurationMap
@NotNull public @NotNull Map<String,String> getCredentialsConfigurationMap(@NotNull @NotNull CredentialsData credentialsData) Description copied from interface:CredentialTypeConvert an existingCredentialsDatato a map. So that configuration of the credential can used by other component, e.g. the rest plugin. Each implementation ofCredentialTypeshould populate different data to the map and encrypt them if necessary.- Specified by:
getCredentialsConfigurationMapin interfaceCredentialType- Parameters:
credentialsData- an existing credential- Returns:
- Map that stores the credential's configuration
-
generateCredentialsConfigMap
@NotNull public @NotNull Map<String,String> generateCredentialsConfigMap(@NotNull @NotNull Map<String, String> params) throws WebValidationExceptionDescription copied from interface:CredentialTypeConvert the given map into a config map of the shared credential to be stored in the database.Sensitive parameters such as passwords do not have to be encrypted, as they will be secured before being stored in the database.
- Specified by:
generateCredentialsConfigMapin interfaceCredentialType- Parameters:
params- original map to be converted- Returns:
- the configuration map to be stored in the database.
- Throws:
WebValidationException- if params contains invalid configuration
-