Class TruncatingPrefixCredentialsStorageEx
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.projects.TruncatingPrefixCredentialsStorageEx
-
- All Implemented Interfaces:
CredentialsStorage
,CredentialsStorageEx
,ServerExtension
,TeamCityExtension
public class TruncatingPrefixCredentialsStorageEx extends Object implements CredentialsStorageEx
-
-
Constructor Summary
Constructors Constructor Description TruncatingPrefixCredentialsStorageEx(CredentialsStorageEx credentialsStorage)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
copySecureValuesForTokens(Map<String,SProject> tokenProjects, SProject contextProject)
Copy tokens to contextProject from tokenProjects.void
deleteTokensFromProject(List<String> tokens, SProject contextProject)
Delete tokens from context project Requires explicit persist action after, see CredentialsStorageEx#schedulePersistingCredentialsMap<String,Map<String,String>>
findSecureValuesForTokens(Set<String> tokens, List<SProject> contextProjects)
Find all secure values for tokens in contextProjects For each token, different secure values can be found in different projectsString
findTokenForSecureValue(String secureValue, SProject contextProject)
Finds already existing token for the secure valueMap<String,String>
getStoredValues(SProject contextProject)
Return all stored secure values for [contextProject]String
getType()
String
mapSecureValueToToken(String secureValue, SProject contextProject)
Maps some secure value (password or api token) to some other token which can be safely stored in configuration files.String
mapTokenToSecureValue(String token, SProject contextProject)
Maps token to secure value if there is such a value in this credentials storage.PersistTask
schedulePersistingCredentials(SProject project)
Schedules persisting of all tokens related to [project] to persistent storage.void
setSecureValuesForTokens(Map<String,String> tokens, SProject contextProject)
Save tokens and their secure values to credentials storage if no mapping for token exists
-
-
-
Constructor Detail
-
TruncatingPrefixCredentialsStorageEx
public TruncatingPrefixCredentialsStorageEx(@NotNull CredentialsStorageEx credentialsStorage)
-
-
Method Detail
-
getType
@NotNull public String getType()
- Specified by:
getType
in interfaceCredentialsStorage
- Returns:
- type of this credentials storage. This type will be added by core API as a prefix to all tokens generated by this storage.
-
mapSecureValueToToken
@NotNull public String mapSecureValueToToken(@NotNull String secureValue, @NotNull SProject contextProject)
Description copied from interface:CredentialsStorage
Maps some secure value (password or api token) to some other token which can be safely stored in configuration files.- Specified by:
mapSecureValueToToken
in interfaceCredentialsStorage
- Parameters:
secureValue
- secure valuecontextProject
- context project where such mapping is performed- Returns:
- new or existing token corresponding to provided secure value
-
mapTokenToSecureValue
@Nullable public String mapTokenToSecureValue(@NotNull String token, @NotNull SProject contextProject)
Description copied from interface:CredentialsStorage
Maps token to secure value if there is such a value in this credentials storage.- Specified by:
mapTokenToSecureValue
in interfaceCredentialsStorage
- Parameters:
token
- tokencontextProject
- context project where such mapping is performed- Returns:
- secure value corresponding to token pr null if there is no such value
-
setSecureValuesForTokens
public void setSecureValuesForTokens(@NotNull Map<String,String> tokens, @NotNull SProject contextProject)
Description copied from interface:CredentialsStorageEx
Save tokens and their secure values to credentials storage if no mapping for token exists- Specified by:
setSecureValuesForTokens
in interfaceCredentialsStorageEx
- Parameters:
tokens
- map from token to secure value that should be storedcontextProject
- project being edited
-
findSecureValuesForTokens
@NotNull public Map<String,Map<String,String>> findSecureValuesForTokens(@NotNull Set<String> tokens, @NotNull List<SProject> contextProjects)
Description copied from interface:CredentialsStorageEx
Find all secure values for tokens in contextProjects For each token, different secure values can be found in different projects- Specified by:
findSecureValuesForTokens
in interfaceCredentialsStorageEx
- Parameters:
tokens
- list of tokens to find secure values forcontextProjects
- list of projects to search secure values in- Returns:
- map from token to map from project external id to secure value
-
copySecureValuesForTokens
public void copySecureValuesForTokens(@NotNull Map<String,SProject> tokenProjects, @NotNull SProject contextProject)
Description copied from interface:CredentialsStorageEx
Copy tokens to contextProject from tokenProjects.- Specified by:
copySecureValuesForTokens
in interfaceCredentialsStorageEx
- Parameters:
tokenProjects
- map from token to project. All tokens from this map will be copied to contextProjectcontextProject
- project to copy tokens to
-
getStoredValues
@NotNull public Map<String,String> getStoredValues(@NotNull SProject contextProject)
Description copied from interface:CredentialsStorageEx
Return all stored secure values for [contextProject]- Specified by:
getStoredValues
in interfaceCredentialsStorageEx
- Parameters:
contextProject
- context project to get all stored secure values for- Returns:
- map token -> secure value
-
schedulePersistingCredentials
@Nullable public PersistTask schedulePersistingCredentials(@NotNull SProject project)
Description copied from interface:CredentialsStorageEx
Schedules persisting of all tokens related to [project] to persistent storage. Returns task which can be used to wait for the persisting to complete. If returned task is null, then project did not have tokens.- Specified by:
schedulePersistingCredentials
in interfaceCredentialsStorageEx
-
deleteTokensFromProject
public void deleteTokensFromProject(@NotNull List<String> tokens, @NotNull SProject contextProject)
Description copied from interface:CredentialsStorageEx
Delete tokens from context project Requires explicit persist action after, see CredentialsStorageEx#schedulePersistingCredentials- Specified by:
deleteTokensFromProject
in interfaceCredentialsStorageEx
- Parameters:
tokens
- list of tokens to deletecontextProject
- project being edited
-
findTokenForSecureValue
@Nullable public String findTokenForSecureValue(@NotNull String secureValue, @NotNull SProject contextProject)
Description copied from interface:CredentialsStorage
Finds already existing token for the secure value- Specified by:
findTokenForSecureValue
in interfaceCredentialsStorage
- Parameters:
secureValue
- secure valuecontextProject
- context project where search is performed- Returns:
- existing token for the secure value or null if none found
-
-