2013-04-29 47 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或更高版本。

相关问题