Spring Security is configured in the project, which enables the Loaduserbyname method to detect the user's information through a custom userdetailsservice, and when it continues to run to Daoauthorityxxx, When Usernamepasswordtoken, the bad principal exception is reported, after the check is because in the security configuration
Configured with
<s:authentication-manager alias= "AuthenticationManager" >
<s:authentication-provider user-service-ref= "Userdetailsservice" >
<s:password-encoder hash= "MD5"/>
</s:authentication-provider>
</s:authentication-manager>
The password in the database is not encrypted, so springsecurity the password when comparing user input username and password, the bad Principal is thrown Exception
Workaround:
change: <s:password-encoder hash= "MD5"/> for <s:password-encoder hash= "plaintext"/> , that is, there is no encryption processing.
S-spring Security Bad Principal Exception