Search in sources :

Example 1 with ActionSet

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

the class AttributeServerTest method testAttributeServerSet.

public void testAttributeServerSet(CMTestStoreProvider tp2) throws Exception {
    CC cc = setupClients(tp2);
    OA2ClientKeys keys = getClientKeys(tp2);
    AttributeServer attributeServer = new AttributeServer(tp2.getCOSE());
    JSONObject map = new JSONObject();
    String random = getRandom(8);
    LinkedList<String> scopes = new LinkedList<>();
    scopes.add(OA2Scopes.SCOPE_PROFILE);
    scopes.add(OA2Scopes.SCOPE_OPENID);
    map.put(keys.name(), "new name " + random);
    map.put(keys.homeURL(), "https://" + random + "/client");
    map.put(keys.scopes(), scopes);
    AttributeSetClientRequest req = RequestFactory.createRequest(cc.adminClient, new TypeAttribute(), new ActionSet(), cc.client, map);
    AttributeClientResponse resp = (AttributeClientResponse) attributeServer.process(req);
    OA2Client client = (OA2Client) resp.getClient();
    assert client.getName().equals(map.get(keys.name()));
    assert client.getIdentifier().equals(cc.client.getIdentifier());
    assert client.getHomeUri().equals(map.get(keys.homeURL()));
    assert client.getScopes().size() == scopes.size();
    for (String scope : scopes) {
        assert client.getScopes().contains(scope) : "returned scopes failed to contain " + scope;
    }
}
Also used : OA2Client(edu.uiuc.ncsa.security.oauth_2_0.OA2Client) JSONObject(net.sf.json.JSONObject) TypeAttribute(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.types.TypeAttribute) OA2ClientKeys(edu.uiuc.ncsa.security.oauth_2_0.OA2ClientKeys) LinkedList(java.util.LinkedList) ActionSet(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.actions.ActionSet)

Aggregations

ActionSet (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.actions.ActionSet)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 LinkedList (java.util.LinkedList)1 JSONObject (net.sf.json.JSONObject)1