我正在使用服务器到服务器spring restfull web-services并在spring-security.xml中编写了所有配置(我的oauth2 jar版本是2.0.10 RELEASE ),所以现在如何渲染在浏览器上自定义jsp以显示此错误?
{
"access_token": "d7a82d67-228f-459f-bf02-5c3501706c6d",
"token_type": "bearer",
"expires_in": 29,
"scope": "read trust write"
}
<oauth>
<error_description> An Authentication object was not found in the SecurityContext </error_description>
<error>unauthorized</error>
</oauth>
I just want to remove this xml response and want my custom error.jsp
答案 0 :(得分:0)
在 web.xml
中添加此内容 <!-- Unauthorized -->
<error-page>
<error-code>401</error-code>
<location>x.jsp</location>
</error-page>
<!-- access forbidden -->
<error-page>
<error-code>403</error-code>
<location> x.jsp</location>
</error-page>