java.lang.Object
org.apache.wicket.markup.html.PackageResourceGuard
- All Implemented Interfaces:
IPackageResourceGuard
- Direct Known Subclasses:
SecurePackageResourceGuard
Default implementation of
IPackageResourceGuard
. By default, the extensions 'properties',
'class' and 'java' are blocked and also files like 'log4j.xml' and 'applicationContext.xml'
A more secure implementation which by default denies access to any resource is
SecurePackageResourceGuard
- Author:
- eelcohillenius
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Whether the package resource that can be reached using the provided parameters may be accessed.protected boolean
acceptExtension
(String extension) Whether the provided extension is accepted.protected boolean
acceptFile
(String file) Whether the provided filename is accepted.Gets the set of extensions that are denied access.Gets the set of extensions that are denied access.final boolean
Checks whether or not resources in the web root folder can be access.final void
setAllowAccessToRootResources
(boolean allowAccessToRootResources) Sets whether or not resources in the web root folder can be accessed.protected final void
setBlockedExtensions
(Set<String> blockedExtensions) Sets the set of extensions that are denied access.protected final void
setBlockedFiles
(Set<String> blockedFiles) Sets the set of filenames that are denied access.
-
Constructor Details
-
PackageResourceGuard
public PackageResourceGuard()Construct.
-
-
Method Details
-
accept
Description copied from interface:IPackageResourceGuard
Whether the package resource that can be reached using the provided parameters may be accessed.- Specified by:
accept
in interfaceIPackageResourceGuard
- Parameters:
path
- The absolute path, starting from the class root (packages are separated with forward slashes instead of dots).- Returns:
- True if access is permitted, false otherwise
- See Also:
-
acceptExtension
Whether the provided extension is accepted.- Parameters:
extension
- The extension, starting from the class root (packages are separated with forward slashes instead of dots).- Returns:
- True if accepted, false otherwise.
-
acceptFile
Whether the provided filename is accepted.- Parameters:
file
- filename- Returns:
- True if accepted, false otherwise.
-
getBlockedExtensions
Gets the set of extensions that are denied access.- Returns:
- The set of extensions that are denied access
-
getBlockedFiles
Gets the set of extensions that are denied access.- Returns:
- The set of extensions that are denied access
-
setBlockedExtensions
Sets the set of extensions that are denied access.- Parameters:
blockedExtensions
- Set of extensions that are denied access
-
setBlockedFiles
Sets the set of filenames that are denied access.- Parameters:
blockedFiles
- Set of extensions that are denied access
-
isAllowAccessToRootResources
Checks whether or not resources in the web root folder can be access.- Returns:
true
iff root resources can be accessed
-
setAllowAccessToRootResources
Sets whether or not resources in the web root folder can be accessed.- Parameters:
allowAccessToRootResources
-
-