mirror of https://github.com/longtai-cn/hippo4j
optimize 1192: Set a friendly prompt respectively when the login user does not exist and the password is wrong (#1194)
* optimize: set a friendly prompt respectively when the login user does not exist and the password is wrong. * test: add test for JWTAuthenticationFilter.getMessage * style: Add a blank line for JWTAuthenticationFilterTest.class --------- Co-authored-by: lucca <luccasuen.dev@gmail.com>pull/1202/head
parent
cdeae3010f
commit
e3cb45f5ba
@ -0,0 +1,19 @@
|
||||
package cn.hippo4j.auth.filter;
|
||||
|
||||
import cn.hippo4j.common.toolkit.ReflectUtil;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.security.authentication.BadCredentialsException;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
|
||||
class JWTAuthenticationFilterTest {
|
||||
|
||||
@Test
|
||||
void getMessageTest() {
|
||||
JWTAuthenticationFilter filter = new JWTAuthenticationFilter(null);
|
||||
Assertions.assertEquals("用户不存在", ReflectUtil.invoke(filter,
|
||||
"getMessage", new UsernameNotFoundException("")));
|
||||
Assertions.assertEquals("密码错误", ReflectUtil.invoke(filter,
|
||||
"getMessage", new BadCredentialsException("")));
|
||||
}
|
||||
}
|
Loading…
Reference in new issue