Class SecurityHandlersManager
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.encryption.SecurityHandlersManager
-
public class SecurityHandlersManager extends java.lang.Object
This class manages security handlers for the application. It follows the singleton pattern. To be usable, security managers must be registered in it. Security managers are retrieved by the application when necessary.- Version:
- $Revision: 1.3 $
- Author:
- Benoit Guillon (benoit.guillon@snv.jussieu.fr)
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SecurityHandlersManager
getInstance()
Get the singleton instance.SecurityHandler
getSecurityHandler(java.lang.String filterName)
Retrieve the appropriate SecurityHandler for a the given filter name.SecurityHandler
getSecurityHandler(ProtectionPolicy policy)
Get the security handler for the protection policy.void
registerHandler(java.lang.String filterName, java.lang.Class securityHandlerClass, java.lang.Class protectionPolicyClass)
register a security handler.
-
-
-
Method Detail
-
registerHandler
public void registerHandler(java.lang.String filterName, java.lang.Class securityHandlerClass, java.lang.Class protectionPolicyClass) throws BadSecurityHandlerException
register a security handler. If the security handler was already registered an exception is thrown. If another handler was previously registered for the same filter name or for the same policy name, an exception is thrown- Parameters:
filterName
- The name of the filter.securityHandlerClass
- Security Handler class to register.protectionPolicyClass
- Protection Policy class to register.- Throws:
BadSecurityHandlerException
- If there is an error registering the security handler.
-
getInstance
public static SecurityHandlersManager getInstance()
Get the singleton instance.- Returns:
- The SecurityHandlersManager.
-
getSecurityHandler
public SecurityHandler getSecurityHandler(ProtectionPolicy policy) throws BadSecurityHandlerException
Get the security handler for the protection policy.- Parameters:
policy
- The policy to get the security handler for.- Returns:
- The appropriate security handler.
- Throws:
BadSecurityHandlerException
- If it is unable to create a SecurityHandler.
-
getSecurityHandler
public SecurityHandler getSecurityHandler(java.lang.String filterName) throws BadSecurityHandlerException
Retrieve the appropriate SecurityHandler for a the given filter name. The filter name is an entry of the encryption dictionary of an encrypted document.- Parameters:
filterName
- The filter name.- Returns:
- The appropriate SecurityHandler if it exists.
- Throws:
BadSecurityHandlerException
- If the security handler does not exist.
-
-