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 asdownload/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 Constructor Description DownloadGateKeeper()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addKey(String path, com.atlassian.user.User user)
Deprecated.void
addKey(String path, com.atlassian.user.User user, Predicate<com.atlassian.user.User> permissionPredicate)
void
addKey(String path, String username)
Deprecated.void
addKey(String path, String username, Predicate<com.atlassian.user.User> permissionPredicate)
void
allowAnonymousAccess(String path)
Deprecated.void
allowAnonymousAccess(String path, Predicate<com.atlassian.user.User> permissionPredicate)
void
cleanAllKeys()
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.
-
-
-
Method Detail
-
addKey
@Deprecated public void addKey(String path, String username)
Deprecated.Add permission for a user to access a certain path. The path will be normalised on the way in so that anything before the text "download' is discarded. So/confluence/download/Foo
will be normalised todownload/Foo
. If the text "download" does not appear in the path, an exception will be thrown- Specified by:
addKey
in interfaceGateKeeper
- Parameters:
username
- the username of the user to be permitted.null
represents the name of the anonymous users.path
- the path being granted permission to. Must not be null.- Throws:
IllegalArgumentException
- if the path is not of the expected form
-
addKey
public void addKey(String path, String username, Predicate<com.atlassian.user.User> permissionPredicate)
- Specified by:
addKey
in interfaceGateKeeper
-
addKey
@Deprecated public void addKey(String path, com.atlassian.user.User user)
Deprecated.- Specified by:
addKey
in interfaceGateKeeper
- Parameters:
path
- the path to the resource being made accessibleuser
- the user to grant permission for.null
may be used to represent anonymous users.
-
addKey
public void addKey(String path, com.atlassian.user.User user, Predicate<com.atlassian.user.User> permissionPredicate)
- Specified by:
addKey
in interfaceGateKeeper
-
allowAnonymousAccess
@Deprecated public void allowAnonymousAccess(String path)
Deprecated.Allow all users, including the anonymous user, access to a particular path. The path will be normalised to the same rules asaddKey(java.lang.String, java.lang.String)
- Specified by:
allowAnonymousAccess
in interfaceGateKeeper
- Parameters:
path
- The resource to grant access permission to
-
allowAnonymousAccess
public void allowAnonymousAccess(String path, Predicate<com.atlassian.user.User> permissionPredicate)
- Specified by:
allowAnonymousAccess
in interfaceGateKeeper
-
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 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
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 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)
-
-