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

proxy: add cookies credentials issuer #102

Merged
merged 1 commit into from
Aug 16, 2018
Merged

Conversation

zikes
Copy link
Contributor

@zikes zikes commented Aug 14, 2018

This Credentials Issuer is very similar to the Headers one, making it very easy to put together initially, but it was complicated a bit by all cookies being stored in a single HTTP header. Unfortunately the AddCookie method of http.Header will just keep appending cookies of the same name over and over and upstream has to just decide for itself which one to pay attention to, so I had to cache incoming request's cookies, remove them all, then re-add any that aren't being handled by the CI rule. This should prevent upstream from receiving spoofed cookies. Thus far testing this has proved stable.

Cookie values are determined in the same way as headers, with text/template and a print FuncMap function:

{
    "id": "some-id",
    "upstream": {"url": "http://my-backend-service"},
    "match": { },
    "authenticators": [ ],
    "authorizer": { },
    "credentials_issuer": {
        "handler": "cookies",
        "config": {
            "cookies": {
                "user": "{{ print .Subject }}",
                "audience": "{{ print .Extra.aud }}",
                "issuer": "{{ print .Extra.iss }}",
                "arbitrary": "{{ print .Extra.some.deeply.nested.value }}"
            }
        }
    }
}

Signed-off-by: Jason Hutchinson <[email protected]>
@zikes
Copy link
Contributor Author

zikes commented Aug 14, 2018

Docs PR at ory/docs#44

@aeneasr
Copy link
Member

aeneasr commented Aug 15, 2018

Awesome, thank you! I will review tonight or tomorrow and merge :)

@aeneasr aeneasr merged commit 032d88e into ory:master Aug 16, 2018
NickUfer pushed a commit to NickUfer/oathkeeper that referenced this pull request Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants