Search in sources :

Example 6 with BaseClient

use of edu.uiuc.ncsa.security.delegation.storage.BaseClient in project OA4MP by ncsa.

the class BaseClientStoreCommands method format.

@Override
protected String format(Identifiable identifiable) {
    BaseClient client = (BaseClient) identifiable;
    String rc = null;
    ClientApproval ca = (ClientApproval) getClientApprovalStore().get(client.getIdentifier());
    if (ca == null) {
        rc = "(?) " + client.getIdentifier() + " ";
    } else {
        boolean isApproved = ca != null && ca.isApproved();
        rc = "(" + (isApproved ? "Y" : "N") + ") " + client.getIdentifier() + " ";
    }
    String name = (client.getName() == null ? "no name" : client.getName());
    if (20 < name.length()) {
        name = name.substring(0, 20) + "...";
    }
    rc = rc + "(" + name + ")";
    rc = rc + " created on " + Iso8601.date2String(client.getCreationTS());
    return rc;
}
Also used : ClientApproval(edu.uiuc.ncsa.security.delegation.server.storage.ClientApproval) BaseClient(edu.uiuc.ncsa.security.delegation.storage.BaseClient)

Example 7 with BaseClient

use of edu.uiuc.ncsa.security.delegation.storage.BaseClient in project OA4MP by ncsa.

the class BaseClientStoreCommands method approve.

public void approve(InputLine inputLine) {
    if (showHelp(inputLine)) {
        showApproveHelp();
        return;
    }
    BaseClient client = (BaseClient) findItem(inputLine);
    ClientApproval ca = null;
    if (getClientApprovalStore().containsKey(client.getIdentifier())) {
        ca = (ClientApproval) getClientApprovalStore().get(client.getIdentifier());
    } else {
        ca = (ClientApproval) getClientApprovalStore().create();
        ca.setIdentifier(client.getIdentifier());
    }
    // now we have the right approval record for this identifier
    clientApprovalStoreCommands.approve(ca);
}
Also used : ClientApproval(edu.uiuc.ncsa.security.delegation.server.storage.ClientApproval) BaseClient(edu.uiuc.ncsa.security.delegation.storage.BaseClient)

Aggregations

BaseClient (edu.uiuc.ncsa.security.delegation.storage.BaseClient)7 ClientApproval (edu.uiuc.ncsa.security.delegation.server.storage.ClientApproval)3 Identifiable (edu.uiuc.ncsa.security.core.Identifiable)2 ArrayList (java.util.ArrayList)2 TreeMap (java.util.TreeMap)2 Identifier (edu.uiuc.ncsa.security.core.Identifier)1 GeneralException (edu.uiuc.ncsa.security.core.exceptions.GeneralException)1 BasicIdentifier (edu.uiuc.ncsa.security.core.util.BasicIdentifier)1