use of edu.uiuc.ncsa.security.oauth_2_0.OA2ClientApprovalKeys 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.oauth_2_0.OA2ClientApprovalKeys in project OA4MP by ncsa.
the class ClientServer method unapprove.
public ClientResponse unapprove(UnapproveRequest request) {
canApprove(request);
ClientApproval approval = (ClientApproval) getClientApprovalStore().get(request.getClient().getIdentifier());
OA2ClientApprovalKeys keys = new OA2ClientApprovalKeys();
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(false);
getClientApprovalStore().save(approval);
return new ClientResponse();
}
Aggregations