我有一個小插件檢查幾件事情,如果拉請求描述包含有效的Jira票據等。Stash和Jira之間的訪問問題
以下代碼在Stash 3.2.4上測試時工作正常,但當我們將Stash升級到3.3.0(它可能不是導致插件仍在開發中的直接原因)後第二天停止工作。
public JiraServiceImpl(ApplicationLinkService applicationLinkService)
{
this.applicationLinkService = applicationLinkService;
}
private ApplicationLink getJiraApplicationLink()
{
ApplicationLink applicationLink = applicationLinkService.getPrimaryApplicationLink(JiraApplicationType.class);
if (applicationLink == null)
{
throw new IllegalStateException("Primary JIRA application link does not exist!");
}
return applicationLink;
}
public boolean doesIssueExist(IssueKey issueKey) throws CredentialsRequiredException, ResponseException
{
checkNotNull(issueKey, "issueKey is null");
final ApplicationLinkRequestFactory fac = getJiraApplicationLink().createAuthenticatedRequestFactory();
ApplicationLinkRequest req = fac.createRequest(Request.MethodType.GET, "/rest/api/2/issue/"+issueKey.getFullyQualifiedIssueKey());
return req.execute(new ApplicationLinkResponseHandler<Boolean>()
{
@Override
public Boolean credentialsRequired(Response response) throws ResponseException
{
throw new ResponseException(new CredentialsRequiredException(fac, "Token is invalid"));
}
@Override
public Boolean handle(Response response) throws ResponseException
{
return response.isSuccessful();
}
});
}
拋出異常與消息:「您沒有對遠程資源的授權訪問令牌」。
我沒有存儲管理權限,不能回到3.2.4。應用程序鏈接重新認爲是問題,但事實並非如此。進一步測試,我們看到它是爲那些擁有管理員權限的人工作的,但不是針對普通用戶的。
有什麼我可以改變來解決這個問題?
我做了,幾乎在同一時間我在這裏問。他們的回答是,他們不處理髮展問題,並鼓勵我在answers.atlassian.com上提問。 – Amaranth 2014-09-23 17:43:03