Authenticated no after logged in issue in Symfony2

When you use custom entity with certain user table, Symfony2 will check token with inherited method. Especially, when User entity use refreshUser method, previous token and return object could be different value and profiler is displaying [Authenticated No].

One of solution is implementing EquatableInterface.

//in CustomUser Entity
class CustomUser implements UserInterface, EquatableInterface {
  public function isEqualTo(UserInterface $user){
    if($this->getId() == $user->getId()) return true;
    else return false;