Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support reading in more complex values from query parameters #61

Open
joe94 opened this issue Sep 8, 2020 · 2 comments
Open

Support reading in more complex values from query parameters #61

joe94 opened this issue Sep 8, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@joe94
Copy link
Member

joe94 commented Sep 8, 2020

Context

Currently, Themis can only read in simple claim values from parameters.

For example, today you can tell Themis to "read in the value for this claim from the parameters" like so in config:

claims:
    mac_claim:
        parameter: mac

so when requesting a JWT
curl http://themis/issue?mac=1122334455566

you will get a JWT with the relevant claim:

mac_claim:112233445566

Task

Now, say we want set the value of a claim called "human" to be something like:

{
    "age": 45
    "names: ["Awesome", "Themis"]
}

To do so, the config would stay the same:

claims
    human:
        parameter: human

and on request (subject to change - more experimenting needed)
curl http:themis/issue?human.age=45&human.names=Awesome&human.names=Themis

a claim would be provided like so:

human: 
    age: 45
    names: ["Awesome","Themis"]

Notes:

  • From discussions with teammates, it seems like it will be less of an anti-pattern to keep this change localized to parameters and not HTTP headers.
@joe94 joe94 added the enhancement New feature or request label Sep 8, 2020
@johnabass
Copy link
Contributor

johnabass commented Sep 9, 2020

This would really be better as an HTTP entity body:

curl -X POST -H "Content-Type: application/json" --data-binary '{"human": {"age": 45, "names": ["Awesome", "Themis"]}}' http:themis/issue

@joe94
Copy link
Member Author

joe94 commented Sep 9, 2020

So the HTTP entity body would represent the set of claims that needs to be appended to the set of claims Themis builds for a token.

If that's the case, one option is making this the source of highest precedence (that is, body > header > parameter for value overriding). I might have the order for header and parameter flipped here...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants