Class RequirePostWithGHHookPayload.Processor

java.lang.Object
org.kohsuke.stapler.interceptor.Interceptor
org.jenkinsci.plugins.github.webhook.RequirePostWithGHHookPayload.Processor
Enclosing class:
RequirePostWithGHHookPayload

public static class RequirePostWithGHHookPayload.Processor extends org.kohsuke.stapler.interceptor.Interceptor
  • Field Details

  • Constructor Details

    • Processor

      public Processor()
  • Method Details

    • invoke

      public Object invoke(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, Object instance, Object[] arguments) throws IllegalAccessException, InvocationTargetException, javax.servlet.ServletException
      Specified by:
      invoke in class org.kohsuke.stapler.interceptor.Interceptor
      Throws:
      IllegalAccessException
      InvocationTargetException
      javax.servlet.ServletException
    • 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
    • returnsInstanceIdentityIfLocalUrlTest

      protected void returnsInstanceIdentityIfLocalUrlTest(org.kohsuke.stapler.StaplerRequest req) throws InvocationTargetException
      Throws:
      InvocationTargetException
    • 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