src/main/java/com/property/manager/data/service/AuthService.java
public ResponseEntity<?> refreshToken(RefreshTokenDTO refreshTokenDTO) {
        String refreshToken = refreshTokenDTO.getRefreshToken();
        String username = refreshTokens.get(refreshTokenDTO.getRefreshToken());
        try {
            if (username != null
                    && username.equals(refreshTokenDTO.getUsername())
                    && jwtTokenProvider.validateToken(refreshToken)) {
                String token = jwtTokenProvider.createToken(refreshTokenDTO.getUsername(), new Date());
                AuthResponseDTO authResponseDTO = new AuthResponseDTO(token, refreshTokenDTO.getRefreshToken());
                return new ResponseEntity<>(authResponseDTO, HttpStatus.OK);
            }
            return new ResponseEntity<>(HttpStatus.UNAUTHORIZED);
        } catch (CustomException exception) {
            return new ResponseEntity<>(HttpStatus.UNAUTHORIZED);
        }
    }
/**
     * Refresh valid token
     *
     * @param refreshTokenDTO DTO object
     * @return ResponseEntity object, with
     * - OK status code and AuthDTO object or UNAUTHORIZED status code and error message
     */
Refresh valid token
@param refreshTokenDTO DTO object
@return ResponseEntity object, with
- OK status code and AuthDTO object or UNAUTHORIZED status code and error message
Refresh valid token @param refreshTokenDTO DTO object @return ResponseEntity object with - OK status code and AuthDTO object or UNAUTHORIZED status code and error message
public ResponseEntity<?> refreshToken(RefreshTokenDTO refreshTokenDTO) {
        String refreshToken = refreshTokenDTO.getRefreshToken();
        String username = refreshTokens.get(refreshTokenDTO.getRefreshToken());
        try {
            if (username != null
                    && username.equals(refreshTokenDTO.getUsername())
                    && jwtTokenProvider.validateToken(refreshToken)) {
                String token = jwtTokenProvider.createToken(refreshTokenDTO.getUsername(), new Date());
                AuthResponseDTO authResponseDTO = new AuthResponseDTO(token, refreshTokenDTO.getRefreshToken());
                return new ResponseEntity<>(authResponseDTO, HttpStatus.OK);
            }
            return new ResponseEntity<>(HttpStatus.UNAUTHORIZED);
        } catch (CustomException exception) {
            return new ResponseEntity<>(HttpStatus.UNAUTHORIZED);
        }
    }
public ResponseEntity < ? > refreshToken ( RefreshTokenDTO refreshTokenDTO ) { String refreshToken = refreshTokenDTO . getRefreshToken ( ) ; String username = refreshTokens . get ( refreshTokenDTO . getRefreshToken ( ) ) ; try { if ( username != null && username . equals ( refreshTokenDTO . getUsername ( ) ) && jwtTokenProvider . validateToken ( refreshToken ) ) { String token = jwtTokenProvider . createToken ( refreshTokenDTO . getUsername ( ) , new Date ( ) ) ; AuthResponseDTO authResponseDTO = new AuthResponseDTO ( token , refreshTokenDTO . getRefreshToken ( ) ) ; return new ResponseEntity < > ( authResponseDTO , HttpStatus . OK ) ; } return new ResponseEntity < > ( HttpStatus . UNAUTHORIZED ) ; } catch ( CustomException exception ) { return new ResponseEntity < > ( HttpStatus . UNAUTHORIZED ) ; } }
Refresh valid token
 @param refreshTokenDTO DTO object
 @return ResponseEntity object, with
 - OK status code and AuthDTO object or UNAUTHORIZED status code and error message
Refresh valid token @param refreshTokenDTO DTO object @return ResponseEntity object with - OK status code and AuthDTO object or UNAUTHORIZED status code and error message