Skip to content
Merged
7 changes: 6 additions & 1 deletion api/src/org/labkey/api/security/AuthenticationProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.labkey.api.util.URLHelper;
import org.labkey.api.util.logging.LogHelper;
import org.labkey.api.view.ActionURL;
import org.labkey.bootstrap.StartupEnvironment;

import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -245,14 +246,18 @@ default boolean isFicamApproved()
interface SecondaryAuthenticationProvider<SAC extends SecondaryAuthenticationConfiguration<?>> extends ConfigurableAuthenticationProvider<SAC>
{
String REQUIRED_FOR = "requiredFor";

/**
* Bypass authentication from this provider. Might be configured via context.bypass2FA=true property in
* application.properties to temporarily not require secondary authentication if this has been misconfigured, or
* a 3rd party service provider is unavailable.
*/
boolean bypass();

static boolean isBypassConfigured()
{
return Boolean.parseBoolean(ModuleLoader.getServletContext().getInitParameter(StartupEnvironment.BYPASS_2FA_PARAMETER));
}

default SettingsField getRequiredForField(String name)
{
return OptionsField.of(REQUIRED_FOR, "Require " + name + " for:", "Specifying the role option allows for a progressive roll-out of " + name + " to site users.", true, "all")
Expand Down
2 changes: 1 addition & 1 deletion api/src/org/labkey/api/security/Directive.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/**
* All CSP directives that support substitutions. These constant names are persisted to the database, so be careful
* with any changes. If adding a Directive, make sure to add the corresponding substitutions to the appropriate CSP
* template(s) in LabKeyServer.
* template(s) in server/embedded/src/main/resources/labkey-defaults.properties.
*/
public enum Directive implements StartupProperty, SafeToRenderEnum
{
Expand Down
22 changes: 5 additions & 17 deletions api/src/org/labkey/api/util/ContextListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,22 @@
import org.labkey.api.module.Module;
import org.labkey.api.module.ModuleLoader;
import org.labkey.api.util.logging.LogHelper;
import org.labkey.bootstrap.PipelineBootstrapConfig;
import org.labkey.bootstrap.StartupEnvironment;
import org.springframework.web.context.ContextLoaderListener;

import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

/**
* @see org.labkey.bootstrap.PipelineBootstrapConfig
* @see org.labkey.bootstrap.LabKeyBootstrapClassLoader
*/
public class ContextListener implements ServletContextListener
{
// this is among the earliest classes loaded (except for classes loaded via annotations @ClientEndpoint @ServerEndpoint etc)

// IMPORTANT see also LabKeyBootstrapClassLoader/PipelineBootstrapConfig which duplicates this code, keep them consistent
// On startup on some platforms, some modules will die if java.awt.headless is not set to false.
static
{
String headless = "java.awt.headless";
if (System.getProperty(headless) == null)
System.setProperty(headless, "true");
// On most installs, catalina.home and catalina.base point to the same directory. However, it's possible
// to have multiple instances share the Tomcat binaries but have their own ./logs, ./conf, etc. directories
// Thus, we want to use catalina.base for our place to find log files.
if (LogHelper.getLabKeyLogDir() == null)
{
// Set this only if the user hasn't overridden it
System.setProperty(LogHelper.LOG_HOME_PROPERTY_NAME, System.getProperty("catalina.base") + "/logs");
}
StartupEnvironment.ensureHeadless();
// Covers launchers other than LabKeyServer.main, which sets this first
PipelineBootstrapConfig.ensureLogHomeSet("logs");

// Adds non-standard TLDs to allowable values for Apache Commons Validator. See Issue 25041. Since this
// is set statically, it must be called very early, before any reference to UrlValidator occurs. Any
Expand Down
6 changes: 4 additions & 2 deletions pipeline/src/org/labkey/pipeline/api/PipelineServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
import org.labkey.api.view.ViewBackgroundInfo;
import org.labkey.api.view.ViewContext;
import org.labkey.bootstrap.ClusterBootstrap;
import org.labkey.bootstrap.StartupEnvironment;
import org.labkey.pipeline.PipelineController;
import org.labkey.pipeline.analysis.ProtocolManagementAuditProvider;
import org.labkey.pipeline.importer.FolderImportJob;
Expand Down Expand Up @@ -456,9 +457,10 @@ public List<String> getClusterStartupArguments()
{
List<String> args = new ArrayList<>();
args.add(System.getProperty("java.home") + "/bin/java" + (SystemUtils.IS_OS_WINDOWS ? ".exe" : ""));
File labkeyBootstrap = FileUtil.appendName(new File(System.getProperty("catalina.home")), "labkeyBootstrap.jar");
File labkeyHome = StartupEnvironment.getLabKeyHome();
File labkeyBootstrap = labkeyHome == null ? null : FileUtil.appendName(labkeyHome, "labkeyBootstrap.jar");

if (!labkeyBootstrap.exists())
if (labkeyBootstrap == null || !labkeyBootstrap.exists())
{
try
{
Expand Down
Loading