Class AuthenticatedContentVerifier


  • @Component
    public class AuthenticatedContentVerifier
    extends Object
    This is a helper class to authenticate content when payload is pushed by hub after update from publisher according to WebSub Specs Note that content only needed to be authenticated if we have passed secret in subscribe request.
    Author:
    Urvil Joshi
    • Constructor Detail

      • AuthenticatedContentVerifier

        public AuthenticatedContentVerifier()
    • Method Detail

      • verifyAuthorizedContentVerified

        public boolean verifyAuthorizedContentVerified​(javax.servlet.http.HttpServletRequest httpServletRequest,
                                                       String secret)
        This method retrive body and signature header from request and used isContentVerified(String, String, String) to authenticate the content.
        Parameters:
        httpServletRequest - request for delivery of payload.
        secret - secret send while subscribe operation.
        Returns:
        authentication result in boolean.
      • isContentVerified

        public boolean isContentVerified​(String secret,
                                         String body,
                                         String hubSignature)
        This method authenticates the content.
        Parameters:
        secret - secret used while subscribe operation.
        body - payload sent by hub.
        hubSignature - signature header sent by hub.
        Returns:
        authentication result in boolean.