Search in sources :

Example 1 with AddClientRequest

use of edu.uiuc.ncsa.myproxy.oa4mp.oauth2.cm.util.permissions.AddClientRequest in project OA4MP by ncsa.

the class ClientServerTest method testRemove.

public void testRemove(CMTestStoreProvider tp2) throws Exception {
    CC cc = setupClients(tp2);
    // so approve this
    ClientServer server = new ClientServer(tp2.getCOSE());
    ApproveRequest approveRequest = RequestFactory.createRequest(cc.adminClient, new TypeClient(), new ActionApprove(), cc.client, null);
    server.process(approveRequest);
    assert tp2.getClientApprovalStore().containsKey(cc.client.getIdentifier());
    assert tp2.getClientApprovalStore().get(cc.client.getIdentifier()).isApproved();
    assert !tp2.getPermissionStore().get(cc.adminClient.getIdentifier(), cc.client.getIdentifier()).isEmpty();
    AdminClient ac2 = getAdminClient(tp2.getAdminClientStore());
    PermissionServer permissionServer = new PermissionServer(tp2.getCOSE());
    AddClientRequest addClientRequest = RequestFactory.createRequest(ac2, new TypePermission(), new ActionAdd(), cc.client, null);
    permissionServer.process(addClientRequest);
    assert !tp2.getPermissionStore().get(ac2.getIdentifier(), cc.client.getIdentifier()).isEmpty();
    // ok, so now we have a couple of admin clients with permissions on this client and it is approved. Let's
    // see if everything gets cleaned out.
    RemoveRequest removeRequest = RequestFactory.createRequest(cc.adminClient, new TypeClient(), new ActionRemove(), cc.client, null);
    server.process(removeRequest);
    assert !tp2.getClientStore().containsKey(cc.client.getIdentifier());
    assert !tp2.getClientApprovalStore().containsKey(cc.client.getIdentifier());
    assert tp2.getPermissionStore().get(cc.adminClient.getIdentifier(), cc.client.getIdentifier()).isEmpty();
    assert tp2.getPermissionStore().get(ac2.getIdentifier(), cc.client.getIdentifier()).isEmpty();
}
Also used : PermissionServer(edu.uiuc.ncsa.myproxy.oa4mp.oauth2.cm.util.permissions.PermissionServer) TypeClient(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.types.TypeClient) TypePermission(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.types.TypePermission) AdminClient(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.adminClient.AdminClient) AddClientRequest(edu.uiuc.ncsa.myproxy.oa4mp.oauth2.cm.util.permissions.AddClientRequest)

Aggregations

AddClientRequest (edu.uiuc.ncsa.myproxy.oa4mp.oauth2.cm.util.permissions.AddClientRequest)1 PermissionServer (edu.uiuc.ncsa.myproxy.oa4mp.oauth2.cm.util.permissions.PermissionServer)1 AdminClient (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.adminClient.AdminClient)1 TypeClient (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.types.TypeClient)1 TypePermission (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.types.TypePermission)1