this.userClientStore = Collections.synchronizedMap(uMap);
loadConfig();
}
public JSONArray getUserClients(String userId) throws JSONException, UnsupportedEncodingException {
JSONArray array = new JSONArray();
if(this.userClientStore.containsKey(userId)) {
Map<String, OAuth2Client> userMap = this.userClientStore.get(userId);
for (Entry<String, OAuth2Client> entry : userMap.entrySet()) {
OAuth2Client client = entry.getValue();
JSONObject service = new JSONObject();
service.put("name", client.getServiceName());
service.put("clientId", client.getClientId());
service.put("clientSecret", new String(client.getClientSecret(), "UTF-8"));
service.put("authUrl", client.getAuthorizationUrl());
service.put("tokenUrl", client.getTokenUrl());
service.put("type", client.getType().toString());
service.put("grantType", client.getGrantType());
service.put("authentication", client.getClientAuthenticationType());
service.put("override", client.isAllowModuleOverride());
service.put("authHeader", client.isAuthorizationHeader());
service.put("urlParam", client.isUrlParameter());
service.put("redirectUrl", client.getRedirectUri());
array.add(service);
}
}
return array;
}