public class CredentialsManagerImpl extends Object implements CredentialsManager
CredentialsAccessor.IsCredentialsOfType
Constructor and Description |
---|
CredentialsManagerImpl(AuditLogService auditLogService,
CredentialsDao credentialsDao,
FeatureManager featureManager,
com.atlassian.event.api.EventPublisher eventPublisher,
com.atlassian.plugin.PluginAccessor pluginAccessor,
com.opensymphony.xwork2.TextProvider textProvider) |
Modifier and Type | Method and Description |
---|---|
@NotNull Long |
countAllGlobalCredentials()
Count all global credentials.
|
@NotNull Long |
countAllProjectsCredentials()
Count all project credentials.
|
@NotNull CredentialsData |
createCredentials(@NotNull CredentialTypeModuleDescriptor credentialDescriptor,
@NotNull String credentialsName,
@NotNull Map<String,String> credentialsConfig)
Creates Credentials from the configuration map and stores them in the database.
|
@NotNull CredentialsData |
createOrUpdateCredentials(@NotNull CredentialsData credentials)
Creates credentials based on the object representation.
|
@NotNull CredentialsData |
createProjectCredentials(@NotNull CredentialTypeModuleDescriptor credentialDescriptor,
@NotNull String credentialsName,
@NotNull Map<String,String> credentialsConfig,
@NotNull Long projectId)
Creates Credentials from the configuration map and stores them in the database.
|
void |
deleteCredentials(long id)
Deletes credentials based on Id
|
@NotNull CredentialsData |
editCredentials(long credentialsId,
@NotNull String credentialsName,
@NotNull Map<String,String> credentialsConfig)
Updates Credentials with values in the configuration map.
|
@NotNull CredentialsData |
editProjectCredentials(long credentialsId,
@NotNull String credentialsName,
@NotNull Map<String,String> credentialsConfig,
long projectId)
Updates Credentials with values in the configuration map.
|
@NotNull List<Long> |
findAllProjectsIdsUsingProjectSharedCredentials() |
@NotNull Iterable<CredentialsData> |
getAllCredentials() |
@NotNull Iterable<CredentialsData> |
getAllCredentials(@NotNull String pluginKey) |
@NotNull Iterable<CredentialsData> |
getAllCredentialsByPluginKey(@NotNull String pluginKey) |
CredentialsData |
getCredentials(long id)
Gets the Shared Credentials by id
|
CredentialsData |
getCredentialsByName(String name)
Find global shared credentials by name
|
CredentialsData |
getCredentialsByNameAndProjectId(String name,
long projectId)
Find shared credentials by name and project id
|
CredentialsData |
getCredentialsByOid(BambooEntityOid oid)
Find shared credentials by
BambooEntityOid |
@Nullable CredentialTypeModuleDescriptor |
getCredentialTypeDescriptor(@Nullable String pluginKey) |
@NotNull List<CredentialTypeModuleDescriptor> |
getCredentialTypeDescriptors() |
@NotNull Iterable<CredentialsData> |
getGlobalCredentials() |
@NotNull Iterable<CredentialsData> |
getGlobalCredentials(@NotNull String pluginKey) |
@NotNull PaginatedProjectSharedCredentials |
getPaginatedSharedCredentials(@Nullable Long projectId,
int start,
int limit,
@Nullable String filter)
Get paginated shared credentials for a project.
|
@NotNull Iterable<CredentialsData> |
getProjectCredentials(@NotNull Long projectId) |
@Nullable CredentialsData |
getProjectCredentials(long id,
long projectId)
Gets the Shared Credentials by id and projectId
|
@NotNull Iterable<CredentialsData> |
getProjectCredentialsByPluginKey(@NotNull Long projectId,
String pluginKey) |
boolean |
hasAnyCredentials(@NotNull String pluginKey) |
@NotNull CredentialsData |
mergeImportedEntity(@NotNull CredentialsData importedEntity)
Merges the state of the given imported entity into the database.
|
@NotNull CredentialTypeExporter |
retrieveCredentialTypeExporter(@Nullable String pluginKey)
Find credential type exporter for given plugin key.
|
@NotNull CredentialsData |
updateCredentialsName(long id,
@NotNull String name)
Updates shared credentials name
|
void |
validate(@NotNull CredentialsData importedEntity)
Validate entity before saving it in database.
|
@Inject public CredentialsManagerImpl(AuditLogService auditLogService, CredentialsDao credentialsDao, FeatureManager featureManager, com.atlassian.event.api.EventPublisher eventPublisher, com.atlassian.plugin.PluginAccessor pluginAccessor, com.opensymphony.xwork2.TextProvider textProvider)
@NotNull public @NotNull List<CredentialTypeModuleDescriptor> getCredentialTypeDescriptors()
getCredentialTypeDescriptors
in interface CredentialsManager
@Nullable public @Nullable CredentialTypeModuleDescriptor getCredentialTypeDescriptor(@Nullable @Nullable String pluginKey)
getCredentialTypeDescriptor
in interface CredentialsManager
@NotNull public @NotNull CredentialsData updateCredentialsName(long id, @NotNull @NotNull String name) throws WebValidationException
CredentialsManager
updateCredentialsName
in interface CredentialsManager
id
- The id of the object to updatename
- The new name to identify the credentialsWebValidationException
@NotNull public @NotNull CredentialsData createOrUpdateCredentials(@NotNull @NotNull CredentialsData credentials)
CredentialsManager
This method encrypts the values of the credentials, for example for ssh encrypts the ssh key and ssh passphrase.
createOrUpdateCredentials
in interface CredentialsManager
credentials
- The object representation with the data to save.@NotNull public @NotNull CredentialsData createCredentials(@NotNull @NotNull CredentialTypeModuleDescriptor credentialDescriptor, @NotNull @NotNull String credentialsName, @NotNull @NotNull Map<String,String> credentialsConfig)
CredentialsManager
This method encrypts the values of the credentials, for example for ssh encrypts the ssh key and ssh passphrase.
createCredentials
in interface CredentialsManager
credentialDescriptor
- The plugin module descriptor for the credential type being created.credentialsName
- The name for the credentials.credentialsConfig
- The configuration map containing the credential values as defined by the plugin for
this credential type.@NotNull public @NotNull CredentialsData createProjectCredentials(@NotNull @NotNull CredentialTypeModuleDescriptor credentialDescriptor, @NotNull @NotNull String credentialsName, @NotNull @NotNull Map<String,String> credentialsConfig, @NotNull @NotNull Long projectId)
CredentialsManager
This method encrypts the values of the credentials, for example for ssh encrypts the ssh key and ssh passphrase.
createProjectCredentials
in interface CredentialsManager
credentialDescriptor
- The plugin module descriptor for the credential type being created.credentialsName
- The name for the credentials.credentialsConfig
- The configuration map containing the credential values as defined by the plugin for
this credential type.projectId
- Project id@NotNull public @NotNull CredentialsData editCredentials(long credentialsId, @NotNull @NotNull String credentialsName, @NotNull @NotNull Map<String,String> credentialsConfig)
CredentialsManager
This method encrypts the values of the credentials, for example for ssh encrypts the ssh key and ssh passphrase.
editCredentials
in interface CredentialsManager
credentialsId
- The ID of the credentials to update.credentialsName
- The name for the credentials.credentialsConfig
- The configuration map containing the credential values as defined by the plugin for this
credential type.@NotNull public @NotNull CredentialsData editProjectCredentials(long credentialsId, @NotNull @NotNull String credentialsName, @NotNull @NotNull Map<String,String> credentialsConfig, long projectId)
CredentialsManager
This method encrypts the values of the credentials, for example for ssh encrypts the ssh key and ssh passphrase.
editProjectCredentials
in interface CredentialsManager
credentialsId
- The ID of the credentials to update.credentialsName
- The name for the credentials.credentialsConfig
- The configuration map containing the credential values as defined by the plugin for this
credential type.projectId
- The ID of the Projectpublic CredentialsData getCredentials(long id)
CredentialsAccessor
getCredentials
in interface CredentialsAccessor
public CredentialsData getCredentialsByOid(BambooEntityOid oid)
CredentialsAccessor
BambooEntityOid
getCredentialsByOid
in interface CredentialsAccessor
public CredentialsData getCredentialsByName(String name)
CredentialsAccessor
getCredentialsByName
in interface CredentialsAccessor
public CredentialsData getCredentialsByNameAndProjectId(String name, long projectId)
CredentialsAccessor
getCredentialsByNameAndProjectId
in interface CredentialsAccessor
@NotNull public @NotNull Iterable<CredentialsData> getAllCredentials()
getAllCredentials
in interface CredentialsAccessor
@NotNull public @NotNull Iterable<CredentialsData> getGlobalCredentials()
getGlobalCredentials
in interface CredentialsAccessor
@NotNull public @NotNull Long countAllGlobalCredentials()
CredentialsManager
countAllGlobalCredentials
in interface CredentialsManager
@NotNull public @NotNull Long countAllProjectsCredentials()
CredentialsManager
countAllProjectsCredentials
in interface CredentialsManager
@NotNull public @NotNull List<Long> findAllProjectsIdsUsingProjectSharedCredentials()
findAllProjectsIdsUsingProjectSharedCredentials
in interface CredentialsManager
@NotNull public @NotNull Iterable<CredentialsData> getAllCredentials(@NotNull @NotNull String pluginKey)
getAllCredentials
in interface CredentialsAccessor
@NotNull public @NotNull Iterable<CredentialsData> getGlobalCredentials(@NotNull @NotNull String pluginKey)
getGlobalCredentials
in interface CredentialsAccessor
@NotNull public @NotNull Iterable<CredentialsData> getAllCredentialsByPluginKey(@NotNull @NotNull String pluginKey)
getAllCredentialsByPluginKey
in interface CredentialsAccessor
@NotNull public @NotNull PaginatedProjectSharedCredentials getPaginatedSharedCredentials(@Nullable @Nullable Long projectId, int start, int limit, @Nullable @Nullable String filter)
CredentialsManager
getPaginatedSharedCredentials
in interface CredentialsManager
projectId
- of the project to get shared credentials forstart
- start by indexlimit
- return no more entries than limitfilter
- filterpublic boolean hasAnyCredentials(@NotNull @NotNull String pluginKey)
hasAnyCredentials
in interface CredentialsAccessor
public void deleteCredentials(long id)
CredentialsManager
deleteCredentials
in interface CredentialsManager
id
- id of the object to deletepublic void validate(@NotNull @NotNull CredentialsData importedEntity) throws com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
CredentialsManager
validate
in interface CredentialsManager
importedEntity
- imported entitycom.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
@NotNull public @NotNull CredentialTypeExporter retrieveCredentialTypeExporter(@Nullable @Nullable String pluginKey)
CredentialsManager
retrieveCredentialTypeExporter
in interface CredentialsManager
@NotNull public @NotNull CredentialsData mergeImportedEntity(@NotNull @NotNull CredentialsData importedEntity)
CredentialsManager
This service will attempt to merge the entity based on ImmutableEntityWithOid.getOid()
, and if there's no
match, based on CredentialsData.getName()
. If an existing entity is found, then it will be updated.
Otherwise, a new database entity will be created.
It's assumed that this method is used in specs import only as it's sending analytic event.
mergeImportedEntity
in interface CredentialsManager
importedEntity
- imported entity@NotNull public @NotNull Iterable<CredentialsData> getProjectCredentials(@NotNull @NotNull Long projectId)
getProjectCredentials
in interface CredentialsAccessor
@NotNull public @NotNull Iterable<CredentialsData> getProjectCredentialsByPluginKey(@NotNull @NotNull Long projectId, String pluginKey)
getProjectCredentialsByPluginKey
in interface CredentialsAccessor
@Nullable public @Nullable CredentialsData getProjectCredentials(long id, long projectId)
CredentialsAccessor
getProjectCredentials
in interface CredentialsAccessor
Copyright © 2022 Atlassian Software Systems Pty Ltd. All rights reserved.