Class SecureUserSSLTrustStoreManager
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.ssl.SecureUserSSLTrustStoreManager
-
- All Implemented Interfaces:
SSLTrustStoreManager
,SSLTrustStoreProvider
public class SecureUserSSLTrustStoreManager extends Object implements SSLTrustStoreManager, SSLTrustStoreProvider
Secure implementation forSSLTrustStoreManager
which protects trust store for not authorized modification.- Since:
- 2018.1.2
- Author:
- Mikhail Khorkov
-
-
Constructor Summary
Constructors Constructor Description SecureUserSSLTrustStoreManager(UserSSLTrustStoreManager delegate, SecurityContextEx securityContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PersistTask
deleteCertificate(String alias, SProject project, ConfigAction configAction)
Deletes certificate from the specified project.TeamCityTrustedSslCertificate[]
getCertificates(SProject project)
Return all stored certificates for concrete project.String
getCertificatesHash(SProject project)
Return a hash of stored certificates for concrete project.KeyStore
getTrustStore()
Returns key store with addition trusted certificates.PersistTask
storeNewCertificate(String alias, byte[] data, SProject project, ConfigAction configAction)
Store certificate to the specified project.
-
-
-
Constructor Detail
-
SecureUserSSLTrustStoreManager
public SecureUserSSLTrustStoreManager(@NotNull UserSSLTrustStoreManager delegate, @NotNull SecurityContextEx securityContext)
-
-
Method Detail
-
getCertificates
@NotNull public TeamCityTrustedSslCertificate[] getCertificates(@NotNull SProject project)
Description copied from interface:SSLTrustStoreManager
Return all stored certificates for concrete project.- Specified by:
getCertificates
in interfaceSSLTrustStoreManager
- Parameters:
project
- project where to search for certificates (for now only root project is accepted, attempt to set some other project will cause IllegalArgumentException)- Returns:
- array or certificates.
-
getCertificatesHash
@NotNull public String getCertificatesHash(@NotNull SProject project)
Description copied from interface:SSLTrustStoreManager
Return a hash of stored certificates for concrete project.- Specified by:
getCertificatesHash
in interfaceSSLTrustStoreManager
- Parameters:
project
- project where to search for certificates (for now only root project is accepted, attempt to set some other project will cause IllegalArgumentException)- Returns:
- hash of stored certificates or default "zero hash".
-
storeNewCertificate
@NotNull public PersistTask storeNewCertificate(@NotNull String alias, @NotNull byte[] data, @NotNull SProject project, @NotNull ConfigAction configAction) throws Exception
Description copied from interface:SSLTrustStoreManager
Store certificate to the specified project.- Specified by:
storeNewCertificate
in interfaceSSLTrustStoreManager
- Parameters:
alias
- name of certificatedata
- certificate dataproject
- project where to store the certificate (for now only root project is accepted, attempt to set some other project will cause IllegalArgumentException)configAction
- description of the action- Returns:
- persist task which can be used to wait for the operation completeness
- Throws:
Exception
- if certificate data is invalid
-
deleteCertificate
@NotNull public PersistTask deleteCertificate(@NotNull String alias, @NotNull SProject project, @NotNull ConfigAction configAction) throws Exception
Description copied from interface:SSLTrustStoreManager
Deletes certificate from the specified project.- Specified by:
deleteCertificate
in interfaceSSLTrustStoreManager
- Parameters:
alias
- name of certificateproject
- project where to delete the certificate (for now only root project is accepted, attempt to set some other project will cause IllegalArgumentException)configAction
- description of the action- Returns:
- persist task which can be used to wait for the operation completeness
- Throws:
Exception
- if some error happens during the certificate removal
-
getTrustStore
@Nullable public KeyStore getTrustStore()
Returns key store with addition trusted certificates.- Specified by:
getTrustStore
in interfaceSSLTrustStoreProvider
- Returns:
- key store with addition trusted certificates or
null
if there is no one
-
-