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
public abstract class AbstractCredentialType extends Object implements CredentialType
-
-
Field Summary
Fields Modifier and Type Field Description static String
CFG_CREDENTIALS_NAME
protected com.opensymphony.xwork2.TextProvider
textProvider
-
Constructor Summary
Constructors Constructor Description AbstractCredentialType()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull Map<String,String>
generateCredentialsConfigMap(@NotNull Map<String,String> params)
Convert the given map into a config map of the shared credential to be stored in the database.@NotNull Map<String,String>
getCredentialsConfigurationMap(@NotNull CredentialsData credentialsData)
Convert an existingCredentialsData
to a map.void
init(@NotNull CredentialTypeModuleDescriptor moduleDescriptor)
Initialises the Plugin with the plugin module descriptorvoid
populateContextForCreate(@NotNull Map<String,Object> context)
Provide any required context to be used when rendering the freemarker template for creating credentials.void
populateContextForEdit(@NotNull Map<String,Object> context, @NotNull CredentialsData previousCredentialsData)
Provide any required context to be used when rendering the freemarker template for editing credentials.void
setTextProvider(com.opensymphony.xwork2.TextProvider textProvider)
void
validate(@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, wait
-
Methods inherited from interface com.atlassian.bamboo.credentials.CredentialType
generateCredentialsConfigMap
-
-
-
-
Field Detail
-
CFG_CREDENTIALS_NAME
public static final String CFG_CREDENTIALS_NAME
- See Also:
- Constant Field Values
-
textProvider
protected com.opensymphony.xwork2.TextProvider textProvider
-
-
Method Detail
-
init
public void init(@NotNull @NotNull CredentialTypeModuleDescriptor moduleDescriptor)
Description copied from interface:InitablePluginModule
Initialises the Plugin with the plugin module descriptor- Specified by:
init
in interfaceInitablePluginModule<CredentialTypeModuleDescriptor>
- Parameters:
moduleDescriptor
- Plugin module descriptor
-
populateContextForCreate
public void populateContextForCreate(@NotNull @NotNull Map<String,Object> context)
Description copied from interface:CredentialType
Provide 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:
populateContextForCreate
in 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:CredentialType
Provide any required context to be used when rendering the freemarker template for editing credentials.- Specified by:
populateContextForEdit
in 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:CredentialType
Validate configuration.- Specified by:
validate
in interfaceCredentialType
- Parameters:
params
- configuration to be validatedpreviousCredentialsData
- the previous immutableCredentialsData
before saving or null if credentials are being created.errorCollection
- error collection to be set on validation failure
-
setTextProvider
public void setTextProvider(com.opensymphony.xwork2.TextProvider textProvider)
-
getCredentialsConfigurationMap
@NotNull public @NotNull Map<String,String> getCredentialsConfigurationMap(@NotNull @NotNull CredentialsData credentialsData)
Description copied from interface:CredentialType
Convert an existingCredentialsData
to a map. So that configuration of the credential can used by other component, e.g. the rest plugin. Each implementation ofCredentialType
should populate different data to the map and encrypt them if necessary.- Specified by:
getCredentialsConfigurationMap
in 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 WebValidationException
Description copied from interface:CredentialType
Convert 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:
generateCredentialsConfigMap
in 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
-
-