You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/11/10 14:58:21 UTC

[GitHub] [pulsar] racorn opened a new issue #8509: Java client: cannot configure 'authParams' with PulsarClient.builder().loadConf

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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] hangc0276 commented on issue #8509: Java client: cannot configure 'authParams' with PulsarClient.builder().loadConf

Posted by GitBox <gi...@apache.org>.
hangc0276 commented on issue #8509:
URL: https://github.com/apache/pulsar/issues/8509#issuecomment-725396411


   OK, I will take a look.


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] jiazhai closed issue #8509: Java client: cannot configure 'authParams' with PulsarClient.builder().loadConf

Posted by GitBox <gi...@apache.org>.
jiazhai closed issue #8509:
URL: https://github.com/apache/pulsar/issues/8509


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] codelipenghui commented on issue #8509: Java client: cannot configure 'authParams' with PulsarClient.builder().loadConf

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on issue #8509:
URL: https://github.com/apache/pulsar/issues/8509#issuecomment-725390041


   @hangc0276 Could you please help take a look at this issue?


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] racorn commented on issue #8509: Java client: cannot configure 'authParams' with PulsarClient.builder().loadConf

Posted by GitBox <gi...@apache.org>.
racorn commented on issue #8509:
URL: https://github.com/apache/pulsar/issues/8509#issuecomment-730427858


   Also see my comment here that explains [what I think is the problem](https://github.com/apache/pulsar/issues/8109#issuecomment-724742159)


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org