Class AppleLoginService

java.lang.Object
org.localify.auth.login.AppleLoginService

@Service @Transactional public class AppleLoginService extends Object
Service for handling Apple login.
  • Constructor Details

    • AppleLoginService

      public AppleLoginService(ServletUtils servletUtils, UserRepository userRepository, org.jose4j.jwt.consumer.JwtConsumer jwtConsumer)
      Constructs a new AppleLoginService.
      Parameters:
      servletUtils - The servlet utilities.
      userRepository - The user repository.
      jwtConsumer - The JWT consumer for Apple tokens.
  • Method Details

    • verifyToken

      public AppleJwtClaims verifyToken(String token) throws org.jose4j.jwt.consumer.InvalidJwtException, org.jose4j.jwt.MalformedClaimException
      Verifies an Apple identity token.
      Parameters:
      token - The identity token.
      Returns:
      The claims from the token.
      Throws:
      org.jose4j.jwt.consumer.InvalidJwtException - If the token is invalid.
      org.jose4j.jwt.MalformedClaimException - If a claim in the token is malformed.
    • login

      public User login(AppleLoginRequest request)
      Logs in a user with an Apple login request.
      Parameters:
      request - The Apple login request.
      Returns:
      The logged-in or created user.
    • findOrCreateUserByAppleId

      public User findOrCreateUserByAppleId(AppleJwtClaims claims)
      Finds or creates a user by their Apple ID.
      Parameters:
      claims - The claims from the Apple identity token.
      Returns:
      The found or created user.