Checkpoint on cleaning up, preparing for completion of auth + routing

This commit is contained in:
2025-03-18 09:46:57 -05:00
parent 5a5d98a3ff
commit 2c32c5a9fc
7 changed files with 147 additions and 13 deletions

View File

@ -22,6 +22,7 @@
package com.kingsrook.qqq.backend.javalin;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
@ -312,4 +313,20 @@ public class QJavalinMetaData implements QSupplementalInstanceMetaData
return (this);
}
/*******************************************************************************
** Fluent setter to add 1 routeProvider
*******************************************************************************/
public QJavalinMetaData withRouteProvider(JavalinRouteProviderMetaData routeProvider)
{
if(this.routeProviders == null)
{
this.routeProviders = new ArrayList<>();
}
this.routeProviders.add(routeProvider);
return (this);
}
}

View File

@ -32,12 +32,13 @@ import com.kingsrook.qqq.backend.core.modules.authentication.QAuthenticationModu
import com.kingsrook.qqq.backend.core.modules.authentication.QAuthenticationModuleInterface;
import com.kingsrook.qqq.backend.javalin.QJavalinImplementation;
import io.javalin.http.Context;
import static com.kingsrook.qqq.backend.core.logging.LogUtils.logPair;
/*******************************************************************************
** 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 requets for a .html file, but not
** more intelligent, like, only redirect requests for a .html file, but not
** requests for include files like images or .js/.css?
*******************************************************************************/
public class SimpleRouteAuthenticator implements RouteAuthenticatorInterface
@ -53,7 +54,7 @@ public class SimpleRouteAuthenticator implements RouteAuthenticatorInterface
try
{
QSession qSession = QJavalinImplementation.setupSession(context, null);
LOG.debug("Session has been activated", "uuid=" + qSession.getUuid());
LOG.debug("Session has been activated", logPair("uuid", qSession.getUuid()));
return (true);
}
catch(QAuthenticationException e)