[
https://issues.apache.org/jira/browse/KNOX-1002?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16294618#comment-16294618
]
Attila Csoma commented on KNOX-1002:
------------------------------------
Hi there!
I would like to solve this issue, however I have a few questions/notes about it.
Based on the example it is not clear that a {{key1=value1,value2}} should be
parsed as {{"key1"="value1,value2"}} or like {{"key1"="value1",
"key1"="value2"}}?
Also please note, that using multiple delimiters in a string will limit usable
characters in values and in keys (or will require a more trickier/complicated
parsing method)
I think the best solution would be to use multiple {{knox.token.client.data}}
values but it is prohibited by the java servlet (if I'm correct it is not
allowed to use multiple context values with the same name and in knox
name/value parameters are converted to java servlet context values)
Currently my approach is to use a delimiter which is not allowed without any
escaping in json since in its final form the key-value pairs will packed in
this format. So now I test it with new line character. Cons: it is not os
independent so it require a trickier regexp to split between keys; pros: easy
to recognize in a random character string.
Another approach to use parameters to define delimiter strings. cons: a bit
more complicated xml files; pros: easy to customize.
Please let me know if you have any thoughts, comments or suggestions.
> Knox Token Service Client data with comma separated list of values for a key
> should be handled
> ----------------------------------------------------------------------------------------------
>
> Key: KNOX-1002
> URL: https://issues.apache.org/jira/browse/KNOX-1002
> Project: Apache Knox
> Issue Type: Bug
> Components: Server
> Reporter: J.Andreina
> Fix For: 0.15.0
>
>
> If in case in client data , a key has got list of comma separated values,
> then only the first value in the list is considered in the response.
> Should be able to differentiate between commas within values and comma used
> as delimiter for key value pair. When used escape character for comma within
> values list is also not working.
>
> For example
> Configured a comma separated list of value for a key as below
> {code}
> <name>knox.token.client.data</name>
> <value>key1=value1,value2,value3,key2=value4</value>
> {code}
> *Response is as follows:*
> {"access_token":"eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJndWVzdCIsImF1ZCI6InRva2VuYmFzZWQiLCJpc3MiOiJLTk9YU1NPIiwiZXhwIjo1MTUwMzU1MTA1Mn0.bpGoIsVTp2sgF74kyQYRRNAW9wW-nhg5_A3N40Zfb1FuK5apED-PDNfZBroMQ9wLy80egPWMqPbTVFa9vrdZ2RJgNdOfnlaE-Ey-qr7khRZQAaeb42aGUjGxnUAipZvoRbp48lWH-w3wOTq5qV6EBu0cczxqw0rxD2zZTmsk2oQ",{color:red}"key1":"value1","key2":"value4"{color},"target_url":"https://$KNOX_HOST:$KNOX_PORT/gateway/tokenbased","token_type":"Bearer
> ","expires_in":51503551052130}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)