Class WebhookToCredentialConverter

java.lang.Object
io.jenkins.plugins.webhookexternalstore.converters.WebhookToCredentialConverter
All Implemented Interfaces:
ExtensionPoint
Direct Known Subclasses:
WebhookBasicSSHUserPrivateKeyCredentialConverter, WebhookFileCredentialConverter, WebhookStringCredentialConverter, WebhookUsernamePasswordCredentialConverter

public abstract class WebhookToCredentialConverter extends Object implements ExtensionPoint
Extension point for converting webhook payloads to credentials. This allows plugins to define their own credential converters for different credential types or to override the default behavior.
  • Constructor Details

    • WebhookToCredentialConverter

      public WebhookToCredentialConverter()
  • Method Details

    • canConvert

      public abstract boolean canConvert(String type)
      Determine if this converter can convert the webhook payload to a credential.
      Parameters:
      type - the credential type from the webhook payload
      Returns:
      true if this converter can handle this type
    • convert

      public abstract com.cloudbees.plugins.credentials.common.IdCredentials convert(WebhookPayload payload) throws CredentialsConvertionException
      Convert the webhook payload to a credential.
      Parameters:
      payload - the webhook payload
      Returns:
      the converted credential
      Throws:
      CredentialsConvertionException - if conversion fails
    • all

      Get all registered converters.
      Returns:
      the extension list of all converters
    • lookup

      public static WebhookToCredentialConverter lookup(String type)
      Find a converter that can handle the given credential type.
      Parameters:
      type - the credential type from the webhook payload
      Returns:
      the first converter that can handle this type, or null if none found
    • convertFromPayload

      public static com.cloudbees.plugins.credentials.common.IdCredentials convertFromPayload(WebhookPayload payload) throws CredentialsConvertionException
      Convert a webhook payload to a credential using the appropriate converter.
      Parameters:
      payload - the webhook payload
      Returns:
      the converted credential
      Throws:
      CredentialsConvertionException - if no converter found or conversion fails