added further logging to tokenauthfilter

This commit is contained in:
Rohan Sircar 2019-11-20 15:16:03 +05:30
parent b0e67cc416
commit eb7b2ab6d7

View File

@ -29,7 +29,6 @@ import org.springframework.security.core.token.TokenService;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter; import org.springframework.web.filter.OncePerRequestFilter;
@Component @Component
public class TokenAuthenticationFilter extends OncePerRequestFilter { public class TokenAuthenticationFilter extends OncePerRequestFilter {
@ -130,9 +129,9 @@ public class TokenAuthenticationFilter extends OncePerRequestFilter {
throw new BadCredentialsException("User not found"); throw new BadCredentialsException("User not found");
} }
System.out.println("Timeout duration = " + tokenTimeoutDuration); logger.info("Timeout duration = " + tokenTimeoutDuration);
boolean isTokenExpired = isTokenExpired(userToken); boolean isTokenExpired = isTokenExpired(userToken);
System.out.println("expired? " + isTokenExpired); logger.info(String.format("Token for %s is expired? %s", userToken.getUserName(), isTokenExpired));
if (!isTokenExpired) { if (!isTokenExpired) {
userToken.setCreationTime(Instant.now()); userToken.setCreationTime(Instant.now());
userTokenService.saveToken(userToken); userTokenService.saveToken(userToken);