mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Serializing the complete OAuthAPplicationInfo bean
This commit is contained in:
parent
4e17a2669f
commit
a3e385bd2f
@ -18,8 +18,10 @@
|
||||
*/
|
||||
package org.wso2.carbon.identity.oauth.extension;
|
||||
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ -101,4 +103,13 @@ public class OAuthApplicationInfo {
|
||||
this.parameters.remove(key);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
try {
|
||||
return mapper.writeValueAsString(this);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Error occurred while serializing OAuthApplicationInfo bean");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ public class ClientRegistrationServiceImpl implements RegistrationService {
|
||||
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(MultitenantConstants.SUPER_TENANT_ID);
|
||||
|
||||
OAuthApplicationInfo info = this.registerApplication(profile);
|
||||
return Response.status(Response.Status.ACCEPTED).entity(info.getJsonString()).build();
|
||||
return Response.status(Response.Status.ACCEPTED).entity(info.toString()).build();
|
||||
} catch (APIManagementException e) {
|
||||
String msg = "Error occurred while registering client '" + profile.getClientName() + "'";
|
||||
log.error(msg, e);
|
||||
@ -125,6 +125,8 @@ public class ClientRegistrationServiceImpl implements RegistrationService {
|
||||
oAuthApplicationInfo.addParameter(ApplicationConstants.
|
||||
OAUTH_CLIENT_GRANT, jsonObject.get(ApplicationConstants.OAUTH_CLIENT_GRANT));
|
||||
}
|
||||
|
||||
|
||||
} catch (JSONException e) {
|
||||
throw new APIManagementException("Can not retrieve information of the created OAuth application", e);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user