You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by "Sandor Molnar (Jira)" <ji...@apache.org> on 2022/09/21 12:55:00 UTC

[jira] [Comment Edited] (KNOX-2805) getUserTokens api should return all tokens which are matching either of the same metadata name passed as query param

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

Sandor Molnar edited comment on KNOX-2805 at 9/21/22 12:54 PM:
---------------------------------------------------------------

[~andreina] - Thanks for filing this JIRA. As discussed offline, the {{getUserTokens}} API returns tokens if _any_ of the supplied metadata exists for the given token. Metadata values may or may not be matched: you can either use the {{*}} wildcard to match all metadata values with a given name or you can further filter the stored metadata information by specifying the desired value.

+For instance:+
[https://YOUR_KNOX_GATEWAY_DEPLOYMENT/knoxtoken/api/v1/token/getUserTokens?userName=admin&md_name=myName&my_age=25|https://your_knox_gateway_deployment/knoxtoken/api/v1/token/getUserTokens?userName=admin&md_name=myName&my_age=25] will return only those previously generated tokens for the {{admin}} which has any of {{name=myName}} OR {{age=25}} metadata.

Based on this and the samples you gave me above, please find the expected results for different metadata queries here:
||Metadata||Expected result||
|md_Name=reina|token1|
|md_Name=mary|token2 and token3|
|md_Score=100|token2|
|md_Name=mary&md_Score=20|token2 and token3|
|md_Name=mary&md_Name=reina|token1, token2 and token3|
|md_Name=*|token1, token2 and token3|
|md_Uknown=*|Empty list|


was (Author: smolnar):
[~andreina] - Thanks for filing this JIRA. As discussed offline, the {{getUserTokens}} API returns tokens if _any_ of the supplied metadata exists for the given token. Metadata values may or may not be matched: you can either use the {{*}} wildcard to match all metadata values with a given name or you can further filter the stored metadata information by specifying the desired value.

+For instance:+
[https://YOUR_KNOX_GATEWAY_DEPLOYMENT/knoxtoken/api/v1/token/getUserTokens?userName=admin&md_name=myName&my_age=25|https://your_knox_gateway_deployment/knoxtoken/api/v1/token/getUserTokens?userName=admin&md_name=myName&my_age=25] will return only those previously generated tokens for the {{admin}} which has any of {{name=myName}} OR {{age=25}} metadata.

Based on this and the samples you gave me above, please find the expected results for different metadata queries here:
||Metadata||Expected result||
|md_Name=reina|token1|
|md_Name=mary|token2 and token3|
|md_Score=100|token2|
|md_Name=mary&md_Score=20|token3|
|md_Name=mary&md_Name=reina|token1, token2 and token3|
|md_Name=*|token1, token2 and token3|
|md_Uknown=*|Empty list|

> getUserTokens api should return all tokens which are matching either of the same metadata name passed as query param
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: KNOX-2805
>                 URL: https://issues.apache.org/jira/browse/KNOX-2805
>             Project: Apache Knox
>          Issue Type: Bug
>    Affects Versions: 1.3.0
>            Reporter: J.Andreina
>            Assignee: Sandor Molnar
>            Priority: Major
>
> *Steps:*
> 1. Create token1 with md_Name=reina&md_Score=50
> 2. Create token2 with md_Name=mary&md_Score=100
> 3. Create token3 with md_Name=mary&md_Score=20&md_Grade=A
> *Scenario 1:*
> Fetch token with "md_Name=mary&md_Score=100"
> Result : returns token2 and token3
> *Scenario 2:*
> Fetch token with "md_Name=mary&md_Name=reina"
> Result : return token2 and token3
> *Expectation:*
> if the api returns all matching tokens of any of the mentioned metadata in query param , then i would expect scenario2 to return me token1,2,3 though the passed metadata name in query param ("Name") is same but with different values. But here it doesnt return token1



--
This message was sent by Atlassian Jira
(v8.20.10#820010)