Class Auth
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
me.nickhanson.codeforge.controller.Auth
- All Implemented Interfaces:
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,Serializable,PropertiesLoader
@WebServlet(urlPatterns="/auth")
public class Auth
extends jakarta.servlet.http.HttpServlet
implements PropertiesLoader
Servlet handling the OAuth2 authentication flow with AWS Cognito.
It exchanges authorization codes for tokens, validates ID tokens,
and manages authenticated user sessions.
- Author:
- Nick Hanson
- See Also:
-
Field Summary
Fields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) Gets the auth code from the request and exchanges it for a token containing user info.voidinit()Initializes the servlet by loading properties and resolving the client secret.Methods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, init, service, serviceMethods inherited from class jakarta.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, log, logMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface me.nickhanson.codeforge.config.PropertiesLoader
loadProperties
-
Constructor Details
-
Auth
public Auth()
-
-
Method Details
-
init
public void init() throws jakarta.servlet.ServletExceptionInitializes the servlet by loading properties and resolving the client secret.- Overrides:
initin classjakarta.servlet.GenericServlet- Throws:
jakarta.servlet.ServletException- if initialization fails TODO: clean up secret sourcing logic
-
doGet
protected void doGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException Gets the auth code from the request and exchanges it for a token containing user info.- Overrides:
doGetin classjakarta.servlet.http.HttpServlet- Parameters:
req- the HTTP servlet requestresp- the HTTP servlet response- Throws:
jakarta.servlet.ServletException- - if a servlet-specific error occursIOException- - if an I/O error occurs
-