Package com.iizix.server.oauth
Class OAuthEngine
- java.lang.Object
- com.iizix.server.oauth.OAuthEngine
public class OAuthEngine extends java.lang.ObjectThe OAuth (2) authentication engine.- Author:
- Christopher Mindus
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OAuthEnginegetCurrentInstance()Gets the currently initialized authentication engine.static OAuthEngineinitializeNewInstance(java.lang.String baseURL)Initializes a new instance of the singleton authentication engine, replacing a previous one if present.static booleanisAuthenticationCallbackURL(java.lang.String url)Checks if the URL is for authentication.booleanprocessAuthenticationCallbackURL(java.lang.String url, HttpServletRequest request, HttpServletResponse response)Processes the URL for authentication.
Method Detail
initializeNewInstance
public static OAuthEngine initializeNewInstance(java.lang.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:
java.lang.IllegalStateException- If the authentication engine is not initialized.
isAuthenticationCallbackURL
public static boolean isAuthenticationCallbackURL(java.lang.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(java.lang.String url, HttpServletRequest request, HttpServletResponse response) throws java.io.IOExceptionProcesses 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:
java.io.IOException- For I/O errors.