racorn opened a new issue, #8509:
URL: https://github.com/apache/pulsar/issues/8509

   `ClientBuilder loadConf(Map<String, Object> config)` does not support 
`authParams` nor `authParamMap` anymore.
   
   Most likely this was broken by #8110 
   
   **Possible fix:**
   
   Add annotation:
   ```java
   @Target({ ElementType.ANNOTATION_TYPE, ElementType.FIELD, ElementType.METHOD 
})
   @Retention(RetentionPolicy.RUNTIME)
   @JacksonAnnotationsInside
   @JsonSerialize(using = SecretsSerializer.class)
   public @interface Secret {
   }
   ```
   
   Serializer:
   
   ```java
   public class SecretsSerializer extends JsonSerializer<Object> {
   
       @Override
       public void serialize(final Object value, final JsonGenerator 
jsonGenerator, final SerializerProvider serializerProvider)
               throws IOException, JsonProcessingException {
           if (value == null) {
               serializerProvider.defaultSerializeNull(jsonGenerator);
               return;
           }
           Object output = serializerProvider.getActiveView() == 
Views.Internal.class ? value : "*****";
           jsonGenerator.writeObject(output);
   
       }
   }
   ```
   And view:
   ```java
   public interface Views {
       interface Internal {
       }
   }
   ```
   
   Then in `ClientConfigurationData`
   ```java
   @Secret
   private String authParams;
   @Secret
   private Map<String, String> authParamMap;
   ```
   and in `ConfigurationDataUtils.loadData`
   ```java
   mapper.writerWithView(Views.Internal.class).writeValueAsString ...
   ```
   
   **Version**: 2.6.2


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to