Class SimpleRouteAuthenticator

java.lang.Object
com.kingsrook.qqq.middleware.javalin.routeproviders.authentication.SimpleRouteAuthenticator
All Implemented Interfaces:
RouteAuthenticatorInterface

public class SimpleRouteAuthenticator extends Object implements RouteAuthenticatorInterface
simple implementation of a route authenticator. Assumes that unauthenticated requests should redirect to a login page. Note though, maybe that should be more intelligent, like, only redirect requests for a .html file, but not requests for include files like images or .js/.css?
  • Constructor Details

    • SimpleRouteAuthenticator

      public SimpleRouteAuthenticator()
  • Method Details

    • authenticateRequest

      public boolean authenticateRequest(io.javalin.http.Context context) throws QException
      Authenticate an HTTP request using QQQ's authentication system. Sets up the QQQ session from the request context. If authentication fails, redirects unauthenticated requests to the login page provided by the authentication module. Special handling for OAuth callbacks: If the request contains 'code' and 'state' query parameters (OAuth callback), redirects to the same URL with those parameters removed to prevent them from appearing in the browser URL.
      Specified by:
      authenticateRequest in interface RouteAuthenticatorInterface
      Parameters:
      context - the Javalin HTTP context
      Returns:
      true if authenticated and should proceed; false if redirected
      Throws:
      QException - if authentication processing fails