Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel.encryption

public final Class SecurityHandlerFactory

extends Object
Class Inheritance
Imports
java.lang.reflect.Constructor, .InvocationTargetException, java.util.HashMap, .Map

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.
Authors
Benoit Guillon, John Hewson

Field Summary

Modifier and TypeField and Description
public static final SecurityHandlerFactory
INSTANCE

Singleton instance

private final Map<String, Class<? extends SecurityHandler<T_POLICY extends ProtectionPolicy>>>
private final Map<Class<? extends ProtectionPolicy>, Class<? extends SecurityHandler<T_POLICY extends ProtectionPolicy>>>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private SecurityHandler<ProtectionPolicy>
newSecurityHandler(Class<? extends SecurityHandler<T_POLICY extends ProtectionPolicy>> handlerClass, Class<?>[] argsClasses, Object[] args)

public SecurityHandler<ProtectionPolicy>

Returns:

a new SecurityHandler instance, or null if none is available
newSecurityHandlerForFilter
(String
the Filter name from the PDF encryption dictionary
name
)

Returns a new security handler for the given Filter name, or null none is available.

public SecurityHandler<ProtectionPolicy>

Returns:

a new SecurityHandler instance, or null if none is available
newSecurityHandlerForPolicy
(ProtectionPolicy
the protection policy for which to create a security handler
policy
)

Returns a new security handler for the given protection policy, or null none is available.

public void
registerHandler(String
the name of the filter
name
,
Class<? extends SecurityHandler<T_POLICY extends ProtectionPolicy>>
security handler class to register
securityHandler
,
Class<? extends ProtectionPolicy>
protection policy class to register
protectionPolicy
)

Registers a security handler.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
public static final SecurityHandlerFactory INSTANCE

Singleton instance

nameToHandlerback to summary
private final Map<String, Class<? extends SecurityHandler<T_POLICY extends ProtectionPolicy>>> nameToHandler
policyToHandlerback to summary
private final Map<Class<? extends ProtectionPolicy>, Class<? extends SecurityHandler<T_POLICY extends ProtectionPolicy>>> policyToHandler

Constructor Detail

SecurityHandlerFactoryback to summary
private SecurityHandlerFactory()

Method Detail

newSecurityHandlerback to summary
private SecurityHandler<ProtectionPolicy> newSecurityHandler(Class<? extends SecurityHandler<T_POLICY extends ProtectionPolicy>> handlerClass, Class<?>[] argsClasses, Object[] args)
newSecurityHandlerForFilterback to summary
public SecurityHandler<ProtectionPolicy> newSecurityHandlerForFilter(String name)

Returns a new security handler for the given Filter name, or null none is available.

Parameters
name:String

the Filter name from the PDF encryption dictionary

Returns:SecurityHandler<ProtectionPolicy>

a new SecurityHandler instance, or null if none is available

newSecurityHandlerForPolicyback to summary
public SecurityHandler<ProtectionPolicy> newSecurityHandlerForPolicy(ProtectionPolicy policy)

Returns a new security handler for the given protection policy, or null none is available.

Parameters
policy:ProtectionPolicy

the protection policy for which to create a security handler

Returns:SecurityHandler<ProtectionPolicy>

a new SecurityHandler instance, or null if none is available

registerHandlerback to summary
public void registerHandler(String name, Class<? extends SecurityHandler<T_POLICY extends ProtectionPolicy>> securityHandler, 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:String

the name of the filter

securityHandler:Class<? extends SecurityHandler<T_POLICY extends ProtectionPolicy>>

security handler class to register

protectionPolicy:Class<? extends ProtectionPolicy>

protection policy class to register