2013-04-29 57 views

回答

0

在最新Java REST API for Rally,則RallyRestApi類爭奪餅乾一個Rally SecurityToken通過受保護的attachSecurityInfo()方法。您也可以在以下鏈接的源代碼上述起始於線377看到attachSecurityInfo如何請求令牌,但它的癥結在這裏概述:

protected static final String SECURITY_TOKEN_PARAM_KEY = "key"; 
private static final String SECURITY_TOKEN_URL = "/security/authorize"; 
protected static final String SECURITY_TOKEN_KEY = "SecurityToken"; 

GetResponse getResponse = getWithForceReauth(new GetRequest(SECURITY_TOKEN_URL)); 
JsonObject operationResult = getResponse.getObject(); 
JsonPrimitive securityTokenPrimitive = operationResult.getAsJsonPrimitive(SECURITY_TOKEN_KEY); 
securityToken = securityTokenPrimitive.getAsString(); 

public GetResponse getWithForceReauth(GetRequest request) throws IOException { 
    return get(request, true); 
} 

需要注意的是這隻能用於Java REST包1.07版或更高,並且需要(並且需要)Rally Webservices API 1.42或更高版本。

相關問題