Search in sources :

Example 1 with AdminClient

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

the class OA2AdminClientCommands method longFormat.

@Override
protected void longFormat(Identifiable identifiable) {
    super.longFormat(identifiable);
    AdminClient client = (AdminClient) identifiable;
    sayi("issuer=" + client.getIssuer());
    sayi("vo=" + client.getVirtualOrganization());
}
Also used : AdminClient(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.adminClient.AdminClient)

Example 2 with AdminClient

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

the class OA2AdminClientCommands method extraUpdates.

@Override
public void extraUpdates(Identifiable identifiable) {
    AdminClient client = (AdminClient) identifiable;
    String secret = client.getSecret();
    String input;
    boolean askForSecret = true;
    while (askForSecret) {
        input = getInput("enter a new secret or return to skip.", secret);
        if (isEmpty(input)) {
            sayi("Nothing entered. Client secret entry skipped.");
            break;
        }
        if (input.equals(secret)) {
            sayi(" Client secret entry skipped.");
            break;
        }
        // input is not empty.
        secret = DigestUtils.sha1Hex(input);
        client.setSecret(secret);
        askForSecret = false;
    }
    String issuer = getInput("Give the issuer", client.getIssuer());
    if (!isEmpty(issuer)) {
        client.setIssuer(issuer);
    }
    String vo = getInput("Give the VO", client.getVirtualOrganization());
    if (!isEmpty(vo)) {
        client.setVirtualOrganization(vo);
    }
}
Also used : AdminClient(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.adminClient.AdminClient)

Example 3 with AdminClient

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

the class AbstractDDServer method subset.

protected AdminClient subset(AdminClient client, List<String> attributes) {
    ColumnMap map = new ColumnMap();
    cose.getAdminClientStore().getACConverter().toMap(client, map);
    ColumnMap reducedMap = new ColumnMap();
    for (String key : attributes) {
        reducedMap.put(key, map.get(key));
    }
    // Have to always include the identifier.
    reducedMap.put(cose.getClientStore().getACConverter().getKeys().identifier(), client.getIdentifierString());
    AdminClient x = (AdminClient) cose.getAdminClientStore().getACConverter().fromMap(reducedMap, null);
    return x;
}
Also used : ColumnMap(edu.uiuc.ncsa.security.storage.sql.internals.ColumnMap) AdminClient(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.adminClient.AdminClient)

Example 4 with AdminClient

use of edu.uiuc.ncsa.myproxy.oa4mp.server.admin.adminClient.AdminClient 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 5 with AdminClient

use of edu.uiuc.ncsa.myproxy.oa4mp.server.admin.adminClient.AdminClient 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)20 Permission (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.permissions.Permission)5 Identifier (edu.uiuc.ncsa.security.core.Identifier)4 OA2Client (edu.uiuc.ncsa.security.oauth_2_0.OA2Client)4 TypePermission (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.types.TypePermission)3 ColumnMap (edu.uiuc.ncsa.security.storage.sql.internals.ColumnMap)3 JSONObject (net.sf.json.JSONObject)3 AdminClientKeys (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.adminClient.AdminClientKeys)2 PermissionList (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.permissions.PermissionList)2 PrintWriter (java.io.PrintWriter)2 LinkedList (java.util.LinkedList)2 OA2SE (edu.uiuc.ncsa.myproxy.oa4mp.oauth2.OA2SE)1 AddClientRequest (edu.uiuc.ncsa.myproxy.oa4mp.oauth2.cm.util.permissions.AddClientRequest)1 PermissionServer (edu.uiuc.ncsa.myproxy.oa4mp.oauth2.cm.util.permissions.PermissionServer)1 ActionAdd (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.actions.ActionAdd)1 ActionList (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.actions.ActionList)1 TypeClient (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.types.TypeClient)1 GeneralException (edu.uiuc.ncsa.security.core.exceptions.GeneralException)1 BasicIdentifier (edu.uiuc.ncsa.security.core.util.BasicIdentifier)1 ClientApproval (edu.uiuc.ncsa.security.delegation.server.storage.ClientApproval)1