Interface TokenRefresher

    • Method Detail

      • getToken

        @Nullable
        OAuthToken getToken​(@Nullable
                            SProject project,
                            @NotNull
                            String tokenFullId,
                            boolean checkProjectScope,
                            boolean refreshIfExpired)
        Retrieve a token object from storage by its full id. If the token is expired, the method may attempt to refresh it, store and return a new token.
        Parameters:
        project - a project used as a context to locate a relevant connection and check project scope
        tokenFullId - a token full id in the form of oauth2:CONNECTION_ID:USER_ID:UUID_OF_TOKEN
        checkProjectScope - if true the method checks the project scope before returning the tocken
        refreshIfExpired - if the token is expired, attempt to refresh it
        Returns:
        access token object, null if such a token is not found in the storage or failed to get refreshed
      • getToken

        @Nullable
        OAuthToken getToken​(@NotNull
                            String vcsRootExtId,
                            @NotNull
                            String tokenFullId,
                            boolean checkProjectScope,
                            boolean refreshIfExpired)
        Retrieve a token object from storage by its full id. If the token is expired, the method may attempt to refresh it, store and return a new token.
        Parameters:
        vcsRootExtId - an external id of the relevant VCS root
        tokenFullId - a token full id in the form of oauth2:CONNECTION_ID:USER_ID:UUID_OF_TOKEN
        checkProjectScope - if true the method checks the project scope before returning the tocken
        refreshIfExpired - if the token is expired, attempt to refresh it
        Returns:
        access token object, null if such a token is not found in the storage or failed to get refreshed