Class TokenUtils

java.lang.Object
com.espacogeek.geek.utils.TokenUtils

@Component public class TokenUtils extends Object
Utility for extracting the JWT access token from the current request. Access tokens are read ONLY from the Authorization: Bearer header — never from cookies — to eliminate CSRF attack vectors.
  • Constructor Details

    • TokenUtils

      public TokenUtils()
  • Method Details

    • resolveToken

      public String resolveToken(jakarta.servlet.http.HttpServletRequest request)
      Extract the access token from the Authorization: Bearer header of the given request. Returns null if the header is absent or not in Bearer format.
    • resolveToken

      public String resolveToken()
      Extract the access token from the current request via RequestContextHolder. Falls back to reading from the SecurityContextHolder when the servlet request is not available (e.g., deep inside a GraphQL execution context).