use of edu.uiuc.ncsa.myproxy.oa4mp.server.admin.adminClient.AdminClient in project OA4MP by ncsa.
the class ResponseSerializer method serialize.
protected void serialize(ListAdminsResponse response, HttpServletResponse servletResponse) throws IOException {
JSONArray adminIDs = new JSONArray();
if (response.getAdmins() != null) {
for (AdminClient client : response.getAdmins()) {
adminIDs.add(client.getIdentifierString());
}
}
PrintWriter pw = servletResponse.getWriter();
JSONObject json = new JSONObject();
json.put("status", 0);
json.put("content", adminIDs);
pw.println(json);
}
use of edu.uiuc.ncsa.myproxy.oa4mp.server.admin.adminClient.AdminClient in project OA4MP by ncsa.
the class AdminClientServer method get.
public AbstractACResponse get(ACGetRequest request) {
if (request.getAdminClient().getIdentifierString().length() == 0) {
throw new GeneralException("Error: No supplied admin client identifier.");
}
AdminClient adminClient = getAdminClientStore().get(request.getAdminClient().getIdentifier());
// do not return the secret or its hash
adminClient.setSecret("");
return new ACGetResponse(adminClient, cose.getClientApprovalStore().isApproved(adminClient.getIdentifier()));
}
use of edu.uiuc.ncsa.myproxy.oa4mp.server.admin.adminClient.AdminClient in project OA4MP by ncsa.
the class AttributeServer method getAdminClientAttributes.
protected AttributeGetAdminClientResponse getAdminClientAttributes(AttributeGetRequest request) {
AdminClient adminClient = getAdminClientStore().get(request.getAdminClient().getIdentifier());
AttributeGetAdminClientResponse response = new AttributeGetAdminClientResponse(subset(adminClient, request.attributes), request.attributes);
return response;
}
use of edu.uiuc.ncsa.myproxy.oa4mp.server.admin.adminClient.AdminClient in project OA4MP by ncsa.
the class AttributeServer method setAdminClientAttribute.
protected AttributeAdminClientResponse setAdminClientAttribute(AttributeSetClientRequest request) {
AdminClient client = getAdminClientStore().get(request.getAdminClient().getIdentifier());
ColumnMap map = new ColumnMap();
getACConverter().toMap(client, map);
for (String key : request.getAttributes().keySet()) {
// don't let anyone change the identifier.
if (!key.equals(getACConverter().getKeys().identifier())) {
map.put(key, request.getAttributes().get(key));
}
}
AdminClient updatedClient = getACConverter().fromMap(map, null);
getAdminClientStore().save(updatedClient);
AttributeAdminClientResponse attributeClientResponse = new AttributeAdminClientResponse(updatedClient);
return attributeClientResponse;
}
use of edu.uiuc.ncsa.myproxy.oa4mp.server.admin.adminClient.AdminClient in project OA4MP by ncsa.
the class OA2ATServlet method populateClaims.
protected Map<String, String> populateClaims(HttpServletRequest request, Map<String, String> p, OA2ServiceTransaction st) {
OA2SE oa2se = (OA2SE) getServiceEnvironment();
String issuer = null;
// So in order
// 1. get the issuer from the admin client
List<Identifier> admins = oa2se.getPermissionStore().getAdmins(st.getClient().getIdentifier());
for (Identifier adminID : admins) {
AdminClient ac = oa2se.getAdminClientStore().get(adminID);
if (ac != null) {
if (ac.getIssuer() != null) {
issuer = ac.getIssuer();
break;
}
}
}
// 2. If the admin client does not have an issuer set, see if the client has one
if (issuer == null) {
issuer = ((OA2Client) st.getClient()).getIssuer();
}
// The discovery servlet will try to use the server default or construct the issuer
if (issuer == null) {
issuer = OA2DiscoveryServlet.getIssuer(request);
}
p.put(OA2Claims.ISSUER, issuer);
p.put(OA2Claims.SUBJECT, st.getUsername());
if (st.hasAuthTime()) {
// convert the date to a time if needed.
p.put(OA2Constants.AUTHORIZATION_TIME, Long.toString(st.getAuthTime().getTime() / 1000));
}
return p;
}
Aggregations