Class WebhookToCredentialConverter
java.lang.Object
io.jenkins.plugins.webhookexternalstore.converters.WebhookToCredentialConverter
- All Implemented Interfaces:
ExtensionPoint
- Direct Known Subclasses:
WebhookBasicSSHUserPrivateKeyCredentialConverter,WebhookFileCredentialConverter,WebhookStringCredentialConverter,WebhookUsernamePasswordCredentialConverter
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionall()Get all registered converters.abstract booleancanConvert(String type) Determine if this converter can convert the webhook payload to a credential.abstract com.cloudbees.plugins.credentials.common.IdCredentialsconvert(WebhookPayload payload) Convert the webhook payload to a credential.static com.cloudbees.plugins.credentials.common.IdCredentialsconvertFromPayload(WebhookPayload payload) Convert a webhook payload to a credential using the appropriate converter.static WebhookToCredentialConverterFind a converter that can handle the given credential type.
-
Constructor Details
-
WebhookToCredentialConverter
public WebhookToCredentialConverter()
-
-
Method Details
-
canConvert
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
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
-