Class DownloadGateKeeper

java.lang.Object
com.atlassian.confluence.security.DownloadGateKeeper
All Implemented Interfaces:
GateKeeper

public class DownloadGateKeeper extends Object implements GateKeeper
GateKeeper for the Confluence downloads directory.

Any resource granted permissions for will be normalised to remove any part of the path before the first occurrence of the text download. So /confluence/download/foo.txt will need to be checked as download/foo.txt. Attempts to grant permission to a path that doesn't contain "download" will throw an exception.

Permissions will be expired 24 hours after they are granted.

  • Constructor Details

    • DownloadGateKeeper

      public DownloadGateKeeper()
  • Method Details

    • addKey

      public void addKey(String path, String username, Predicate<? super ConfluenceUser> permissionPredicate)
      Specified by:
      addKey in interface GateKeeper
    • addKey

      public void addKey(String path, com.atlassian.user.User user, Predicate<? super ConfluenceUser> permissionPredicate)
      Specified by:
      addKey in interface GateKeeper
    • allowAnonymousAccess

      public void allowAnonymousAccess(String path, Predicate<? super ConfluenceUser> permissionPredicate)
      Specified by:
      allowAnonymousAccess in interface GateKeeper
    • isAccessPermitted

      public boolean isAccessPermitted(String path, com.atlassian.user.User user)
      Description copied from interface: GateKeeper
      Determine whether a user is permitted to access a resource.
      Specified by:
      isAccessPermitted in interface GateKeeper
      Parameters:
      path - the path to the resource being requested
      user - the user requesting permission to retrieve that resource
      Returns:
      true if the user is permitted to retrieve that resource, false otherwise
    • isAccessPermitted

      public boolean isAccessPermitted(String path, String userName)
      Description copied from interface: GateKeeper
      Determine whether a user is permitted to access a resource.
      Specified by:
      isAccessPermitted in interface GateKeeper
      Parameters:
      path - the path to the resource being requested
      userName - the name of the user requesting permission to retrieve that resource
      Returns:
      true if the user is permitted to retrieve that resource, false otherwise
    • cleanAllKeys

      public void cleanAllKeys()
      Description copied from interface: GateKeeper
      Revoke all granted permissions.
      Specified by:
      cleanAllKeys in interface GateKeeper
    • cleanAllKeysOlderThan

      public void cleanAllKeysOlderThan(long millis)