Class RequirePostWithGHHookPayload.Processor

  • Enclosing class:
    RequirePostWithGHHookPayload

    public static class RequirePostWithGHHookPayload.Processor
    extends org.kohsuke.stapler.interceptor.Interceptor
    • Constructor Detail

      • Processor

        public Processor()
    • Method Detail

      • shouldBePostMethod

        protected void shouldBePostMethod​(org.kohsuke.stapler.StaplerRequest request)
                                   throws InvocationTargetException
        Duplicates RequirePOST precheck. As of it can't guarantee order of multiply interceptor calls, it should implement all features of required interceptors in one class
        Throws:
        InvocationTargetException - if method os not POST
      • shouldContainParseablePayload

        protected void shouldContainParseablePayload​(Object[] arguments)
                                              throws InvocationTargetException
        Precheck arguments contains not null GHEvent and not blank payload. If any other argument will be added to root action index method, then arg count check should be changed
        Parameters:
        arguments - event and payload. Both not null and not blank
        Throws:
        InvocationTargetException - if any of preconditions is not satisfied
      • shouldProvideValidSignature

        protected void shouldProvideValidSignature​(org.kohsuke.stapler.StaplerRequest req,
                                                   Object[] args)
                                            throws InvocationTargetException
        Checks that an incoming request has a valid signature, if a hook secret is specified in the GitHub plugin config. If no hook secret is configured, then the signature is ignored.
        Parameters:
        req - Incoming request.
        Throws:
        InvocationTargetException - if any of preconditions is not satisfied
      • payloadFrom

        protected String payloadFrom​(org.kohsuke.stapler.StaplerRequest req,
                                     Object[] args)
        Extracts parsed payload from args and prepare it to calculating hash (if json - pass as is, if form - url-encode it with prefix)
        Returns:
        ready-to-hash payload