Announcement Announcement Module
No announcement yet.
Custom JSON response to exceptions and errors Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom JSON response to exceptions and errors

    So I have a question them seems to have me going around in circles a little bit. Fairly new to Spring Security so that would be part of the issue.

    Basically what I want to do is return a custom JSON object for Spring Security Exceptions. For example when a user is not authenticated (I'm using Spring Oauth by the way) this exception is thrown.

    ExceptionTranslationFilter - Authentication exception occurred; redirecting to authentication entry point.
    Works as expected. My issue is how do I customize what is being returned by that Exception. I thought I could override the ExceptionTranslationFilter but after reading this post it appears that isn't possible.

    Any direction on this would be great. I want to end up with JSON responses from Spring Security and our app to be consistent for the client.