Custom HTTP status response with JAX-RS (Jersey) and @RolesAllowed

前端 未结 3 1590
借酒劲吻你
借酒劲吻你 2020-12-28 08:00

With my very simple JAX-RS service I\'m using Tomcat with JDBC realm for authentication, therefore I\'m working the the JSR 250 annotations.

The thing is that I want

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-28 08:47

    REST is build upon HTTP so you don't have to change the default behavior of an authentication failure. Having a 403 error when accessing a resource is enough for the client to clearly understand what appends.

    The more your resources are HTTP compliant, the more others can understand it.

提交回复
热议问题