Package com.pd4ml.pdf.encryption
Class SecurityHandlerFactory
- java.lang.Object
-
- com.pd4ml.pdf.encryption.SecurityHandlerFactory
-
public final class SecurityHandlerFactory extends java.lang.Object
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.- Author:
- Benoit Guillon, John Hewson
-
-
Field Summary
Fields Modifier and Type Field Description static SecurityHandlerFactory
INSTANCE
Singleton instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SecurityHandler<ProtectionPolicy>
newSecurityHandlerForFilter(java.lang.String name)
Returns a new security handler for the given Filter name, or null none is available.SecurityHandler<ProtectionPolicy>
newSecurityHandlerForPolicy(ProtectionPolicy policy)
Returns a new security handler for the given protection policy, or null none is available.void
registerHandler(java.lang.String name, java.lang.Class<? extends SecurityHandler> securityHandler, java.lang.Class<? extends ProtectionPolicy> protectionPolicy)
Registers a security handler.
-
-
-
Field Detail
-
INSTANCE
public static final SecurityHandlerFactory INSTANCE
Singleton instance
-
-
Method Detail
-
registerHandler
public void registerHandler(java.lang.String name, java.lang.Class<? extends SecurityHandler> securityHandler, java.lang.Class<? extends ProtectionPolicy> protectionPolicy)
Registers 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:
name
- the name of the filtersecurityHandler
- security handler class to registerprotectionPolicy
- protection policy class to register
-
newSecurityHandlerForPolicy
public SecurityHandler<ProtectionPolicy> newSecurityHandlerForPolicy(ProtectionPolicy policy)
Returns a new security handler for the given protection policy, or null none is available.- Parameters:
policy
- the protection policy for which to create a security handler- Returns:
- a new SecurityHandler instance, or null if none is available
-
newSecurityHandlerForFilter
public SecurityHandler<ProtectionPolicy> newSecurityHandlerForFilter(java.lang.String name)
Returns a new security handler for the given Filter name, or null none is available.- Parameters:
name
- the Filter name from the PDF encryption dictionary- Returns:
- a new SecurityHandler instance, or null if none is available
-
-