Class ValidatingPushNotificationHandlerFactory

All Implemented Interfaces:

public class ValidatingPushNotificationHandlerFactory
extends Object
implements PushNotificationHandlerFactory

A push notification handler factory that constructs handlers that, to the extent possible, perform the same checks and validation steps as a real APNs server.

Because handlers constructed by this factory try to emulate the behavior of real APNs servers, callers will need to provide collections of legal device tokens and token expiration times. If clients connect TLS-based authentication, handlers will derive a list of allowed topics from the client's certificate. If using token-based authentication, callers will need to specify a collection of public keys and topics to which those keys apply.

Jon Chambers
See Also:
  • Constructor Details

    • ValidatingPushNotificationHandlerFactory

      public ValidatingPushNotificationHandlerFactory​(Map<String,​Set<String>> deviceTokensByTopic, Map<String,​Instant> expirationTimestampsByDeviceToken, Map<String,​ApnsVerificationKey> verificationKeysByKeyId, Map<ApnsVerificationKey,​Set<String>> topicsByVerificationKey)
      Constructs a new factory for push notification handlers that emulate the behavior of a real APNs server.
      deviceTokensByTopic - a map of topics to the set of device tokens that may send push notifications to that topic; may be null, in which case constructed handlers will reject all notifications
      expirationTimestampsByDeviceToken - a map of device tokens to the time at which they expire; tokens not in the map (or all tokens if the map is null or empty) will never be considered "expired"
      verificationKeysByKeyId - a map of key identifiers to the keys with that identifier; only required for token authentication, and may be null, in which case all notifications sent with token authentication will be rejected
      topicsByVerificationKey - a map of verification keys to the set of topics for which they may verify authentication tokens; only needed for token authentication, and may be null in which case all notifications sent with token authentication will be rejected
  • Method Details