Package jenkins.security.stapler
Class StaplerDispatchValidator
java.lang.Object
jenkins.security.stapler.StaplerDispatchValidator
- All Implemented Interfaces:
org.kohsuke.stapler.DispatchValidator
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
public class StaplerDispatchValidator
extends Object
implements org.kohsuke.stapler.DispatchValidator
Validates views dispatched by Stapler. This validation consists of two phases:
- Before views are loaded, the model class is checked for
StaplerViews/StaplerFragmentsalong with whitelist entries specified by the default views whitelist and the optionally defined whitelist specified by the system propertyjenkins.security.stapler.StaplerDispatchValidator.whitelist. Then, the model class's superclass and interfaces are recursively inspected adding views and fragments that do not conflict with the views and fragments already declared. This effectively allows model classes to override parent classes. - Before views write any response output, this validator is checked to see if the view has declared itself
dispatchable using the
l:viewJelly tag. As this validation comes later, annotations will take precedence over the use or lack of a layout tag.
Validation can be disabled by setting the system property
jenkins.security.stapler.StaplerDispatchValidator.disabled=true or setting DISABLED to
true in the script console.
- Since:
- 2.176.2 / 2.186
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic booleanEscape hatch to disable dispatch validation.Fields inherited from interface org.kohsuke.stapler.DispatchValidator
DEFAULT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidallowDispatch(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) isDispatchAllowed(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) isDispatchAllowed(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, String viewName, Object node) voidrequireDispatchAllowed(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp)
-
Field Details
-
DISABLED
public static boolean DISABLEDEscape hatch to disable dispatch validation.
-
-
Constructor Details
-
StaplerDispatchValidator
public StaplerDispatchValidator()
-
-
Method Details
-
isDispatchAllowed
@CheckForNull public Boolean isDispatchAllowed(@NonNull org.kohsuke.stapler.StaplerRequest2 req, @NonNull org.kohsuke.stapler.StaplerResponse2 rsp) - Specified by:
isDispatchAllowedin interfaceorg.kohsuke.stapler.DispatchValidator
-
isDispatchAllowed
@CheckForNull public Boolean isDispatchAllowed(@NonNull org.kohsuke.stapler.StaplerRequest2 req, @NonNull org.kohsuke.stapler.StaplerResponse2 rsp, @NonNull String viewName, @CheckForNull Object node) - Specified by:
isDispatchAllowedin interfaceorg.kohsuke.stapler.DispatchValidator
-
allowDispatch
public void allowDispatch(@NonNull org.kohsuke.stapler.StaplerRequest2 req, @NonNull org.kohsuke.stapler.StaplerResponse2 rsp) - Specified by:
allowDispatchin interfaceorg.kohsuke.stapler.DispatchValidator
-
requireDispatchAllowed
public void requireDispatchAllowed(@NonNull org.kohsuke.stapler.StaplerRequest2 req, @NonNull org.kohsuke.stapler.StaplerResponse2 rsp) throws org.kohsuke.stapler.CancelRequestHandlingException - Specified by:
requireDispatchAllowedin interfaceorg.kohsuke.stapler.DispatchValidator- Throws:
org.kohsuke.stapler.CancelRequestHandlingException
-