Package org.eclipse.jetty.server
Class AllowedResourceAliasChecker
- java.lang.Object
-
- org.eclipse.jetty.util.component.AbstractLifeCycle
-
- org.eclipse.jetty.server.AllowedResourceAliasChecker
-
- All Implemented Interfaces:
ContextHandler.AliasCheck
,org.eclipse.jetty.util.component.LifeCycle
- Direct Known Subclasses:
SymlinkAllowedResourceAliasChecker
public class AllowedResourceAliasChecker extends org.eclipse.jetty.util.component.AbstractLifeCycle implements ContextHandler.AliasCheck
This will approve any alias to anything inside of the
ContextHandler
s resource base which is not protected by a protected target as defined byContextHandler.getProtectedTargets()
at start.Aliases approved by this may still be able to bypass SecurityConstraints, so this class would need to be extended to enforce any additional security constraints that are required.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.nio.file.Path
_base
protected static java.nio.file.LinkOption[]
FOLLOW_LINKS
protected static java.nio.file.LinkOption[]
NO_FOLLOW_LINKS
-
Constructor Summary
Constructors Constructor Description AllowedResourceAliasChecker(ContextHandler contextHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
check(java.lang.String pathInContext, java.nio.file.Path path)
boolean
check(java.lang.String pathInContext, org.eclipse.jetty.util.resource.Resource resource)
Check an aliasprotected void
doStart()
protected void
doStop()
protected ContextHandler
getContextHandler()
protected java.nio.file.Path
getPath(org.eclipse.jetty.util.resource.Resource resource)
protected void
initialize()
protected boolean
isAllowed(java.nio.file.Path path)
protected boolean
isSameFile(java.nio.file.Path path1, java.nio.file.Path path2)
java.lang.String
toString()
-
-
-
Constructor Detail
-
AllowedResourceAliasChecker
public AllowedResourceAliasChecker(ContextHandler contextHandler)
- Parameters:
contextHandler
- the context handler to use.
-
-
Method Detail
-
getContextHandler
protected ContextHandler getContextHandler()
-
initialize
protected void initialize()
-
doStart
protected void doStart() throws java.lang.Exception
- Overrides:
doStart
in classorg.eclipse.jetty.util.component.AbstractLifeCycle
- Throws:
java.lang.Exception
-
doStop
protected void doStop() throws java.lang.Exception
- Overrides:
doStop
in classorg.eclipse.jetty.util.component.AbstractLifeCycle
- Throws:
java.lang.Exception
-
check
public boolean check(java.lang.String pathInContext, org.eclipse.jetty.util.resource.Resource resource)
Description copied from interface:ContextHandler.AliasCheck
Check an alias- Specified by:
check
in interfaceContextHandler.AliasCheck
- Parameters:
pathInContext
- The path the aliased resource was created forresource
- The aliased resourced- Returns:
- True if the resource is OK to be served.
-
check
protected boolean check(java.lang.String pathInContext, java.nio.file.Path path)
-
isAllowed
protected boolean isAllowed(java.nio.file.Path path)
-
isSameFile
protected boolean isSameFile(java.nio.file.Path path1, java.nio.file.Path path2)
-
getPath
protected java.nio.file.Path getPath(org.eclipse.jetty.util.resource.Resource resource)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classorg.eclipse.jetty.util.component.AbstractLifeCycle
-
-