我过去几天一直想把这个问题弄清楚。我们正在使用Spring Security和他们的Oauth模块。我试图找到我可以覆盖Spring Security的地方,以响应这样的异常:
{
"error":"unauthorized",
"error_description":"You must be logged in to access this resource"
}
并将返回的JSON格式化为更符合我们的其他响应。
{
"error":"unauthorized",
"error_user_message":"You must be logged in to access this resource",
"error_developer_message": "Some descriptive message",
"error_internal_code": 10044
}