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

Add support to pass tokens #104

Merged
merged 41 commits into from
May 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
9edb234
Add accesstoken and idtoken to user struct.
artagel Apr 14, 2019
feb4991
Add accesstoken and idtoken config option to headers.
artagel Apr 14, 2019
6663a63
Fix deprecated nocontext call for oauth2.
artagel Apr 14, 2019
c85238a
Add accesstoken and idtoken config option to example config.
artagel Apr 14, 2019
c39cdc8
Update nginx info in the readme.
artagel Apr 14, 2019
bcd18a0
Move tokens from user to jwt.
artagel Apr 17, 2019
ca02f10
Add tests for tokens in jwt.
artagel Apr 17, 2019
46226ff
Rework cookie handling to split and reassemble cookies if they are ov…
artagel Apr 18, 2019
68b64b7
Update warning message.
artagel Apr 18, 2019
442d3ac
Set warning to be more specific.
artagel Apr 18, 2019
0e554fb
Fix areas where errors weren't handled.
artagel Apr 21, 2019
f6b6b1c
Fix error with template path.
artagel Apr 22, 2019
e2d6005
Merge pull request #1 from vouch/master
artagel Apr 22, 2019
33ac20f
Merge branch 'master' into split_cookies
artagel Apr 22, 2019
f7aeb76
Merge pull request #3 from artagel/split_cookies
artagel Apr 22, 2019
6461880
Merge branch 'master' into add_support_to_pass_tokens
artagel Apr 22, 2019
dcf8201
Add header claims to cfg
artagel Apr 13, 2019
0c33884
Add custom claims to JWT
artagel Apr 13, 2019
2ced6e1
Remove redunant claim object. Fix Claim to be a map of strings.
artagel Apr 13, 2019
aa2a4a2
Properly add claims to user object.
artagel Apr 13, 2019
e24bd02
Add support for grabbing claims from the return of getuserinfo functi…
artagel Apr 13, 2019
cc27f86
Fix function argument order for updated customclaim support.
artagel Apr 13, 2019
ee16254
Create the JWT token with newly added customClaims.
artagel Apr 13, 2019
7d6ae61
Add new config option 'claimheader'
artagel Apr 13, 2019
27cd957
Make ClaimHeader default to X-Vouch-IdP-Claims-
artagel Apr 13, 2019
5d7b562
Add claims to headers.
artagel Apr 13, 2019
4d58a80
Rework customClaims variable into a struct to be reusable and passabl…
artagel Apr 13, 2019
5ce18bd
Add some useful logging.
artagel Apr 13, 2019
ca7d295
Update README and config example to include custom claim support.
artagel Apr 13, 2019
8d5f25f
Ensure config example comments out the optional param for header cust…
artagel Apr 13, 2019
06a0c49
Update jwt tests to support claims.
artagel Apr 13, 2019
346ac40
fix #115 state variable alpha num
bnfinet May 3, 2019
c98e490
Merge branch 'master' into artagel-allow_users_to_store_claims_in_JWT
bnfinet May 3, 2019
f85c582
Make client_secret optional for oidc and adfs. Keycloak (generic oidc…
artagel Mar 28, 2019
229f735
Merge branch 'artagel-make_client_secret_optional'
bnfinet May 3, 2019
265ee5d
Merge branch 'general_fixes_and_unit_testing' of git://github.com/art…
bnfinet May 3, 2019
85c593f
#113 rename variables, formatting
bnfinet May 3, 2019
5939a7e
Merge branch 'add_support_to_pass_tokens' of git://github.com/artagel…
bnfinet May 3, 2019
b1bb31d
#104 use 1of3 2of3 4of3 for multipart cookies
bnfinet May 3, 2019
06ab191
#104 and #109 large cookies full of tokens
bnfinet May 22, 2019
5930747
#109 test cookie split
bnfinet May 22, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ server {
# optionally add X-Vouch-User as returned by Vouch Proxy along with the request
auth_request_set $auth_resp_x_vouch_user $upstream_http_x_vouch_user;

# optionally add X-Vouch-IdP-Claims-* custom claims you are tracking
# auth_request_set $auth_resp_x_vouch_idp_claims_groups $upstream_http_x_vouch_idp_claims_groups;
# auth_request_set $auth_resp_x_vouch_idp_claims_given_name $upstream_http_x_vouch_idp_claims_given_name;
# optinally add X-Vouch-IdP-AccessToken or X-Vouch-IdP-IdToken
# auth_request_set $auth_resp_x_vouch_idp_accesstoken $upstream_http_x_vouch_idp_accesstoken;
# auth_request_set $auth_resp_x_vouch_idp_idtoken $upstream_http_x_vouch_idp_idtoken;

# these return values are used by the @error401 call
auth_request_set $auth_resp_jwt $upstream_http_x_vouch_jwt;
auth_request_set $auth_resp_err $upstream_http_x_vouch_err;
Expand All @@ -81,11 +88,19 @@ server {
location / {
# forward authorized requests to your service protectedapp.yourdomain.com
proxy_pass http://127.0.0.1:8080;
# you may need to set
# you may need to set these variables in this block as per https://github.com/vouch/vouch-proxy/issues/26#issuecomment-425215810
# auth_request_set $auth_resp_x_vouch_user $upstream_http_x_vouch_user
# in this bock as per https://github.com/vouch/vouch-proxy/issues/26#issuecomment-425215810
# auth_request_set $auth_resp_x_vouch_idp_claims_groups $upstream_http_x_vouch_idp_claims_groups;
# auth_request_set $auth_resp_x_vouch_idp_claims_given_name $upstream_http_x_vouch_idp_claims_given_name;

# set user header (usually an email)
proxy_set_header X-Vouch-User $auth_resp_x_vouch_user;
# optionally pass any custom claims you are tracking
# proxy_set_header X-Vouch-IdP-Claims-Groups $auth_resp_x_vouch_idp_claims_groups;
# proxy_set_header X-Vouch-IdP-Claims-Given_Name $auth_resp_x_vouch_idp_claims_given_name;
# optionally pass the accesstoken or idtoken
# proxy_set_header X-Vouch-IdP-AccessToken $auth_resp_x_vouch_idp_accesstoken;
# proxy_set_header X-Vouch-IdP-IdToken $auth_resp_x_vouch_idp_idtoken;
}
}

Expand Down
50 changes: 41 additions & 9 deletions config/config.yml_example
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@
vouch:
# logLevel: debug
logLevel: info

# testing - force all 302 redirects to be rendered as a webpage with a link
# if you're having problems, turn on testing
testing: true

listen: 0.0.0.0
port: 9090

# domains:
# domains -
# each of these domains must serve the url https://vouch.$domains[0] https://vouch.$domains[1] ...
# so that the cookie which stores the JWT can be set in the relevant domain
# you usually *don't* want to list every individual website that will be protected
Expand All @@ -31,15 +36,15 @@ vouch:
# You will need to direct people to the Vouch Proxy login page from your application.
# publicAccess: false

# whiteList (optional) allows only the listed usernames
# whiteList - (optional) allows only the listed usernames
# usernames are usually email addresses (google, most oidc providers) or login/username for github and github enterprise
whiteList:
- bob@yourdomain.com
- alice@yourdomain.com
- joe@yourdomain.com

jwt:
# secret: a random string used to cryptographically sign the jwt
# secret - a random string used to cryptographically sign the jwt
# Vouch Proxy complains if the string is less than 44 characters (256 bits as 32 base64 bytes)
# if the secret is not set here then..
# look for the secret in `./config/secret`
Expand All @@ -66,7 +71,7 @@ vouch:
session:
# name of session variable stored locally
name: VouchSession
# key: a cryptographic string used to store the session variable
# key - a cryptographic string used to store the session variable
# if the key is not set here then it is generated at startup and stored in memory
# Vouch Proxy complains if the string is less than 44 characters (256 bits as 32 base64 bytes)
# you only want to set this if you're running multiple user facing vouch.yourdomain.com instances
Expand All @@ -78,15 +83,42 @@ vouch:
querystring: access_token
redirect: X-Vouch-Requested-URI

# GENERAL WARNING ABOUT claims AND tokens
# all of these config elements can cause performance impacts due to the amount of information being
# moved around. They will get added to the Vouch cookie and (possibly) make it large. The Vouch cookie will
# get split up into several cookies. Every request will process the cookies in order to extract and create the
# additional headers which get returned. But if you need it, you need it.
# With large cookies and headers it will require additional nginx config to open up the buffers a bit..
# see `large_client_header_buffers` http://nginx.org/en/docs/http/ngx_http_core_module.html#large_client_header_buffers
# and `proxy_buffer_size` http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffer_size

# claims - a list of claims that will be stored in the JWT and passed down to applications via headers
# By default claims are sent down as headers with a prefix of X-Vouch-IdP-Claims-ClaimKey
# Only when a claim is found in the user's info will the header exist. This is optional. These are case sensitive.
claims:
- groups
- given_name
# these will result in two headers being passed back to nginx
# X-Vouch-IdP-Claims-groups
# X-Vouch-IdP-Claims-given_name

# claimheader - Customizable claim header prefix (instead of default `X-Vouch-IdP-Claims-`)
# claimheader: My-Custom-Claim-Prefix

# accesstoken - Pass the user's access token from the provider. This is useful if you need to pass the IdP token to a downstream
# application. This is optional.
# accesstoken: X-Vouch-IdP-AccessToken
# idtoken - Pass the user's Id token from the provider. This is useful if you need to pass this token to a downstream
# application. This is optional.
# idtoken: X-Vouch-IdP-IdToken

db:
file: data/vouch_bolt.db

# testing: force all 302 redirects to be rendered as a webpage with a link
testing: true
# test_url: add this URL to the page which vouch displays
# test_url - add this URL to the page which vouch displays
test_url: http://yourdomain.com
# webapp: WIP for web interface to vouch (mostly logs)
webapp: true
# webapp - WIP for web interface to vouch (mostly logs)
# webapp: true

#
# OAuth Provider
Expand Down
Loading