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 org.fcrepo.kernel.api.utils.AutoReloadingConfiguration
Validates external content paths to ensure that they are within a configured allowed list of paths.- Author:
- bbpennel
-
-
Constructor Summary
Constructors Constructor Description ExternalContentPathValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidloadConfiguration()Loads the allowed list.voidvalidate(String extPath)Validates that an external path is valid.
-
-
-
Constructor Detail
-
ExternalContentPathValidator
public ExternalContentPathValidator()
-
-
Method Detail
-
validate
public void validate(String extPath) throws org.fcrepo.kernel.api.exception.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:
org.fcrepo.kernel.api.exception.ExternalMessageBodyException- thrown if the path is invalid.
-
loadConfiguration
protected void loadConfiguration() throws IOException
Loads the allowed list.- Specified by:
loadConfigurationin classorg.fcrepo.kernel.api.utils.AutoReloadingConfiguration- Throws:
IOException- thrown if the allowed list configuration file cannot be read.
-
-