use of org.xdi.oxauth.model.uma.UmaErrorResponse in project oxAuth by GluuFederation.
the class ErrorResponseFactory method getUmaErrorResponse.
public UmaErrorResponse getUmaErrorResponse(IErrorType type) {
final UmaErrorResponse response = new UmaErrorResponse();
final ErrorMessage errorMessage = getError(messages.getUma(), type);
response.setError(errorMessage.getId());
response.setErrorDescription(errorMessage.getDescription());
response.setErrorUri(errorMessage.getUri());
return response;
}
use of org.xdi.oxauth.model.uma.UmaErrorResponse in project oxAuth by GluuFederation.
the class ErrorResponseFactory method getUmaJsonErrorResponse.
public String getUmaJsonErrorResponse(IErrorType type) {
final UmaErrorResponse response = getUmaErrorResponse(type);
JSONObject jsonObj = new JSONObject();
try {
jsonObj.put("error", response.getError());
if (StringHelper.isNotEmpty(response.getStatus())) {
jsonObj.put("status", response.getStatus());
}
if (StringHelper.isNotEmpty(response.getErrorDescription())) {
jsonObj.put("error_description", response.getErrorDescription());
}
if (StringHelper.isNotEmpty(response.getErrorUri())) {
jsonObj.put("error_uri", response.getErrorUri());
}
} catch (JSONException ex) {
log.error("Failed to generate error response", ex);
return null;
}
return jsonObj.toString();
}
Aggregations