Package org.eclipse.jetty.server
Class AllowedResourceAliasChecker
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.server.AllowedResourceAliasChecker
- All Implemented Interfaces:
AliasCheck
,LifeCycle
- Direct Known Subclasses:
SymlinkAllowedResourceAliasChecker
This will approve any alias to anything inside of the ContextHandler
s resource base which
is not protected by a protected target as defined by the ContextHandler
protected targets 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, AbstractLifeCycle.StopException
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
Field Summary
Modifier and TypeFieldDescriptionprotected Path
Deprecated.protected Resource
protected static final LinkOption[]
protected static final LinkOption[]
-
Constructor Summary
ConstructorDescriptionAllowedResourceAliasChecker
(ContextHandler contextHandler) AllowedResourceAliasChecker
(ContextHandler contextHandler, Supplier<Resource> resourceBaseSupplier) AllowedResourceAliasChecker
(ContextHandler contextHandler, Resource baseResource) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
protected boolean
boolean
checkAlias
(String pathInContext, Resource resource) Check if an alias is allowed to be served.protected void
doStart()
Method to override to start the lifecycleprotected void
doStop()
Method to override to stop the lifecycleprotected ContextHandler
protected Path
Deprecated.protected void
protected boolean
protected boolean
isSameFile
(Path path1, Path path2) Deprecated.toString()
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addEventListener, getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeEventListener, setEventListeners, start, stop
-
Field Details
-
FOLLOW_LINKS
-
NO_FOLLOW_LINKS
-
_baseResource
-
_base
Deprecated.
-
-
Constructor Details
-
AllowedResourceAliasChecker
- Parameters:
contextHandler
- the context handler to use.
-
AllowedResourceAliasChecker
-
AllowedResourceAliasChecker
public AllowedResourceAliasChecker(ContextHandler contextHandler, Supplier<Resource> resourceBaseSupplier)
-
-
Method Details
-
getContextHandler
-
getBaseResource
-
initialize
protected void initialize() -
doStart
Description copied from class:AbstractLifeCycle
Method to override to start the lifecycle- Overrides:
doStart
in classAbstractLifeCycle
- Throws:
AbstractLifeCycle.StopException
- If thrown, the lifecycle will immediately be stopped.Exception
- If there was a problem starting. Will cause a transition to FAILED state
-
doStop
Description copied from class:AbstractLifeCycle
Method to override to stop the lifecycle- Overrides:
doStop
in classAbstractLifeCycle
- Throws:
Exception
- If there was a problem stopping. Will cause a transition to FAILED state
-
checkAlias
Description copied from interface:AliasCheck
Check if an alias is allowed to be served. If anyAliasCheck
returns true then the alias will be allowed to be served, therefore any alias checker should take things like theContextHandler.getProtectedTargets()
and Security Constraints into consideration before allowing a return a value of true.- Specified by:
checkAlias
in interfaceAliasCheck
- Parameters:
pathInContext
- The path the aliased resource was created for.resource
- The aliased resourced.- Returns:
- True if the resource is OK to be served.
-
check
-
check
-
isAllowed
-
isSameFile
Deprecated. -
getPath
Deprecated. -
toString
- Overrides:
toString
in classAbstractLifeCycle
-