Package org.localify.auth.login
Class AppleLoginService
java.lang.Object
org.localify.auth.login.AppleLoginService
Service for handling Apple login.
-
Constructor Summary
ConstructorsConstructorDescriptionAppleLoginService(ServletUtils servletUtils, UserRepository userRepository, org.jose4j.jwt.consumer.JwtConsumer jwtConsumer) Constructs a new AppleLoginService. -
Method Summary
Modifier and TypeMethodDescriptionFinds or creates a user by their Apple ID.login(AppleLoginRequest request) Logs in a user with an Apple login request.verifyToken(String token) Verifies an Apple identity token.
-
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
Logs in a user with an Apple login request.- Parameters:
request- The Apple login request.- Returns:
- The logged-in or created user.
-
findOrCreateUserByAppleId
Finds or creates a user by their Apple ID.- Parameters:
claims- The claims from the Apple identity token.- Returns:
- The found or created user.
-