Github user ijokarumawak commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2652#discussion_r186341332
  
    --- Diff: 
nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/main/java/org/apache/nifi/websocket/jetty/JettyWebSocketClient.java
 ---
    @@ -103,6 +107,35 @@
                 .defaultValue("10 sec")
                 .build();
     
    +    public static final PropertyDescriptor USER_NAME = new 
PropertyDescriptor.Builder()
    +            .name("user-name")
    +            .displayName("User Name")
    +            .description("The user name for Basic Authentication.")
    +            .required(false)
    +            
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
    +            .addValidator(StandardValidators.NON_EMPTY_EL_VALIDATOR)
    +            .build();
    +
    +    public static final PropertyDescriptor USER_PASSWORD = new 
PropertyDescriptor.Builder()
    +            .name("user-password")
    +            .displayName("User Password")
    +            .description("The user password for Basic Authentication.")
    +            .required(false)
    +            
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
    +            .addValidator(StandardValidators.NON_EMPTY_EL_VALIDATOR)
    +            .sensitive(true)
    +            .build();
    +
    +    public static final PropertyDescriptor AUTH_CHARSET = new 
PropertyDescriptor.Builder()
    +            .name("authentication-charset")
    +            .displayName("Authentication Header Charset")
    +            .description("The charset for Basic Authentication header 
base64 string.")
    +            .required(true)
    +            
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
    +            .addValidator(StandardValidators.NON_EMPTY_EL_VALIDATOR)
    +            .defaultValue("US-ASCII")
    --- End diff --
    
    I chose 'US-ASCII' from following spec. 
    
    > User-ids or passwords containing characters outside the US-ASCII 
character repertoire will cause interoperability issues, unless both 
communication partners agree on what character encoding scheme is to be used.  
Servers can use the new 'charset' parameter (Section 2.1) to indicate a 
preference of "UTF-8", increasing the probability that clients will switch to 
that encoding.
    https://tools.ietf.org/html/rfc7617
    
    Since UTF-8 is a superset of US-ASCII, UTF-8 can be more preferable default 
if we assume most server implementations uses UTF-8. However, when I looked at 
Jetty server side, it uses ISO_8859_1.
    
    So, I prefer using US-ASCII as default. It make people to consider which 
charset they need to use to match with the server's expectation, in case their 
username/password need to support characters out of US-ASCII range. Making 
UTF-8 as default would make people think such characters are supported by 
default.



---

Reply via email to