Search in sources :

Example 1 with AdminClientKeys

use of edu.uiuc.ncsa.myproxy.oa4mp.server.admin.adminClient.AdminClientKeys in project OA4MP by ncsa.

the class ResponseSerializer method serialize.

protected void serialize(AttributeGetAdminClientResponse response, HttpServletResponse servletResponse) throws IOException {
    PrintWriter pw = servletResponse.getWriter();
    JSONObject json = new JSONObject();
    json.put("status", 0);
    AdminClientKeys keys = (AdminClientKeys) cose.getAdminClientStore().getACConverter().getKeys();
    List<String> allKeys = keys.allKeys();
    allKeys.remove(keys.secret());
    AdminClient newClient = (AdminClient) cose.getAdminClientStore().getACConverter().subset(response.getAdminClient(), response.getAttributes());
    JSONObject jsonClient = new JSONObject();
    cose.getAdminClientStore().getACConverter().toJSON(newClient, jsonClient);
    json.put("content", jsonClient);
    // return json;
    pw.println(json);
}
Also used : JSONObject(net.sf.json.JSONObject) AdminClientKeys(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.adminClient.AdminClientKeys) PrintWriter(java.io.PrintWriter) AdminClient(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.adminClient.AdminClient)

Example 2 with AdminClientKeys

use of edu.uiuc.ncsa.myproxy.oa4mp.server.admin.adminClient.AdminClientKeys in project OA4MP by ncsa.

the class ResponseSerializer method acToJSON.

private JSONObject acToJSON(AdminClient client) {
    JSONObject json = new JSONObject();
    json.put("status", 0);
    AdminClientKeys keys = (AdminClientKeys) cose.getAdminClientStore().getACConverter().getKeys();
    List<String> allKeys = keys.allKeys();
    allKeys.remove(keys.secret());
    AdminClient newClient = (AdminClient) cose.getAdminClientStore().getACConverter().subset(client, allKeys);
    JSONObject jsonClient = new JSONObject();
    cose.getAdminClientStore().getACConverter().toJSON(newClient, jsonClient);
    json.put("content", jsonClient);
    return json;
}
Also used : JSONObject(net.sf.json.JSONObject) AdminClientKeys(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.adminClient.AdminClientKeys) AdminClient(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.adminClient.AdminClient)

Aggregations

AdminClient (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.adminClient.AdminClient)2 AdminClientKeys (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.adminClient.AdminClientKeys)2 JSONObject (net.sf.json.JSONObject)2 PrintWriter (java.io.PrintWriter)1