Class DownloadGateKeeper
java.lang.Object
com.atlassian.confluence.security.DownloadGateKeeper
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addKey
(String path, com.atlassian.user.User user, Predicate<? super ConfluenceUser> permissionPredicate) void
addKey
(String path, String username, Predicate<? super ConfluenceUser> permissionPredicate) void
allowAnonymousAccess
(String path, Predicate<? super ConfluenceUser> permissionPredicate) void
Revoke all granted permissions.void
cleanAllKeysOlderThan
(long millis) boolean
isAccessPermitted
(String path, com.atlassian.user.User user) Determine whether a user is permitted to access a resource.boolean
isAccessPermitted
(String path, String userName) Determine whether a user is permitted to access a resource.
-
Constructor Details
-
DownloadGateKeeper
public DownloadGateKeeper()
-
-
Method Details
-
addKey
public void addKey(String path, String username, Predicate<? super ConfluenceUser> permissionPredicate) - Specified by:
addKey
in interfaceGateKeeper
-
addKey
public void addKey(String path, com.atlassian.user.User user, Predicate<? super ConfluenceUser> permissionPredicate) - Specified by:
addKey
in interfaceGateKeeper
-
allowAnonymousAccess
public void allowAnonymousAccess(String path, Predicate<? super ConfluenceUser> permissionPredicate) - Specified by:
allowAnonymousAccess
in interfaceGateKeeper
-
isAccessPermitted
Description copied from interface:GateKeeper
Determine whether a user is permitted to access a resource.- Specified by:
isAccessPermitted
in interfaceGateKeeper
- Parameters:
path
- the path to the resource being requesteduser
- the user requesting permission to retrieve that resource- Returns:
- true if the user is permitted to retrieve that resource, false otherwise
-
isAccessPermitted
Description copied from interface:GateKeeper
Determine whether a user is permitted to access a resource.- Specified by:
isAccessPermitted
in interfaceGateKeeper
- Parameters:
path
- the path to the resource being requesteduserName
- 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 interfaceGateKeeper
-
cleanAllKeysOlderThan
public void cleanAllKeysOlderThan(long millis)
-