Class UserSSLTrustStoreManager

    • Method Detail

      • init

        public void init()
      • getTrustStore

        @Nullable
        public KeyStore getTrustStore()
        Returns key store with addition trusted certificates.
        Specified by:
        getTrustStore in interface SSLTrustStoreProvider
        Returns:
        key store with addition trusted certificates or null if there is no one
      • getCertificates

        @NotNull
        public TeamCityTrustedSslCertificate[] getCertificates​(@NotNull
                                                               SProject project)
        Return all stored certificates for concrete project.
        Specified by:
        getCertificates in interface SSLTrustStoreManager
        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)
        Return a hash of stored certificates for concrete project.
        Specified by:
        getCertificatesHash in interface SSLTrustStoreManager
        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
        Store certificate to the specified project.
        Specified by:
        storeNewCertificate in interface SSLTrustStoreManager
        Parameters:
        alias - name of certificate
        data - certificate data
        project - 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
        Deletes certificate from the specified project.
        Specified by:
        deleteCertificate in interface SSLTrustStoreManager
        Parameters:
        alias - name of certificate
        project - 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