Class WebhookConfiguration

java.lang.Object
hudson.model.Descriptor<GlobalConfiguration>
jenkins.model.GlobalConfiguration
io.jenkins.plugins.webhookexternalstore.WebhookConfiguration
All Implemented Interfaces:
ExtensionPoint, Describable<GlobalConfiguration>, Saveable, Loadable, OnMaster

@Extension @Symbol("webhookSecretStore") public class WebhookConfiguration extends GlobalConfiguration
Global configuration for webhook credentials provider, including Bearer token authentication.
  • Constructor Details

    • WebhookConfiguration

      public WebhookConfiguration()
  • Method Details

    • getInstance

      public static WebhookConfiguration getInstance()
      Get the singleton instance of this configuration.
      Returns:
      the WebhookConfiguration instance
    • getToken

      public Secret getToken()
      Get the token.
      Returns:
      the token as a Secret, or null if not configured
    • setToken

      @DataBoundSetter public void setToken(Secret token)
      Set the Bearer token.
      Parameters:
      token - the Bearer token to set
    • isTokenConfigured

      public boolean isTokenConfigured()
      Check if a Bearer token is configured.
      Returns:
      true if a Bearer token is configured, false otherwise
    • isValidBearerToken

      public boolean isValidBearerToken(String providedToken)
      Validate the provided Bearer token against the configured one.
      Parameters:
      providedToken - the token provided in the Authorization header
      Returns:
      true if the token is valid, false otherwise
    • getCategory

      @NonNull public GlobalConfigurationCategory getCategory()
      Overrides:
      getCategory in class Descriptor<GlobalConfiguration>
    • configure

      public boolean configure(org.kohsuke.stapler.StaplerRequest2 req, net.sf.json.JSONObject formData) throws Descriptor.FormException
      Overrides:
      configure in class GlobalConfiguration
      Throws:
      Descriptor.FormException
    • getDisplayName

      @NonNull public String getDisplayName()
      Overrides:
      getDisplayName in class Descriptor<GlobalConfiguration>