public class SecurityWebManager
extends java.lang.Object
For direct file retrieval, the process might work as follows:
The user types something like: http://127.0.0.1:8080/htmlFolder/file.html
The system parses this and gets 'htmlFolder/file.html' as the instruction.
It retrieves all of its allowed base directories, adds this and then checks
if there is an existing file with that name.
If for example, the default C:/DCS/web folder is assumed, it will check if
C:/DCS/web/htmlFolder/file.html allowed. If however, you also add something like
C:/Users/You/Documents as allowed, then it can look for a file at
C:/Users/You/Documents/htmlFolder/file.html as well. The first match will be returned
so duplication is not advised.
There is also a websearch
folder inside the web
folder. You can use this
to place text documents that you allow to be searched for and analysed for actual content
to be matched to. It might be useful for distributed queries, for example.
The System security manager might change read/write permissions on this.
Modifier and Type | Method and Description |
---|---|
boolean |
addPermission(java.lang.String type,
java.lang.String key,
java.lang.String value)
Add a new permission of the specified type.
|
Permission |
checkPermission(java.lang.String type,
java.lang.String key,
java.lang.String value)
Check if the specified permission allowed.
|
void |
clearPermissions(java.lang.String permissionsType)
Clear the permissions list for the specified permissions type.
|
static SecurityWebManager |
getInstance()
Get the instance of the security manager.
|
java.util.HashMap<java.lang.String,PermissionsList<java.lang.String,?>> |
getLocalPermissions()
Get the list of permissions for this security/web manager only.
|
boolean |
removePermission(java.lang.String type,
java.lang.String key,
java.lang.String value)
Remove a permission of the specified type.
|
static void |
setInstance(SecurityWebManager swManager)
Set the instance of the security manager.
|
public static SecurityWebManager getInstance()
public static void setInstance(SecurityWebManager swManager)
swManager
- the new security web manager.public void clearPermissions(java.lang.String permissionsType)
permissionsType
- the permissions type.public Permission checkPermission(java.lang.String type, java.lang.String key, java.lang.String value)
type
- the permission type. Currently only MetaConst.FILEPERMISSION.key
- the permission key or description. For a file access, for example,
it is the additional file path that gets added to the default folder locations.value
- the permission value. For a folder access for example, it is
the access right - read / write, etc.public boolean addPermission(java.lang.String type, java.lang.String key, java.lang.String value)
type
- the permission type. Currently only MetaConst.FILEPERMISSION.key
- the permission key or description. For a folder access for example,
it is the folder path.value
- the permission value. For a folder access for example, it is
the access right - read / write, etc.public boolean removePermission(java.lang.String type, java.lang.String key, java.lang.String value)
type
- the permission type. Currently only MetaConst.FILEPERMISSION.key
- the permission key or description. For a folder access for example,
it is the folder path.value
- the permission value. For a folder access for example, it is
the read / write access permission, etc. MetaConst.ALL means to remove the
permission completely and not just a specific case.public java.util.HashMap<java.lang.String,PermissionsList<java.lang.String,?>> getLocalPermissions()