Spring security + JWT例子。
-
Spring Security未来会将
WebSecurityConfigurerAdapter
废弃,希望用户转向基于组件的安全配置。 [参考:Spring Security without the WebSecurityConfigurerAdapter ] -
jjwt采用jjwt-api 0.11.5
- 采用jjwt 0.9.1生成token
- 客户端请求http://localhost:8080/authenticate来申请token
- 在访问http://localhost:8080/user时,需要在请求头添加:
{
"Authorization": "Bearer <token>"
}