[ 
https://issues.apache.org/jira/browse/FLINK-6608?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16015062#comment-16015062
 ] 

ASF GitHub Bot commented on FLINK-6608:
---------------------------------------

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

    https://github.com/apache/flink/pull/3928#discussion_r117146767
  
    --- Diff: 
flink-runtime/src/main/java/org/apache/flink/runtime/security/SecurityUtils.java
 ---
    @@ -230,10 +230,15 @@ private void validate() {
                }
     
                private static List<String> parseList(String value) {
    -                   if(value == null) {
    +                   if(value == null || value.isEmpty()) {
                                return Collections.emptyList();
                        }
    -                   return Arrays.asList(value.split(","));
    +
    +                   return Arrays.asList(value
    +                           .replaceAll("\\s*,\\s*", ",") // remove 
whitespaces surrounding commas
    +                           .replaceAll(",,", ",") // remove empty entries
    --- End diff --
    
    Hi, @tzulitai `.replaceAll("\\s*,\\s*", ",").replaceAll(",,", ",") ` can 
not deal with `" a, b,,, c d, e "`
    I think we can using the expression as follows:
     `str.trim().replaceAll("(\\s*,+\\s*)+", ",")` OR 
`str.replace("/^\\s+|\\s+$/g","").replaceAll("(\\s*,\\s*)+", ",");`



> Relax Kerberos login contexts parsing by trimming whitespaces in contexts list
> ------------------------------------------------------------------------------
>
>                 Key: FLINK-6608
>                 URL: https://issues.apache.org/jira/browse/FLINK-6608
>             Project: Flink
>          Issue Type: Improvement
>          Components: Configuration, Security
>            Reporter: Tzu-Li (Gordon) Tai
>            Assignee: Tzu-Li (Gordon) Tai
>            Priority: Minor
>             Fix For: 1.3.0, 1.4.0
>
>
> The Kerberos login contexts list parsing right now isn't quite user-friendly.
> The list must be provided as: {{security.kerberos.login.contexts: 
> Client,KafkaClient}}, without any whitespace in between.
> We can relax this to be more user-friendly by trimming any whitespaces in the 
> list.
> A user actually stumbled across this: 
> http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/Problems-with-Kerberos-Kafka-connection-in-version-1-2-0-td12580.html#a12589



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to