Search in sources :

Example 6 with Identifier

use of edu.uiuc.ncsa.security.core.Identifier in project OA4MP by ncsa.

the class ConnectionCacheRetentionPolicy method retain.

@Override
public boolean retain(Object key, Object value) {
    /*
        This gets the key for the connection and the connection itself. The most basic fact is
        that connections should not go away while there are active transactions.
         */
    Identifier identifier = (Identifier) key;
    boolean rc = getTransactionStore().containsKey(identifier);
    return rc;
}
Also used : Identifier(edu.uiuc.ncsa.security.core.Identifier)

Example 7 with Identifier

use of edu.uiuc.ncsa.security.core.Identifier in project OA4MP by ncsa.

the class PermissionServer method listAdmins.

/**
 * Returns a list of admins for a given client. This will check that the permissions exist for this operation.
 *
 * @param request
 * @return
 */
public PermissionResponse listAdmins(ListAdminsRequest request) {
    // request needs an client id
    // canRead(request);
    List<Identifier> adminIDs = getPermissionStore().getAdmins(request.getClient().getIdentifier());
    List<AdminClient> admins = new LinkedList<>();
    for (Identifier id : adminIDs) {
        try {
            getPermissionStore().get(id, request.getClient().getIdentifier());
            admins.add(getAdminClientStore().get(id));
        } catch (Throwable t) {
        // rock on
        }
    }
    return new ListAdminsResponse(admins);
}
Also used : Identifier(edu.uiuc.ncsa.security.core.Identifier) LinkedList(java.util.LinkedList) AdminClient(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.adminClient.AdminClient)

Example 8 with Identifier

use of edu.uiuc.ncsa.security.core.Identifier in project OA4MP by ncsa.

the class ClientServer method remove.

/**
 * remove the client completely and all references to it.
 *
 * @param request
 * @return
 */
public ClientResponse remove(RemoveRequest request) {
    canDelete(request);
    Identifier clientID = request.getClient().getIdentifier();
    getClientApprovalStore().remove(clientID);
    List<Identifier> admins = getPermissionStore().getAdmins(clientID);
    // remove all permissions for this client and these admins
    for (Identifier adminID : admins) {
        PermissionList permissions = getPermissionStore().get(adminID, clientID);
        for (Permission p : permissions) {
            getPermissionStore().remove(p.getIdentifier());
        }
    }
    getClientStore().remove(clientID);
    return new ClientResponse();
}
Also used : Identifier(edu.uiuc.ncsa.security.core.Identifier) PermissionList(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.permissions.PermissionList) TypePermission(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.types.TypePermission) Permission(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.permissions.Permission)

Example 9 with Identifier

use of edu.uiuc.ncsa.security.core.Identifier in project OA4MP by ncsa.

the class ClientServer method approve.

public ClientResponse approve(ApproveRequest request) {
    canApprove(request);
    Identifier id = request.getClient().getIdentifier();
    ClientApproval approval = null;
    OA2ClientApprovalKeys keys = new OA2ClientApprovalKeys();
    if (getClientApprovalStore().containsKey(id)) {
        approval = (ClientApproval) getClientApprovalStore().get(id);
    } else {
        approval = (ClientApproval) getClientApprovalStore().create();
        // approval ID must be the same as the client's
        approval.setIdentifier(id);
    }
    if (request.getAttributes() != null && request.getAttributes().containsKey(keys.approver())) {
        approval.setApprover(String.valueOf(request.getAttributes().get(keys.approver())));
    } else {
        approval.setApprover(request.getAdminClient().getIdentifierString());
    }
    approval.setApproved(true);
    getClientApprovalStore().save(approval);
    return new ClientResponse();
}
Also used : Identifier(edu.uiuc.ncsa.security.core.Identifier) ClientApproval(edu.uiuc.ncsa.security.delegation.server.storage.ClientApproval) OA2ClientApprovalKeys(edu.uiuc.ncsa.security.oauth_2_0.OA2ClientApprovalKeys)

Example 10 with Identifier

use of edu.uiuc.ncsa.security.core.Identifier in project OA4MP by ncsa.

the class HeaderUtils method getIDFromParameters.

public static Identifier getIDFromParameters(HttpServletRequest request) {
    Identifier paramID = null;
    // DebugUtil.dbg(this, "doIt: no header for authentication, looking at parameters.");
    // assume that the secret and id are in the request
    String rawID = request.getParameter(AbstractServlet.CONST(CONSUMER_KEY));
    if (isEmpty(rawID)) {
        return null;
    }
    return BasicIdentifier.newID(rawID);
}
Also used : BasicIdentifier(edu.uiuc.ncsa.security.core.util.BasicIdentifier) Identifier(edu.uiuc.ncsa.security.core.Identifier)

Aggregations

Identifier (edu.uiuc.ncsa.security.core.Identifier)33 BasicIdentifier (edu.uiuc.ncsa.security.core.util.BasicIdentifier)18 GeneralException (edu.uiuc.ncsa.security.core.exceptions.GeneralException)5 Client (edu.uiuc.ncsa.security.delegation.storage.Client)5 Asset (edu.uiuc.ncsa.myproxy.oa4mp.client.Asset)4 AdminClient (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.adminClient.AdminClient)4 Permission (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.permissions.Permission)4 OA2Client (edu.uiuc.ncsa.security.oauth_2_0.OA2Client)4 URI (java.net.URI)4 SQLException (java.sql.SQLException)4 LinkedList (java.util.LinkedList)4 OA4MPResponse (edu.uiuc.ncsa.myproxy.oa4mp.client.OA4MPResponse)3 TypePermission (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.types.TypePermission)3 ClientApproval (edu.uiuc.ncsa.security.delegation.server.storage.ClientApproval)3 PrivateKey (java.security.PrivateKey)3 Date (java.util.Date)3 ActionList (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.actions.ActionList)2 ValidTimestampPolicy (edu.uiuc.ncsa.security.core.cache.ValidTimestampPolicy)2 UnknownClientException (edu.uiuc.ncsa.security.core.exceptions.UnknownClientException)2 MyLoggingFacade (edu.uiuc.ncsa.security.core.util.MyLoggingFacade)2