So currently in our project we are doing this really redundant thing where we get the JWT from the header, take the UserID from it and replace it then do validation on it.
This is redundant, not needed and can be done with a single middleware function/custom filter.
class JWTParseFilter implements Filter{
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse,
FilterChain filterChain) {
// try to get UserId from JWT
// replace UserID in JWT with what ever ID is there
// send it down
// catch any errors
}
}
So currently in our project we are doing this really redundant thing where we get the JWT from the header, take the UserID from it and replace it then do validation on it.
This is redundant, not needed and can be done with a single middleware function/custom filter.