Search in sources :

Example 1 with ClientApproval

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

the class ClientApprovalStoreCommands method update.

@Override
public boolean update(Identifiable identifiable) {
    ClientApproval clientApproval = (ClientApproval) identifiable;
    info("Starting update for client approval id=" + identifiable.getIdentifierString());
    sayi("Enter the information for the client approval");
    clientApproval.setApprover(getInput("name of the approver", clientApproval.getApprover()));
    boolean isapproved = isOk(getInput("set approved?", clientApproval.isApproved() ? "y" : "n"));
    if (isapproved) {
        clientApproval.setApproved(true);
        clientApproval.setStatus(ClientApproval.Status.APPROVED);
    } else {
        clientApproval.setApproved(false);
        switch(clientApproval.getStatus()) {
            case NONE:
            case PENDING:
                clientApproval.setStatus(ClientApproval.Status.DENIED);
                break;
            case APPROVED:
                clientApproval.setStatus(ClientApproval.Status.REVOKED);
                break;
            case REVOKED:
            case DENIED:
        }
    }
    sayi("save changes [y/n]?");
    if (isOk(readline())) {
        say(clientApproval.toString());
        return true;
    }
    sayi("save cancelled");
    info("Approval update cancelled for id=" + clientApproval.getIdentifierString());
    return false;
}
Also used : ClientApproval(edu.uiuc.ncsa.security.delegation.server.storage.ClientApproval)

Example 2 with ClientApproval

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

the class ClientApprovalStoreCommands method approve.

public void approve(InputLine inputLine) {
    if (showHelp(inputLine)) {
        showApproveHelp();
        return;
    }
    ClientApproval ca = (ClientApproval) findItem(inputLine);
    approve(ca);
}
Also used : ClientApproval(edu.uiuc.ncsa.security.delegation.server.storage.ClientApproval)

Example 3 with ClientApproval

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

the class ClientApprovalStoreCommands method longFormat.

@Override
protected void longFormat(Identifiable identifiable) {
    ClientApproval clientApproval = (ClientApproval) identifiable;
    say("\nApprover:" + clientApproval.getApprover());
    say("Identifier:" + clientApproval.getIdentifierString());
    say("Approved at:" + clientApproval.getApprovalTimestamp());
    say("Is approved? " + clientApproval.isApproved());
    say("Status:" + clientApproval.getStatus());
}
Also used : ClientApproval(edu.uiuc.ncsa.security.delegation.server.storage.ClientApproval)

Example 4 with ClientApproval

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

the class ClientStoreUtil method listAll.

@Override
protected LinkedList<Identifiable> listAll() throws Exception {
    say("select the number of the item below:");
    ClientApprovalStore cas = getSE().getClientApprovalStore();
    Set keys = getStore().keySet();
    LinkedList<Identifiable> linkedList = new LinkedList<Identifiable>();
    int i = 0;
    for (Object key : keys) {
        boolean isApproved = false;
        ClientApproval ca = (ClientApproval) cas.get(key);
        if (ca == null) {
            // create a new one
            ca = (ClientApproval) cas.create();
            ca.setStatus(ClientApproval.Status.NONE);
            ca.setApproved(false);
            cas.save(ca);
        } else {
            isApproved = ca.isApproved();
            if (isApproved && ca.getStatus() != ClientApproval.Status.APPROVED) {
                ca.setStatus(ClientApproval.Status.APPROVED);
            }
        }
        ClientApproval.Status status = ca.getStatus();
        String printableStatus = "?";
        if (status.equals(ClientApproval.Status.NONE)) {
        }
        Identifiable x = (Identifiable) getStore().get(key);
        linkedList.add(x);
        say((i++) + "." + "(" + (isApproved ? "A" : "D") + ") " + x.getIdentifierString());
    }
    if (linkedList.isEmpty()) {
        say("(no entries found)");
    }
    return linkedList;
}
Also used : Set(java.util.Set) ClientApproval(edu.uiuc.ncsa.security.delegation.server.storage.ClientApproval) ClientApprovalStore(edu.uiuc.ncsa.security.delegation.server.storage.ClientApprovalStore) LinkedList(java.util.LinkedList) Identifiable(edu.uiuc.ncsa.security.core.Identifiable)

Example 5 with ClientApproval

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

the class BaseClientStoreCommands method longFormat.

@Override
protected void longFormat(Identifiable identifiable) {
    BaseClient client = (BaseClient) identifiable;
    say("Client name=" + (client.getName() == null ? "(no name)" : client.getName()));
    sayi("identifier=" + client.getIdentifier());
    sayi("email=" + client.getEmail());
    sayi("creation timestamp=" + client.getCreationTS());
    if (getClientApprovalStore() != null) {
        ClientApproval clientApproval = (ClientApproval) getClientApprovalStore().get(client.getIdentifier());
        if (clientApproval == null) {
            sayi("no approval record exists.");
        } else {
            if (clientApproval.isApproved()) {
                String approver = "(unknown)";
                if (clientApproval.getApprover() != null) {
                    approver = clientApproval.getApprover();
                }
                sayi("approved by " + approver);
            } else {
                sayi("not approved");
            }
        }
    }
    if (client.getSecret() == null) {
        sayi("public key: (none)");
    } else {
        sayi("public key:");
        say(client.getSecret());
    }
}
Also used : ClientApproval(edu.uiuc.ncsa.security.delegation.server.storage.ClientApproval) BaseClient(edu.uiuc.ncsa.security.delegation.storage.BaseClient)

Aggregations

ClientApproval (edu.uiuc.ncsa.security.delegation.server.storage.ClientApproval)26 Client (edu.uiuc.ncsa.security.delegation.storage.Client)6 Date (java.util.Date)5 ClientApprovalProvider (edu.uiuc.ncsa.myproxy.oa4mp.server.ClientApprovalProvider)3 ClientApproverConverter (edu.uiuc.ncsa.myproxy.oa4mp.server.util.ClientApproverConverter)3 Identifier (edu.uiuc.ncsa.security.core.Identifier)3 BasicIdentifier (edu.uiuc.ncsa.security.core.util.BasicIdentifier)3 BaseClient (edu.uiuc.ncsa.security.delegation.storage.BaseClient)3 OA2Client (edu.uiuc.ncsa.security.oauth_2_0.OA2Client)3 LinkedList (java.util.LinkedList)3 TypeClient (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.types.TypeClient)2 DSFSClientApprovalStore (edu.uiuc.ncsa.myproxy.oa4mp.server.storage.filestore.DSFSClientApprovalStore)2 FilePermissionsException (edu.uiuc.ncsa.security.core.exceptions.FilePermissionsException)2 GeneralException (edu.uiuc.ncsa.security.core.exceptions.GeneralException)2 MyConfigurationException (edu.uiuc.ncsa.security.core.exceptions.MyConfigurationException)2 ClientApprovalStore (edu.uiuc.ncsa.security.delegation.server.storage.ClientApprovalStore)2 FSClientApprovalStore (edu.uiuc.ncsa.security.delegation.server.storage.impl.FSClientApprovalStore)2 OA2ClientApprovalKeys (edu.uiuc.ncsa.security.oauth_2_0.OA2ClientApprovalKeys)2 File (java.io.File)2 Set (java.util.Set)2