org.apache.pdfbox.pdmodel.encryption

## Class SecurityHandlerFactory

- java.lang.Object
- - org.apache.pdfbox.pdmodel.encryption.SecurityHandlerFactory

    public final class SecurityHandlerFactory
    extends 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
`static SecurityHandlerFactory` `INSTANCE` Singleton instance

### Method Summary

All Methods Instance Methods Concrete Methods
`SecurityHandler` `newSecurityHandlerForFilter(String name)` Returns a new security handler for the given Filter name, or null none is available.
`SecurityHandler` `newSecurityHandlerForPolicy(ProtectionPolicy policy)` Returns a new security handler for the given protection policy, or null none is available.
`void` `registerHandler(String name, Class<? extends SecurityHandler> securityHandler, Class<? extends ProtectionPolicy> protectionPolicy)` Registers a security handler.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### INSTANCE

    public static final SecurityHandlerFactory INSTANCE

Singleton instance

### Method Detail

#### registerHandler

    public void registerHandler(String name,
                                Class<? extends SecurityHandler> 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` - the name of the filter
  `securityHandler` - security handler class to register
  `protectionPolicy` - protection policy class to register

#### newSecurityHandlerForPolicy

    public SecurityHandler 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 newSecurityHandlerForFilter(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