Class DefaultSecurityFactory
java.lang.Object
org.tentackle.security.DefaultSecurityFactory
- All Implemented Interfaces:
SecurityFactory
@Service(SecurityFactory.class)
public class DefaultSecurityFactory
extends Object
implements SecurityFactory
Default implementation of a security factory.
- Author:
- harald
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected SecurityManagerCreates the security manager.Gets the singleton of the all permission.Gets the singleton of the edit permission.Gets the singleton of the execute permission.<T extends Permission>
TgetPermission(Class<T> iFace) Gets a request permission implementation singleton by its interface.Class<? extends Permission> getPermissionInterface(String name) Gets a permission interface by its name.Collection<Class<? extends Permission>> Gets all configured permission interfaces.Collection<Class<? extends Permission>> getPermissionInterfaces(Class<?> clazz) Gets all configured permission interfaces applicable for a class or instances of it.Gets all configured permissions.getPermissions(Class<?> clazz) Gets all configured permission instances applicable for a class or instances of it.Gets the singleton of the read permission.Gets the security manager singleton.Gets the singleton of the view permission.Gets the singleton of the write permission.permissionsToString(Set<Permission> permissions) Converts a set of permissions to a comma-separated string.Class<?>[]Converts a comma-separated string to an array of permission interfaces.Converts a comma-separated string to a set of permissions.
-
Constructor Details
-
DefaultSecurityFactory
public DefaultSecurityFactory()Creates the factory.
-
-
Method Details
-
createSecurityManager
Creates the security manager.- Returns:
- the security manager
-
getSecurityManager
Description copied from interface:SecurityFactoryGets the security manager singleton.- Specified by:
getSecurityManagerin interfaceSecurityFactory- Returns:
- the security manager
-
getPermissionInterfaces
Description copied from interface:SecurityFactoryGets all configured permission interfaces.- Specified by:
getPermissionInterfacesin interfaceSecurityFactory- Returns:
- the permission interfaces
-
getPermissions
Description copied from interface:SecurityFactoryGets all configured permissions.- Specified by:
getPermissionsin interfaceSecurityFactory- Returns:
- the permissions
-
getPermissions
Description copied from interface:SecurityFactoryGets all configured permission instances applicable for a class or instances of it.- Specified by:
getPermissionsin interfaceSecurityFactory- Parameters:
clazz- the class to be protected- Returns:
- the permission instances applicable
-
getPermissionInterfaces
Description copied from interface:SecurityFactoryGets all configured permission interfaces applicable for a class or instances of it.- Specified by:
getPermissionInterfacesin interfaceSecurityFactory- Parameters:
clazz- the class to be protected- Returns:
- the permission interfaces applicable
-
getPermissionInterface
Description copied from interface:SecurityFactoryGets a permission interface by its name.- Specified by:
getPermissionInterfacein interfaceSecurityFactory- Parameters:
name- the unique name- Returns:
- the permission, null if no such permission configured
-
getPermission
Description copied from interface:SecurityFactoryGets a request permission implementation singleton by its interface.- Specified by:
getPermissionin interfaceSecurityFactory- Type Parameters:
T- the interface type- Parameters:
iFace- the interface- Returns:
- the permission, never null
-
getAllPermission
Description copied from interface:SecurityFactoryGets the singleton of the all permission.- Specified by:
getAllPermissionin interfaceSecurityFactory- Returns:
- the all permission
-
getReadPermission
Description copied from interface:SecurityFactoryGets the singleton of the read permission.- Specified by:
getReadPermissionin interfaceSecurityFactory- Returns:
- the permission
-
getViewPermission
Description copied from interface:SecurityFactoryGets the singleton of the view permission.- Specified by:
getViewPermissionin interfaceSecurityFactory- Returns:
- the permission
-
getWritePermission
Description copied from interface:SecurityFactoryGets the singleton of the write permission.- Specified by:
getWritePermissionin interfaceSecurityFactory- Returns:
- the permission
-
getEditPermission
Description copied from interface:SecurityFactoryGets the singleton of the edit permission.- Specified by:
getEditPermissionin interfaceSecurityFactory- Returns:
- the permission
-
getExecutePermission
Description copied from interface:SecurityFactoryGets the singleton of the execute permission.- Specified by:
getExecutePermissionin interfaceSecurityFactory- Returns:
- the permission
-
stringToPermissionInterfaces
Description copied from interface:SecurityFactoryConverts a comma-separated string to an array of permission interfaces.- Specified by:
stringToPermissionInterfacesin interfaceSecurityFactory- Parameters:
str- the string- Returns:
- the permission interfaces in the same order as in str, empty array if string is null
-
stringToPermissions
Description copied from interface:SecurityFactoryConverts a comma-separated string to a set of permissions.- Specified by:
stringToPermissionsin interfaceSecurityFactory- Parameters:
str- the string- Returns:
- the permissions in the same order as in str, empty set if string is null
-
permissionsToString
Description copied from interface:SecurityFactoryConverts a set of permissions to a comma-separated string.- Specified by:
permissionsToStringin interfaceSecurityFactory- Parameters:
permissions- the permissions- Returns:
- the string, empty string if permissions is null
-