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 Summary
Fields Modifier and Type Field Description static String
SIGNATURE_HEADER
Header key being used for the payload signatures.
-
Constructor Summary
Constructors Constructor Description Processor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
invoke(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, Object instance, Object[] arguments)
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)protected void
returnsInstanceIdentityIfLocalUrlTest(org.kohsuke.stapler.StaplerRequest req)
protected void
shouldBePostMethod(org.kohsuke.stapler.StaplerRequest request)
DuplicatesRequirePOST
precheck.protected void
shouldContainParseablePayload(Object[] arguments)
Precheck arguments contains not null GHEvent and not blank payload.protected void
shouldProvideValidSignature(org.kohsuke.stapler.StaplerRequest req, Object[] args)
Checks that an incoming request has a valid signature, if a hook secret is specified in the GitHub plugin config.
-
-
-
Field Detail
-
SIGNATURE_HEADER
public static final String SIGNATURE_HEADER
Header key being used for the payload signatures.- See Also:
- Developer manual, Constant Field Values
-
-
Method Detail
-
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 classorg.kohsuke.stapler.interceptor.Interceptor
- Throws:
IllegalAccessException
InvocationTargetException
javax.servlet.ServletException
-
shouldBePostMethod
protected void shouldBePostMethod(org.kohsuke.stapler.StaplerRequest request) throws InvocationTargetException
DuplicatesRequirePOST
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
-
-