Class OAuthEngine

java.lang.Object
com.iizix.server.oauth.OAuthEngine

public class OAuthEngine extends Object
The OAuth (2) authentication engine.
Author:
Christopher Mindus
  • Method Details

    • initializeNewInstance

      public static OAuthEngine initializeNewInstance(String baseURL)
      Initializes a new instance of the singleton authentication engine, replacing a previous one if present.
      Parameters:
      baseURL - The base URL of the server for redirection, e.g. http://my.internal.name:2800. It should contain the protocol http:// or https:// and perhaps a port as :2800 if it's not matching the HTTP (80) or HTTPS (443) ports.
      Returns:
      The singleton instance.
    • getCurrentInstance

      public static OAuthEngine getCurrentInstance()
      Gets the currently initialized authentication engine.
      Returns:
      The singleton instance.
      Throws:
      IllegalStateException - If the authentication engine is not initialized.
    • isAuthenticationCallbackURL

      public static boolean isAuthenticationCallbackURL(String url)
      Checks if the URL is for authentication.
      Parameters:
      url - The relative URL starting with '/'.
      Returns:
      true if it's an authentication URL, false otherwise.
    • processAuthenticationCallbackURL

      public boolean processAuthenticationCallbackURL(String url, HttpServletRequest request, HttpServletResponse response) throws IOException
      Processes the URL for authentication.
      Parameters:
      url - The relative URL.
      request - The HTTP request.
      response - The response.
      Returns:
      true if the URL was processed, false if it's not an authentication URL.
      Throws:
      IOException - For I/O errors.