|
@@ -23,18 +23,14 @@ import java.io.IOException;
|
|
|
* @author ruoyi
|
|
|
*/
|
|
|
@Component
|
|
|
-public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
|
|
|
-{
|
|
|
+public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
|
|
|
@Resource
|
|
|
private TokenService tokenService;
|
|
|
|
|
|
@Override
|
|
|
- protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
|
|
|
- throws ServletException, IOException
|
|
|
- {
|
|
|
+ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException {
|
|
|
LoginUser loginUser = tokenService.getLoginUser(request);
|
|
|
- if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication()))
|
|
|
- {
|
|
|
+ if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication())) {
|
|
|
tokenService.verifyToken(loginUser);
|
|
|
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginUser, null, loginUser.getAuthorities());
|
|
|
authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
|