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=trueor settingDISABLEDtotruein the script console.- Since:
- 2.176.2 / 2.186
-
-
Field Summary
Fields Modifier and Type Field Description static booleanDISABLEDEscape hatch to disable dispatch validation.
-
Constructor Summary
Constructors Constructor Description StaplerDispatchValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidallowDispatch(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)BooleanisDispatchAllowed(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)BooleanisDispatchAllowed(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, String viewName, Object node)voidrequireDispatchAllowed(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
-
-
-
Method Detail
-
isDispatchAllowed
@CheckForNull public Boolean isDispatchAllowed(@NonNull org.kohsuke.stapler.StaplerRequest req, @NonNull org.kohsuke.stapler.StaplerResponse rsp)
- Specified by:
isDispatchAllowedin interfaceorg.kohsuke.stapler.DispatchValidator
-
isDispatchAllowed
@CheckForNull public Boolean isDispatchAllowed(@NonNull org.kohsuke.stapler.StaplerRequest req, @NonNull org.kohsuke.stapler.StaplerResponse rsp, @NonNull String viewName, @CheckForNull Object node)
- Specified by:
isDispatchAllowedin interfaceorg.kohsuke.stapler.DispatchValidator
-
allowDispatch
public void allowDispatch(@NonNull org.kohsuke.stapler.StaplerRequest req, @NonNull org.kohsuke.stapler.StaplerResponse rsp)- Specified by:
allowDispatchin interfaceorg.kohsuke.stapler.DispatchValidator
-
requireDispatchAllowed
public void requireDispatchAllowed(@NonNull org.kohsuke.stapler.StaplerRequest req, @NonNull org.kohsuke.stapler.StaplerResponse rsp) throws org.kohsuke.stapler.CancelRequestHandlingException- Specified by:
requireDispatchAllowedin interfaceorg.kohsuke.stapler.DispatchValidator- Throws:
org.kohsuke.stapler.CancelRequestHandlingException
-
-