Class LoginService

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

@Service @Transactional public class LoginService extends Object
Generic login service for handling OAuth callbacks and other login-related tasks.
  • Constructor Details

    • LoginService

      public LoginService()
  • Method Details

    • loginCallback

      public User loginCallback(UserCallbackTokenPayload payload)
      Handles the login callback from the OAuth provider.
      Parameters:
      payload - The payload from the callback.
      Returns:
      The authenticated user.
    • isInvalidRedirectUrl

      public boolean isInvalidRedirectUrl(String passedUrl)
      Checks if a given redirect URL is invalid.
      Parameters:
      passedUrl - The URL to check.
      Returns:
      True if the URL is invalid, false otherwise.
    • makeCallbackUri

      public URI makeCallbackUri(User user, UserOAuthRedirectParams params)
      Creates a callback URI with a new login token.
      Parameters:
      user - The user to create the token for.
      params - The OAuth redirect parameters.
      Returns:
      The callback URI.
    • isNonceValid

      public static boolean isNonceValid(String nonce)
      Preliminary sanity checking of nonce - attempts to decode and ensures it is 32 bytes.
      Parameters:
      nonce - The nonce to check.
      Returns:
      True if the nonce is valid, false otherwise.
    • validateRedirectParams

      public void validateRedirectParams(UserOAuthRedirectParams params)
      Validates the OAuth redirect parameters.
      Parameters:
      params - The parameters to validate.