Interface JwtService

All Known Implementing Classes:
JwtServiceImpl

public interface JwtService
  • Method Details

    • sign

      Signing data.
      Parameters:
      data - Data to sign.
      Returns:
      JWT token
    • verfiy

      com.auth0.jwt.interfaces.DecodedJWT verfiy(String token, String deviceId, String ipaddress)
      Verify JWT token.
      Parameters:
      token - JWT token
      deviceId - Login device ID
      ipaddress - Client IP Address
      Returns:
      True if token active
    • extractIpAddress

      String extractIpAddress(jakarta.servlet.http.HttpServletRequest httpServletRequest) throws UnknownHostException
      Extract client IP Address from request.
      Parameters:
      httpServletRequest - Request
      Returns:
      Client IP Address
      Throws:
      UnknownHostException - When cannot read ip address
    • retreiveTokenFromRequest

      Map<String,tech.corefinance.common.dto.JwtTokenDto> retreiveTokenFromRequest(jakarta.servlet.http.HttpServletRequest httpServletRequest, jakarta.servlet.http.HttpServletResponse httpServletResponse) throws IOException
      Retreive JWT data from request.
      Parameters:
      httpServletRequest - HttpServletRequest
      httpServletResponse - HttpServletResponse
      Returns:
      JwtTokenDto Object
      Throws:
      IOException - When read fail
    • buildLoginToken

      default String buildLoginToken(tech.corefinance.common.dto.JwtTokenDto jwtTokenDto) throws com.fasterxml.jackson.core.JsonProcessingException
      Build JWT token for login info
      Parameters:
      jwtTokenDto - Token DTO
      Returns:
      JWT token string
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • getJwtConfiguration

      JwtConfiguration getJwtConfiguration()
    • buildLoginVerifyKey

      default String buildLoginVerifyKey(tech.corefinance.common.dto.JwtTokenDto jwtTokenDto)
    • buildLoginDataMap

      Map<String,Serializable> buildLoginDataMap(tech.corefinance.common.dto.JwtTokenDto jwtTokenDto) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • buildRefreshToken

      default String buildRefreshToken(tech.corefinance.common.dto.JwtTokenDto jwtTokenDto, String token) throws com.fasterxml.jackson.core.JsonProcessingException
      Build JWT refresh token for login info
      Parameters:
      jwtTokenDto - Token DTO
      token - JWT token string
      Returns:
      JWT refresh token string
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • buildRefreshTokenDataMap

      Map<String,Serializable> buildRefreshTokenDataMap(tech.corefinance.common.dto.JwtTokenDto jwtTokenDto, String token) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • retrieveUserAsAttribute

      tech.corefinance.common.dto.BasicUserDto retrieveUserAsAttribute(tech.corefinance.common.dto.JwtTokenDto jwtTokenDto)
      Retrieve user info from login token.
      Parameters:
      jwtTokenDto - Login token.
      Returns:
      User from token