Package org.fcrepo.http.api
Class ExternalContentPathValidator
- java.lang.Object
-
- org.fcrepo.kernel.api.utils.AutoReloadingConfiguration
-
- org.fcrepo.http.api.ExternalContentPathValidator
-
public class ExternalContentPathValidator extends AutoReloadingConfiguration
Validates external content paths to ensure that they are within a configured allowed list of paths.- Author:
- bbpennel
-
-
Field Summary
-
Fields inherited from class org.fcrepo.kernel.api.utils.AutoReloadingConfiguration
configPath
-
-
Constructor Summary
Constructors Constructor Description ExternalContentPathValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
loadConfiguration()
Loads the allowed list.void
validate(String extPath)
Validates that an external path is valid.-
Methods inherited from class org.fcrepo.kernel.api.utils.AutoReloadingConfiguration
init, setConfigPath, setMonitorForChanges, shutdown
-
-
-
-
Constructor Detail
-
ExternalContentPathValidator
public ExternalContentPathValidator()
-
-
Method Detail
-
validate
public void validate(String extPath) throws ExternalMessageBodyException
Validates that an external path is valid. The path must be an HTTP or file URI within the allow list of paths, be absolute, and contain no relative modifier.- Parameters:
extPath
- external binary path to validate- Throws:
ExternalMessageBodyException
- thrown if the path is invalid.
-
loadConfiguration
protected void loadConfiguration() throws IOException
Loads the allowed list.- Specified by:
loadConfiguration
in classAutoReloadingConfiguration
- Throws:
IOException
- thrown if the allowed list configuration file cannot be read.
-
-