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
Modifier and TypeFieldDescriptionstatic final String
Header key being used for the payload signatures.Fields inherited from class org.kohsuke.stapler.interceptor.Interceptor
target
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioninvoke
(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.Methods inherited from class org.kohsuke.stapler.interceptor.Interceptor
setTarget
-
Field Details
-
SIGNATURE_HEADER
Header key being used for the payload signatures.- See Also:
-
-
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 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
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
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
-