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;
}
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);
}
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();
}
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();
}
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);
}
Aggregations