This filter binds a current user to the thread therefore allowing to show her username in each line of logs (which is helpful when it comes to combining several actions of user and looking after the logs). It's implemented by using features like {@link org.slf4j.MDC}, we need to register a username in the beginning and then unregister it in the end of the request so that the memory doesn't leak.
Note, that if a user is anonymous, we don't have means to distinguish between them except by using a session id, and that's what we're actually doing.
See logger configuration to see where the username is going to appear, for instance in log4j it may look like {@code}%X userName}}.
@author Anuar_Nurmakanov
@see LoggerMdc