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 ContextHandlers resource base which is not protected by a protected target as defined by ContextHandler.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

    org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener, org.eclipse.jetty.util.component.AbstractLifeCycle.StopException

    Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle

    org.eclipse.jetty.util.component.LifeCycle.Listener
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Path
     
    protected static final LinkOption[]
     
    protected static final LinkOption[]
     

    Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

    FAILED, STARTED, STARTING, STOPPED, STOPPING
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    AllowedResourceAliasChecker(ContextHandler contextHandler, Supplier<org.eclipse.jetty.util.resource.Resource> resourceBaseSupplier)
     
    AllowedResourceAliasChecker(ContextHandler contextHandler, org.eclipse.jetty.util.resource.Resource baseResource)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    check(String pathInContext, Path path)
     
    boolean
    check(String pathInContext, org.eclipse.jetty.util.resource.Resource resource)
    Check an alias
    protected void
     
    protected void
     
    protected ContextHandler
     
    protected Path
    getPath(org.eclipse.jetty.util.resource.Resource resource)
     
    protected void
     
    protected boolean
     
    protected boolean
    isSameFile(Path path1, Path path2)
     
     

    Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

    addEventListener, getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeEventListener, setEventListeners, start, stop

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • _base

      protected Path _base
  • Constructor Details

    • AllowedResourceAliasChecker

      public AllowedResourceAliasChecker(ContextHandler contextHandler)
      Parameters:
      contextHandler - the context handler to use.
    • AllowedResourceAliasChecker

      public AllowedResourceAliasChecker(ContextHandler contextHandler, org.eclipse.jetty.util.resource.Resource baseResource)
    • AllowedResourceAliasChecker

      public AllowedResourceAliasChecker(ContextHandler contextHandler, Supplier<org.eclipse.jetty.util.resource.Resource> resourceBaseSupplier)
  • Method Details

    • getContextHandler

      protected ContextHandler getContextHandler()
    • initialize

      protected void initialize()
    • doStart

      protected void doStart() throws Exception
      Overrides:
      doStart in class org.eclipse.jetty.util.component.AbstractLifeCycle
      Throws:
      Exception
    • doStop

      protected void doStop() throws Exception
      Overrides:
      doStop in class org.eclipse.jetty.util.component.AbstractLifeCycle
      Throws:
      Exception
    • check

      public boolean check(String pathInContext, org.eclipse.jetty.util.resource.Resource resource)
      Description copied from interface: ContextHandler.AliasCheck
      Check an alias
      Specified by:
      check in interface ContextHandler.AliasCheck
      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

      protected boolean check(String pathInContext, Path path)
    • isAllowed

      protected boolean isAllowed(Path path)
    • isSameFile

      protected boolean isSameFile(Path path1, Path path2)
    • getPath

      protected Path getPath(org.eclipse.jetty.util.resource.Resource resource)
    • toString

      public String toString()
      Overrides:
      toString in class org.eclipse.jetty.util.component.AbstractLifeCycle