src/main/java/com/feljtech/istudybucket/business/service/impl/AuthServiceImpl.java
/**
     * implementation for user authentication
     * @param loginRequest: request body for this method
     * @return: response entity containing status and jwtResponse body
     * @throws Exception: in case authentication is unsuccessful
     */
implementation for user authentication
@param loginRequest: request body for this method
@return: response entity containing status and jwtResponse body
@throws Exception: in case authentication is unsuccessful
implementation for user authentication @param loginRequest : request body for this method @return : response entity containing status and jwtResponse body @throws Exception : in case authentication is unsuccessful
public ResponseEntity<?> loginUser(LoginRequest loginRequest) throws Exception {
        authenticateUser(loginRequest);
        final UserDetails userDetails = userDetailsService.loadUserByUsername(loginRequest.getUsername());
        final String jwtToken = jwtTokenUtil.generateToken(userDetails);
        final String refreshToken = refreshTokenService.generateRefreshToken().getRefreshToken();
        final Instant jwtExpiration = Instant.now().plusMillis(jwtTokenUtil.getExpirationTimeInMillis(jwtToken));
        return new ResponseEntity<>(
                JwtResponse.builder()
                        .jwtToken(jwtToken)
                        .refreshToken(refreshToken)
                        .username(userDetails.getUsername())
                        .expiresAt(jwtExpiration)
                        .build(),
                HttpStatus.OK
        );
    }
public ResponseEntity < ? > loginUser ( LoginRequest loginRequest ) throws Exception { authenticateUser ( loginRequest ) ; final UserDetails userDetails = userDetailsService . loadUserByUsername ( loginRequest . getUsername ( ) ) ; final String jwtToken = jwtTokenUtil . generateToken ( userDetails ) ; final String refreshToken = refreshTokenService . generateRefreshToken ( ) . getRefreshToken ( ) ; final Instant jwtExpiration = Instant . now ( ) . plusMillis ( jwtTokenUtil . getExpirationTimeInMillis ( jwtToken ) ) ; return new ResponseEntity < > ( JwtResponse . builder ( ) . jwtToken ( jwtToken ) . refreshToken ( refreshToken ) . username ( userDetails . getUsername ( ) ) . expiresAt ( jwtExpiration ) . build ( ) , HttpStatus . OK ) ; }
implementation for user authentication
 @param loginRequest: request body for this method
 @return: response entity containing status and jwtResponse body
 @throws Exception: in case authentication is unsuccessful
implementation for user authentication @param loginRequest : request body for this method @return : response entity containing status and jwtResponse body @throws Exception : in case authentication is unsuccessful