Class CommonExtensionsValidatorCallback

java.lang.Object
org.apache.kafka.common.security.oauthbearer.CommonExtensionsValidatorCallback
All Implemented Interfaces:
Callback, Contextable
Direct Known Subclasses:
OAuthBearerExtensionsValidatorCallback, PreTokenValidationExtensionsValidatorCallback

public abstract class CommonExtensionsValidatorCallback extends Object implements Callback, Contextable
  • Field Details

  • Constructor Details

    • CommonExtensionsValidatorCallback

      public CommonExtensionsValidatorCallback(SaslExtensions extensions, io.confluent.kafka.util.ClientContext context)
    • CommonExtensionsValidatorCallback

      public CommonExtensionsValidatorCallback(SaslExtensions extensions)
  • Method Details

    • context

      public io.confluent.kafka.util.ClientContext context()
      Specified by:
      context in interface Contextable
    • inputExtensions

      public SaslExtensions inputExtensions()
      Returns:
      SaslExtensions consisting of the unvalidated extension names and values that were sent by the client
    • validatedExtensions

      public Map<String,String> validatedExtensions()
      Returns:
      an unmodifiable Map consisting of the validated and recognized by the server extension names and values
    • invalidExtensions

      public Map<String,String> invalidExtensions()
      Returns:
      An immutable Map consisting of the name->error messages of extensions which failed validation
    • ignoredExtensions

      public Map<String,String> ignoredExtensions()
      Returns:
      An immutable Map consisting of the extensions that have neither been validated nor invalidated
    • error

      public void error(String invalidExtensionName, String errorMessage)
      Set the error value for a specific extension key-value pair if validation has failed
      Parameters:
      invalidExtensionName - the mandatory extension name which caused the validation failure
      errorMessage - error message describing why the validation failed
    • errors

      public void errors(Map<String,String> invalidExtensionNameAndErrorMessage)
      Set the error value for a specific extension key-value pair if validation has failed
      Parameters:
      invalidExtensionNameAndErrorMessage - the mandatory extension name and message which caused the validation failure
    • errorMessage

      public String errorMessage()
    • errorMessage

      public void errorMessage(String errorMessage)
    • valid

      public void valid(String extensionName)
      Validates a specific extension in the original inputExtensions map
      Parameters:
      extensionName - - the name of the extension which was validated
    • valid

      public void valid(String extensionName, String extensionValue)
      Validates a specific extension in the original inputExtensions map. Adds entries in validatedExtensions for valid extension.
      Parameters:
      extensionName - - the name of the extension which was validated
      extensionValue - - the value of the extension which was validated, or some message
    • valid

      public void valid(String extensionName, Map<String,Object> identityPoolClaims)
      Validates a specific extension in the original inputExtensions map. For each item in identity pool claims adds entry extentionname:map.key = map.value in validatedExtensions
      Parameters:
      extensionName - - the name of the extension which was validated
      identityPoolClaims - -OAuthBearerExtensionsValidatorCallback pool claims corresponding to identity pool id
    • addValidated

      public void addValidated(String extensionName, String extensionValue)
      Adds a specific extension to the validated extensions validatedExtensions map.
      Parameters:
      extensionName - - the name of the extension
      extensionValue - - the value of the extension
    • addValidated

      public void addValidated(String extensionName, Map<String,Object> identityPoolClaims)
      Adds a specific extension to the validated extensions validatedExtensions map. For each item in identity pool claims, adds entry extentionname-map.key = map.value in validatedExtensions
      Parameters:
      extensionName - - the name of the extension
      identityPoolClaims - - OAuthBearerExtensionsValidatorCallback pool claims corresponding to union of pools auth
    • data

      public void data(String key, String value)
      Add any extra information apart from extensions. For example, we can add providerId for a poolId so that it can be available for audit logging even if there is an error. ProviderId is not passed as an extension and neither is it invalid. Hence, it makes sense to have separate hashmap for this kind of information.
      Parameters:
      key - String name of the key entry
      value - String value for the data entry
    • data

      public Map<String,String> data()