protected function attachRefreshToken(UserInterface $user)
    {
        $refreshTokenManager = $this->container->get('gesdinet.jwtrefreshtoken.refresh_token_manager');
        $refreshToken = $refreshTokenManager->getLastFromUsername($user->getUsername());
        $refreshTokenTtl = $this->container->getParameter('gesdinet_jwt_refresh_token.ttl');

        if (!$refreshToken instanceof RefreshToken) {
            $refreshToken = $refreshTokenManager->create();
            $expirationDate = new \DateTime();
            $expirationDate->modify(sprintf('+%s seconds', $refreshTokenTtl));
            $refreshToken->setUsername($user->getUsername());
            $refreshToken->setRefreshToken();
            $refreshToken->setValid($expirationDate);

            $refreshTokenManager->save($refreshToken);
        }

        return $refreshToken->getRefreshToken();
    }
protected function attachRefreshToken(UserInterface $user)
    {
        $refreshTokenManager = $this->container->get('gesdinet.jwtrefreshtoken.refresh_token_manager');
        $refreshToken = $refreshTokenManager->getLastFromUsername($user->getUsername());
        $refreshTokenTtl = $this->container->getParameter('gesdinet_jwt_refresh_token.ttl');

        if (!$refreshToken instanceof RefreshToken) {
            $refreshToken = $refreshTokenManager->create();
            $expirationDate = new \DateTime();
            $expirationDate->modify(sprintf('+%s seconds', $refreshTokenTtl));
            $refreshToken->setUsername($user->getUsername());
            $refreshToken->setRefreshToken();
            $refreshToken->setValid($expirationDate);

            $refreshTokenManager->save($refreshToken);
        }

        return $refreshToken->getRefreshToken();
    }
protected function attachRefreshToken ( UserInterface $ user ) { $ refreshTokenManager = $ this -> container -> get ( 'gesdinet.jwtrefreshtoken.refresh_token_manager' ) ; $ refreshToken = $ refreshTokenManager -> getLastFromUsername ( $ user -> getUsername ( ) ) ; $ refreshTokenTtl = $ this -> container -> getParameter ( 'gesdinet_jwt_refresh_token.ttl' ) ; if ( ! $ refreshToken instanceof RefreshToken ) { $ refreshToken = $ refreshTokenManager -> create ( ) ; $ expirationDate = new \ DateTime ( ) ; $ expirationDate -> modify ( sprintf ( '+%s seconds' , $ refreshTokenTtl ) ) ; $ refreshToken -> setUsername ( $ user -> getUsername ( ) ) ; $ refreshToken -> setRefreshToken ( ) ; $ refreshToken -> setValid ( $ expirationDate ) ; $ refreshTokenManager -> save ( $ refreshToken ) ; } return $ refreshToken -> getRefreshToken ( ) ; }
Provides a refresh token.

@param UserInterface $user

@return string The refresh Json Web Token.
Provides a refresh token .