Search in sources :

Example 1 with RTResponse

use of edu.uiuc.ncsa.security.delegation.client.request.RTResponse in project OA4MP by ncsa.

the class OA2TestCommands method getrt.

public void getrt(InputLine inputLine) throws Exception {
    if (showHelp(inputLine)) {
        getRTHelp();
        return;
    }
    RTResponse rtResponse = getOA2S().refresh(dummyAsset.getIdentifier().toString());
    dummyAsset = (OA2Asset) getCe().getAssetStore().get(dummyAsset.getIdentifier().toString());
    // Have to update the AT reponse here every time or no token state is preserved.
    currentATResponse = new ATResponse2(dummyAsset.getAccessToken(), dummyAsset.getRefreshToken());
    currentATResponse.setParameters(rtResponse.getParameters());
    if (inputLine.hasArg(CLAIMS_FLAG)) {
        JSONObject json = JSONObject.fromObject(currentATResponse.getParameters());
        if (json.isEmpty()) {
            say("(no claims found)");
        } else {
            say(json.toString(2));
        }
    }
    printTokens();
}
Also used : JSONObject(net.sf.json.JSONObject) ATResponse2(edu.uiuc.ncsa.security.oauth_2_0.client.ATResponse2) RTResponse(edu.uiuc.ncsa.security.delegation.client.request.RTResponse)

Aggregations

RTResponse (edu.uiuc.ncsa.security.delegation.client.request.RTResponse)1 ATResponse2 (edu.uiuc.ncsa.security.oauth_2_0.client.ATResponse2)1 JSONObject (net.sf.json.JSONObject)1