how to display custom error message in jsp for spring security auth exception

后端 未结 4 2110
天涯浪人
天涯浪人 2020-11-30 00:14

I want to display custom error message in jsp for spring security authentication exceptions.

For wrong username or password,

spring displays : Bad cr         


        
4条回答
  •  醉梦人生
    2020-11-30 00:45

    I am new to spring, but try this at the server:

    throw new BadCredentialsException("This is my custom message !!");
    

    Of course you need a class that is an authentication provider for this to work.

提交回复
热议问题