Class ProjectCredentialsStorage

    • Method Detail

      • getType

        @NotNull
        public String getType()
        Specified by:
        getType in interface CredentialsStorage
        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 interface CredentialsStorage
        Parameters:
        secureValue - secure value
        contextProject - context project where such mapping is performed
        Returns:
        new or existing token corresponding to provided secure value
      • 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 interface CredentialsStorage
        Parameters:
        secureValue - secure value
        contextProject - context project where search is performed
        Returns:
        existing token for the secure value or null if none found
      • beforeProjectSettingsLoaded

        public void beforeProjectSettingsLoaded​(@NotNull
                                                ProjectEx project)
      • 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 interface CredentialsStorage
        Parameters:
        token - token
        contextProject - context project where such mapping is performed
        Returns:
        secure value corresponding to token pr null if there is no such value
      • 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 interface CredentialsStorageEx
        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 interface CredentialsStorageEx
      • 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 interface CredentialsStorageEx
        Parameters:
        tokens - list of tokens to delete
        contextProject - project being edited
      • 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 interface CredentialsStorageEx
        Parameters:
        tokens - map from token to secure value that should be stored
        contextProject - 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 interface CredentialsStorageEx
        Parameters:
        tokens - list of tokens to find secure values for
        contextProjects - 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 interface CredentialsStorageEx
        Parameters:
        tokenProjects - map from token to project. All tokens from this map will be copied to contextProject
        contextProject - project to copy tokens to