Class WebhookEndpoint

java.lang.Object
org.iplass.mtp.webhook.endpoint.WebhookEndpoint

public class WebhookEndpoint extends Object
The class representing the destination of Webhook.
  • Constructor Details

    • WebhookEndpoint

      public WebhookEndpoint(String url)
      Create the WebhookEndpoint that can be set to Webhook.
      Parameters:
      url - The URL of the destination
    • WebhookEndpoint

      public WebhookEndpoint(String url, String hmacKey)
      Create the WebhookEndpoint that can be set to Webhook.
      Parameters:
      url - The URL of the destination
      hmacKey - The secret key to generate HMAC hashes
    • WebhookEndpoint

      public WebhookEndpoint(String url, WebhookAuthenticationType headerAuthorizationType, String headerAuthorizationContent)
      Create the WebhookEndpoint that can be set to Webhook.
      Parameters:
      url - The URL of the destination
      headerAuthorizationType - Type of the content in Authorization Header
      headerAuthorizationContent - Content in Authorization Header, if it is BASIC, it should be a string in format of username:password
    • WebhookEndpoint

      public WebhookEndpoint(String url, WebhookAuthenticationType headerAuthorizationType, String headerAuthorizationContent, String hmacKey)
      Create the WebhookEndpoint that can be set to Webhook.
      Parameters:
      url - The URL of the destination
      headerAuthorizationType - Type of the content in Authorization Header
      headerAuthorizationContent - Content in Authorization Header, if it is BASIC, it should be a string in format of username:password
      hmacKey - The secret key to generate HMAC hashes
  • Method Details

    • setBasicAuthorization

      public void setBasicAuthorization(String userName, String password)
      Set the BASIC Authorization. the existing Authorization content will be dropped.
      Parameters:
      userName - User name
      password - Password
    • setBearerAuthorization

      public void setBearerAuthorization(String bearerToken)
      Set the BEARER Authorization. the existing Authorization content will be dropped.
      Parameters:
      bearerToken - BEARER token
    • setCustomAuthorization

      public void setCustomAuthorization(String schemeName, String customToken)
      Set the Custom Authorization. the existing Authorization content will be dropped.
      Parameters:
      schemeName - The scheme name to be used in Authorization header
      customToken - Custom Token
    • getUrl

      public String getUrl()
      Get the Url.
    • setUrl

      public void setUrl(String url)
      Set the custom headers.
      Parameters:
      url - URL
    • getHeaderAuthorizationType

      public WebhookAuthenticationType getHeaderAuthorizationType()
      Get the type used in Authorization header.
    • setHeaderAuthorizationType

      public void setHeaderAuthorizationType(WebhookAuthenticationType headerAuthorizationType)
      Set the type used in Authorization header.
      Parameters:
      headerAuthorizationType - Type
    • getHeaderAuthorizationContent

      public String getHeaderAuthorizationContent()
      Get the content from Authrization header.If it is BASIC, it will be in the format of username:password.
    • setHeaderAuthorizationContent

      public void setHeaderAuthorizationContent(String headerAuthorizationContent)
      Set the content from Authrization header.If it is BASIC, it Should be in the format of username:password.
      Parameters:
      headerAuthorizationContent - Content
    • getHmacKey

      public String getHmacKey()
      Get the HMAC secret key.
    • setHmacKey

      public void setHmacKey(String hmacKey)
      Set the HMAC secret key.
      Parameters:
      hmacKey - Secret key
    • getHmacHashHeader

      public String getHmacHashHeader()
      Get the header name for HMAC Verification.
    • setHmacHashHeader

      public void setHmacHashHeader(String hmacHashHeader)
      Set the header name for HMAC Verification.
      Parameters:
      hmacHashHeader - Header name
    • getHeaderAuthCustomTypeName

      public String getHeaderAuthCustomTypeName()
      Set the custom headers.
    • setHeaderAuthCustomTypeName

      public void setHeaderAuthCustomTypeName(String headerAuthCustomTypeName)
      Set the custom Token Scheme. It is the "BASIC" part of [Authorization: BASIC "username:password"]
      Parameters:
      headerAuthCustomTypeName - The scheme name to be used in Authorization header