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,LifeCycle
- Direct Known Subclasses:
SymlinkAllowedResourceAliasChecker
public class AllowedResourceAliasChecker extends AbstractLifeCycle implements ContextHandler.AliasCheck
This will approve any alias to anything inside of the
ContextHandlers 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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
-
Field Summary
Fields Modifier and Type Field Description protected java.nio.file.Path_baseprotected static java.nio.file.LinkOption[]FOLLOW_LINKSprotected 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 booleancheck(java.lang.String pathInContext, java.nio.file.Path path)booleancheck(java.lang.String pathInContext, Resource resource)Check an aliasprotected voiddoStart()protected voiddoStop()protected ContextHandlergetContextHandler()protected java.nio.file.PathgetPath(Resource resource)protected voidinitialize()protected booleanisAllowed(java.nio.file.Path path)protected booleanisSameFile(java.nio.file.Path path1, java.nio.file.Path path2)java.lang.StringtoString()-
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stop
-
-
-
-
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:
doStartin classAbstractLifeCycle- Throws:
java.lang.Exception
-
doStop
protected void doStop() throws java.lang.Exception- Overrides:
doStopin classAbstractLifeCycle- Throws:
java.lang.Exception
-
check
public boolean check(java.lang.String pathInContext, Resource resource)Description copied from interface:ContextHandler.AliasCheckCheck an alias- Specified by:
checkin 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(Resource resource)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classAbstractLifeCycle
-
-