use of org.forgerock.openam.sts.STSPrincipal in project OpenAM by OpenRock.
the class PrincipalFromSessionImpl method parsePrincipalFromResponse.
private Principal parsePrincipalFromResponse(String response) throws TokenValidationException {
JsonValue responseJson;
try {
responseJson = JsonValueBuilder.toJsonValue(response);
} catch (JsonException e) {
String message = "Exception caught getting the text of the json principal from session response: " + e;
throw new TokenValidationException(ResourceException.INTERNAL_ERROR, message, e);
}
JsonValue principalIdJsonValue = responseJson.get(ID);
if (!principalIdJsonValue.isString()) {
String message = "Principal from session response does not contain " + ID + " string entry. The obtained entry: " + principalIdJsonValue.toString() + "; The response: " + responseJson.toString();
throw new TokenValidationException(ResourceException.INTERNAL_ERROR, message);
}
return new STSPrincipal(principalIdJsonValue.asString());
}
Aggregations