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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    doGet(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.
    void
    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, service

    Methods inherited from class jakarta.servlet.GenericServlet

    destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, log, log

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface me.nickhanson.codeforge.config.PropertiesLoader

    loadProperties
  • Constructor Details

    • Auth

      public Auth()
  • Method Details

    • init

      public void init() throws jakarta.servlet.ServletException
      Initializes the servlet by loading properties and resolving the client secret.
      Overrides:
      init in class jakarta.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:
      doGet in class jakarta.servlet.http.HttpServlet
      Parameters:
      req - the HTTP servlet request
      resp - the HTTP servlet response
      Throws:
      jakarta.servlet.ServletException - - if a servlet-specific error occurs
      IOException - - if an I/O error occurs