Class SecurityHandlersManager
java.lang.Object
org.apache.pdfbox.pdmodel.encryption.SecurityHandlersManager
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
Modifier and TypeMethodDescriptionstatic SecurityHandlersManager
Get the singleton instance.getSecurityHandler
(String filterName) Retrieve the appropriate SecurityHandler for a the given filter name.getSecurityHandler
(ProtectionPolicy policy) Get the security handler for the protection policy.void
registerHandler
(String filterName, Class securityHandlerClass, Class protectionPolicyClass) register a security handler.
-
Method Details
-
registerHandler
public void registerHandler(String filterName, Class securityHandlerClass, 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
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
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.
-