use of net.sf.json.JSONArray in project OA4MP by ncsa.
the class ThingTester method getExample.
public static JSONObject getExample() {
JSONObject admin = new JSONObject();
JSONObject adminSecrets = new JSONObject();
adminSecrets.put("id", "123");
adminSecrets.put("secret", "456");
admin.put("admin", adminSecrets);
JSONObject client = new JSONObject();
JSONObject clientSecret = new JSONObject();
clientSecret.put("id", "777");
client.put("client", clientSecret);
JSONObject actionItems = new JSONObject();
actionItems.put("method", "get");
actionItems.put("type", "attribute");
JSONArray contentItems = new JSONArray();
contentItems.add("limited_proxies");
contentItems.add("callbacks");
JSONObject api = new JSONObject();
JSONObject apiItems = new JSONObject();
apiItems.put("subject", admin);
apiItems.put("action", actionItems);
apiItems.put("object", client);
apiItems.put("content", contentItems);
api.put("api", apiItems);
prettyPrint(api);
return api;
}
use of net.sf.json.JSONArray in project OA4MP by ncsa.
the class ThingTester method ldapExampleSSL.
public static JSONObject ldapExampleSSL() {
JSONObject ldapContent = new JSONObject();
ldapContent.put("authorization_type", "none");
ldapContent.put("address", "ldap2.bigstate.edu");
ldapContent.put("port", 636);
ldapContent.put("search_base", "o=bigstate,dc=co,dc=cilogon,dc=org");
JSONArray attr = new JSONArray();
JSONObject attr1 = new JSONObject();
attr1.put("name", "isMemberOf");
attr.add(attr1);
JSONObject attr2 = new JSONObject();
attr2.put("name", "affiliation");
attr.add(attr2);
ldapContent.put("search_attributes", attr);
JSONObject sslContent = new JSONObject();
sslContent.put("use_java_trust_store", false);
sslContent.put("tls_version", "1.1");
sslContent.put("store", "xWJrngnHV-WnsbMuSlvc9CnUiX9rSZB7oFB7rcb_zT2GxlBZ7NlJSOsttcfm-AaN0wWGXYXrR1pJ7yVocHPTw0rX0sre_CySQnh98Kf");
sslContent.put("password", "reallyBadPassword");
ldapContent.put("ssl", sslContent);
JSONObject ldap = new JSONObject();
ldap.put("ldap", ldapContent);
prettyPrint(ldap);
return ldap;
}
use of net.sf.json.JSONArray in project OA4MP by ncsa.
the class ThingTester method adminGetExample.
public static JSONObject adminGetExample() {
JSONObject admin = new JSONObject();
JSONObject adminSecrets = new JSONObject();
adminSecrets.put("id", "123");
adminSecrets.put("secret", "456");
admin.put("admin", adminSecrets);
JSONObject actionItems = new JSONObject();
actionItems.put("method", "get");
actionItems.put("type", "attribute");
JSONArray contentItems = new JSONArray();
contentItems.add("vo");
contentItems.add("issuer");
JSONObject api = new JSONObject();
JSONObject apiItems = new JSONObject();
apiItems.put("subject", admin);
apiItems.put("action", actionItems);
apiItems.put("content", contentItems);
api.put("api", apiItems);
prettyPrint(api);
return api;
// now for the response
}
use of net.sf.json.JSONArray in project OA4MP by ncsa.
the class ThingTester method ldapExample.
public static JSONObject ldapExample() {
JSONObject ldap = new JSONObject();
JSONObject ldapContent = new JSONObject();
ldapContent.put("authorization_type", "none");
ldapContent.put("address", "ldap.ncsa.illinois.edu");
ldapContent.put("port", 636);
ldapContent.put("search_base", "o=MESS,dc=co,dc=cilogon,dc=org");
JSONArray attr = new JSONArray();
JSONObject attr1 = new JSONObject();
attr1.put("name", "memberOf");
attr1.put("return_name", "isMemberOf");
attr1.put("return_as_list", false);
attr.add(attr1);
JSONObject attr2 = new JSONObject();
attr2.put("name", "eduPersonOrcid");
attr2.put("return_as_list", true);
attr.add(attr2);
ldapContent.put("search_attributes", attr);
ldap.put("ldap", ldapContent);
prettyPrint(ldap);
return ldap;
}
use of net.sf.json.JSONArray in project OA4MP by ncsa.
the class OA2TConverter method toMap.
@Override
public void toMap(V t, ConversionMap<String, Object> map) {
super.toMap(t, map);
if (t.getRefreshToken() != null) {
map.put(getTCK().refreshToken(), t.getRefreshToken().getToken());
}
map.put(getTCK().refreshTokenValid(), t.isRefreshTokenValid());
if (t.getCallback() != null) {
map.put(getTCK().callbackUri(), t.getCallback().toString());
}
map.put(getTCK().expiresIn(), t.getRefreshTokenLifetime());
if (t.getNonce() != null && 0 < t.getNonce().length()) {
map.put(getTCK().nonce(), t.getNonce());
}
if (t.getScopes().isEmpty()) {
return;
}
JSONArray jsonArray = new JSONArray();
for (String s : t.getScopes()) {
jsonArray.add(s);
}
map.put(getTCK().scopes(), jsonArray.toString());
if (t.hasAuthTime()) {
map.put(getTCK().authTime(), t.getAuthTime());
}
map.put(getTCK().flowStates(), t.getFlowStates().toJSON().toString());
}
Aggregations