Search in sources :

Example 1 with ActionGet

use of edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.actions.ActionGet in project OA4MP by ncsa.

the class AttributeServerTest method testAttributeServerGet.

public void testAttributeServerGet(CMTestStoreProvider tp2) throws Exception {
    CC cc = setupClients(tp2);
    AttributeServer attributeServer = new AttributeServer(tp2.getCOSE());
    OA2ClientKeys keys = getClientKeys(tp2);
    JSONArray array = new JSONArray();
    array.add(keys.scopes());
    array.add(keys.callbackUri());
    array.add(keys.rtLifetime());
    array.add(keys.name());
    AttributeGetRequest req = RequestFactory.createRequest(cc.adminClient, new TypeAttribute(), new ActionGet(), cc.client, array);
    AttributeClientResponse r = (AttributeClientResponse) attributeServer.process(req);
    OA2Client reducedClient = (OA2Client) r.getClient();
    assert reducedClient.getIdentifier().equals(cc.client.getIdentifier());
    assert reducedClient.getScopes() != null;
    assert reducedClient.getCallbackURIs() != null;
    assert reducedClient.getRtLifetime() == cc.client.getRtLifetime();
    assert reducedClient.getName().equals(cc.client.getName());
    JSONObject json = new JSONObject();
    tp2.getClientStore().getACConverter().toJSON(r.getClient(), json);
    System.out.println(json);
}
Also used : OA2Client(edu.uiuc.ncsa.security.oauth_2_0.OA2Client) ActionGet(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.actions.ActionGet) TypeAttribute(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.types.TypeAttribute) JSONObject(net.sf.json.JSONObject) OA2ClientKeys(edu.uiuc.ncsa.security.oauth_2_0.OA2ClientKeys) JSONArray(net.sf.json.JSONArray)

Aggregations

ActionGet (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.actions.ActionGet)1 TypeAttribute (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.types.TypeAttribute)1 OA2Client (edu.uiuc.ncsa.security.oauth_2_0.OA2Client)1 OA2ClientKeys (edu.uiuc.ncsa.security.oauth_2_0.OA2ClientKeys)1 JSONArray (net.sf.json.JSONArray)1 JSONObject (net.sf.json.JSONObject)1