spring-boot - 使用spring security自定义授权运行一段时间后用户名和密码为空
问题描述
我做了一个自定义授权来检查一些规则的用户名和密码。
起初一切正常,但在服务器运行几天后,无论我发送到服务器,用户名和密码都会变为空。
当我重新启动服务器时问题消失了,但几天后又出现了,我必须再次重新启动服务器。
我不知道哪里出了问题。
我已经在问题之前和之后检查了客户端,但请求很好。
服务器 java
public class LoginProvider implements AuthenticationProvider {
...
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
String userId = authentication.getName();
String password = authentication.getCredentials().toString();
// userId == "", password == ""
...
}
}
客户端javascript
var form = new FormData();
form.append("username", this.username);
form.append("password", this.password);
fetch("/loginApi", {
method: "POST",
body: form
})
解决方案
推荐阅读
- java - 如何等待Redis缓存缓存信息
- python - Python TypeError: sort() 没有位置参数
- php - 在 laravel 5.7 的服务器端无法检索 UniSharp/laravel-ckeditor 字段值
- ios - 如何将整个 iTunes Connect 帐户的应用程序组合转移到另一个实体?
- ubuntu - 如何在 Ubuntu 上为 AMD Ryzen 移动 CPU 安装 opencl
- javascript - Javascript - 总结对象数组中出现的产品的数量
- python - Python 找不到已安装的(用户站点)应用程序
- informatica-powercenter - 如何修复字符串转换为日期?
- python-3.x - 数据存储模式下的 Firestore,使用 OR 查询
- vue.js - 即使我从 Vuex 操作中的 catch() 收到错误,promise 中的 then() 也会始终执行,这在 Vue 组件中