git.iko.soy/typeable/oauth2-proxy
on master help sign in
Merge pull request #114 from pusher/jekyll-docs

Created docs directory, split README contents into separate pages.

commit701c01256779cf2323e1cd6dc376c4b51b16b342 authorIcelyn Jennings <icelynjennings@gmail.com> dateThu 9 May 2019, 11:33 (7 years ago) parent908ac249200eb8
14 files changed+1150−103
README.md+103−103 docs/.gitignore+3 docs/0_index.md+23 docs/1_installation.md+27 docs/2_auth.md+231 docs/3_configuration.md+306 docs/404.html+24 docs/4_tls.md+73 docs/5_endpoints.md+17 docs/6_request_signatures.md+24 docs/Gemfile+11 docs/Gemfile.lock+254 docs/_config.yml+42 docs/assets/js/search-data.json+12
README.md+103−103
@@ -254,6 +254,13 @@ In this case, you can set the `-skip-oidc-discovery` option, and supply those re
254254
255255To authorize by email domain use `--email-domain=yourcompany.com`. To authorize individual email addresses use `--authenticated-emails-file=/path/to/file` with one email per line. To authorize all email addresses use `--email-domain=*`.
256256
257+## Adding a new Provider
258+
259+Follow the examples in the [`providers` package](providers/) to define a new
260+`Provider` instance. Add a new `case` to
261+[`providers.New()`](providers/providers.go) to allow `oauth2_proxy` to use the
262+new `Provider`.
263+
257264## Configuration
258265
259266`oauth2_proxy` can be configured via [config file](#config-file), [command line options](#command-line-options) or [environment variables](#environment-variables).
@@ -371,102 +378,6 @@ The following environment variables can be used in place of the corresponding co
371378- `OAUTH2_PROXY_COOKIE_REFRESH`
372379- `OAUTH2_PROXY_SIGNATURE_KEY`
373380
374−## SSL Configuration
375−
376−There are two recommended configurations.
377−
378−1. Configure SSL Termination with OAuth2 Proxy by providing a `--tls-cert=/path/to/cert.pem` and `--tls-key=/path/to/cert.key`.
379−
380−The command line to run `oauth2_proxy` in this configuration would look like this:
381−
382−```bash
383−./oauth2_proxy \
384− --email-domain="yourcompany.com" \
385− --upstream=http://127.0.0.1:8080/ \
386− --tls-cert=/path/to/cert.pem \
387− --tls-key=/path/to/cert.key \
388− --cookie-secret=... \
389− --cookie-secure=true \
390− --provider=... \
391− --client-id=... \
392− --client-secret=...
393−```
394−
395−2. Configure SSL Termination with [Nginx](http://nginx.org/) (example config below), Amazon ELB, Google Cloud Platform Load Balancing, or ....
396−
397−Because `oauth2_proxy` listens on `127.0.0.1:4180` by default, to listen on all interfaces (needed when using an
398−external load balancer like Amazon ELB or Google Platform Load Balancing) use `--http-address="0.0.0.0:4180"` or
399−`--http-address="http://:4180"`.
400−
401−Nginx will listen on port `443` and handle SSL connections while proxying to `oauth2_proxy` on port `4180`.
402−`oauth2_proxy` will then authenticate requests for an upstream application. The external endpoint for this example
403−would be `https://internal.yourcompany.com/`.
404−
405−An example Nginx config follows. Note the use of `Strict-Transport-Security` header to pin requests to SSL
406−via [HSTS](http://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security):
407−
408−```
409−server {
410− listen 443 default ssl;
411− server_name internal.yourcompany.com;
412− ssl_certificate /path/to/cert.pem;
413− ssl_certificate_key /path/to/cert.key;
414− add_header Strict-Transport-Security max-age=2592000;
415−
416− location / {
417− proxy_pass http://127.0.0.1:4180;
418− proxy_set_header Host $host;
419− proxy_set_header X-Real-IP $remote_addr;
420− proxy_set_header X-Scheme $scheme;
421− proxy_connect_timeout 1;
422− proxy_send_timeout 30;
423− proxy_read_timeout 30;
424− }
425−}
426−```
427−
428−The command line to run `oauth2_proxy` in this configuration would look like this:
429−
430−```bash
431−./oauth2_proxy \
432− --email-domain="yourcompany.com" \
433− --upstream=http://127.0.0.1:8080/ \
434− --cookie-secret=... \
435− --cookie-secure=true \
436− --provider=... \
437− --client-id=... \
438− --client-secret=...
439−```
440−
441−## Endpoint Documentation
442−
443−OAuth2 Proxy responds directly to the following endpoints. All other endpoints will be proxied upstream when authenticated. The `/oauth2` prefix can be changed with the `--proxy-prefix` config variable.
444−
445−- /robots.txt - returns a 200 OK response that disallows all User-agents from all paths; see [robotstxt.org](http://www.robotstxt.org/) for more info
446−- /ping - returns a 200 OK response, which is intended for use with health checks
447−- /oauth2/sign_in - the login page, which also doubles as a sign out page (it clears cookies)
448−- /oauth2/start - a URL that will redirect to start the OAuth cycle
449−- /oauth2/callback - the URL used at the end of the OAuth cycle. The oauth app will be configured with this as the callback url.
450−- /oauth2/auth - only returns a 202 Accepted response or a 401 Unauthorized response; for use with the [Nginx `auth_request` directive](#nginx-auth-request)
451−
452−## Request signatures
453−
454−If `signature_key` is defined, proxied requests will be signed with the
455−`GAP-Signature` header, which is a [Hash-based Message Authentication Code
456−(HMAC)](https://en.wikipedia.org/wiki/Hash-based_message_authentication_code)
457−of selected request information and the request body [see `SIGNATURE_HEADERS`
458−in `oauthproxy.go`](./oauthproxy.go).
459−
460−`signature_key` must be of the form `algorithm:secretkey`, (ie: `signature_key = "sha1:secret0"`)
461−
462−For more information about HMAC request signature validation, read the
463−following:
464−
465−- [Amazon Web Services: Signing and Authenticating REST
466− Requests](https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html)
467−- [rc3.org: Using HMAC to authenticate Web service
468− requests](http://rc3.org/2011/12/02/using-hmac-to-authenticate-web-service-requests/)
469−
470381## Logging Configuration
471382
472383By default, OAuth2 Proxy logs all output to stdout. Logging can be configured to output to a rotating log file using the `-logging-filename` command.
@@ -563,13 +474,6 @@ Available variables for standard logging:
563474| File | main.go:40 | The file and line number of the logging statement. |
564475| Message | HTTP: listening on 127.0.0.1:4180 | The details of the log statement. |
565476
566−## Adding a new Provider
567−
568−Follow the examples in the [`providers` package](providers/) to define a new
569−`Provider` instance. Add a new `case` to
570−[`providers.New()`](providers/providers.go) to allow `oauth2_proxy` to use the
571−new `Provider`.
572−
573477## <a name="nginx-auth-request"></a>Configuring for use with the Nginx `auth_request` directive
574478
575479The [Nginx `auth_request` directive](http://nginx.org/en/docs/http/ngx_http_auth_request_module.html) allows Nginx to authenticate requests via the oauth2_proxy's `/auth` endpoint, which only returns a 202 Accepted response or a 401 Unauthorized response without proxying the request through. For example:
@@ -657,6 +561,102 @@ nginx.ingress.kubernetes.io/configuration-snippet: |
657561 }
658562```
659563
564+## SSL Configuration
565+
566+There are two recommended configurations.
567+
568+1. Configure SSL Termination with OAuth2 Proxy by providing a `--tls-cert=/path/to/cert.pem` and `--tls-key=/path/to/cert.key`.
569+
570+The command line to run `oauth2_proxy` in this configuration would look like this:
571+
572+```bash
573+./oauth2_proxy \
574+ --email-domain="yourcompany.com" \
575+ --upstream=http://127.0.0.1:8080/ \
576+ --tls-cert=/path/to/cert.pem \
577+ --tls-key=/path/to/cert.key \
578+ --cookie-secret=... \
579+ --cookie-secure=true \
580+ --provider=... \
581+ --client-id=... \
582+ --client-secret=...
583+```
584+
585+2. Configure SSL Termination with [Nginx](http://nginx.org/) (example config below), Amazon ELB, Google Cloud Platform Load Balancing, or ....
586+
587+Because `oauth2_proxy` listens on `127.0.0.1:4180` by default, to listen on all interfaces (needed when using an
588+external load balancer like Amazon ELB or Google Platform Load Balancing) use `--http-address="0.0.0.0:4180"` or
589+`--http-address="http://:4180"`.
590+
591+Nginx will listen on port `443` and handle SSL connections while proxying to `oauth2_proxy` on port `4180`.
592+`oauth2_proxy` will then authenticate requests for an upstream application. The external endpoint for this example
593+would be `https://internal.yourcompany.com/`.
594+
595+An example Nginx config follows. Note the use of `Strict-Transport-Security` header to pin requests to SSL
596+via [HSTS](http://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security):
597+
598+```
599+server {
600+ listen 443 default ssl;
601+ server_name internal.yourcompany.com;
602+ ssl_certificate /path/to/cert.pem;
603+ ssl_certificate_key /path/to/cert.key;
604+ add_header Strict-Transport-Security max-age=2592000;
605+
606+ location / {
607+ proxy_pass http://127.0.0.1:4180;
608+ proxy_set_header Host $host;
609+ proxy_set_header X-Real-IP $remote_addr;
610+ proxy_set_header X-Scheme $scheme;
611+ proxy_connect_timeout 1;
612+ proxy_send_timeout 30;
613+ proxy_read_timeout 30;
614+ }
615+}
616+```
617+
618+The command line to run `oauth2_proxy` in this configuration would look like this:
619+
620+```bash
621+./oauth2_proxy \
622+ --email-domain="yourcompany.com" \
623+ --upstream=http://127.0.0.1:8080/ \
624+ --cookie-secret=... \
625+ --cookie-secure=true \
626+ --provider=... \
627+ --client-id=... \
628+ --client-secret=...
629+```
630+
631+## Endpoint Documentation
632+
633+OAuth2 Proxy responds directly to the following endpoints. All other endpoints will be proxied upstream when authenticated. The `/oauth2` prefix can be changed with the `--proxy-prefix` config variable.
634+
635+- /robots.txt - returns a 200 OK response that disallows all User-agents from all paths; see [robotstxt.org](http://www.robotstxt.org/) for more info
636+- /ping - returns a 200 OK response, which is intended for use with health checks
637+- /oauth2/sign_in - the login page, which also doubles as a sign out page (it clears cookies)
638+- /oauth2/start - a URL that will redirect to start the OAuth cycle
639+- /oauth2/callback - the URL used at the end of the OAuth cycle. The oauth app will be configured with this as the callback url.
640+- /oauth2/auth - only returns a 202 Accepted response or a 401 Unauthorized response; for use with the [Nginx `auth_request` directive](#nginx-auth-request)
641+
642+## Request signatures
643+
644+If `signature_key` is defined, proxied requests will be signed with the
645+`GAP-Signature` header, which is a [Hash-based Message Authentication Code
646+(HMAC)](https://en.wikipedia.org/wiki/Hash-based_message_authentication_code)
647+of selected request information and the request body [see `SIGNATURE_HEADERS`
648+in `oauthproxy.go`](./oauthproxy.go).
649+
650+`signature_key` must be of the form `algorithm:secretkey`, (ie: `signature_key = "sha1:secret0"`)
651+
652+For more information about HMAC request signature validation, read the
653+following:
654+
655+- [Amazon Web Services: Signing and Authenticating REST
656+ Requests](https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html)
657+- [rc3.org: Using HMAC to authenticate Web service
658+ requests](http://rc3.org/2011/12/02/using-hmac-to-authenticate-web-service-requests/)
659+
660660## Contributing
661661
662662Please see our [Contributing](CONTRIBUTING.md) guidelines.
docs/.gitignorenew file+3
@@ -0,0 +1,3 @@
1+_site
2+.sass-cache
3+.jekyll-metadata
docs/0_index.mdnew file+23
@@ -0,0 +1,23 @@
1+---
2+layout: default
3+title: Home
4+permalink: /
5+nav_order: 0
6+---
7+
8+# oauth2_proxy
9+
10+A reverse proxy and static file server that provides authentication using Providers (Google, GitHub, and others)
11+to validate accounts by email, domain or group.
12+
13+**Note:** This repository was forked from [bitly/OAuth2_Proxy](https://github.com/bitly/oauth2_proxy) on 27/11/2018.
14+Versions v3.0.0 and up are from this fork and will have diverged from any changes in the original fork.
15+A list of changes can be seen in the [CHANGELOG](CHANGELOG.md).
16+
17+[![Build Status](https://secure.travis-ci.org/pusher/oauth2_proxy.svg?branch=master)](http://travis-ci.org/pusher/oauth2_proxy)
18+
19+![Sign In Page](https://cloud.githubusercontent.com/assets/45028/4970624/7feb7dd8-6886-11e4-93e0-c9904af44ea8.png)
20+
21+## Architecture
22+
23+![OAuth2 Proxy Architecture](https://cloud.githubusercontent.com/assets/45028/8027702/bd040b7a-0d6a-11e5-85b9-f8d953d04f39.png)
docs/1_installation.mdnew file+27
@@ -0,0 +1,27 @@
1+---
2+layout: default
3+title: Installation
4+permalink: /installation
5+nav_order: 1
6+---
7+
8+## Installation
9+
10+1. Choose how to deploy:
11+
12+ a. Download [Prebuilt Binary](https://github.com/pusher/oauth2_proxy/releases) (current release is `v3.2.0`)
13+
14+ b. Build with `$ go get github.com/pusher/oauth2_proxy` which will put the binary in `$GOROOT/bin`
15+
16+ c. Using the prebuilt docker image [quay.io/pusher/oauth2_proxy](https://quay.io/pusher/oauth2_proxy) (AMD64, ARMv6 and ARM64 tags available)
17+
18+Prebuilt binaries can be validated by extracting the file and verifying it against the `sha256sum.txt` checksum file provided for each release starting with version `v3.0.0`.
19+
20+```
21+sha256sum -c sha256sum.txt 2>&1 | grep OK
22+oauth2_proxy-3.2.0.linux-amd64: OK
23+```
24+
25+2. [Select a Provider and Register an OAuth Application with a Provider](auth)
26+3. [Configure OAuth2 Proxy using config file, command line options, or environment variables](configuration)
27+4. [Configure SSL or Deploy behind a SSL endpoint](tls) (example provided for Nginx)
docs/2_auth.mdnew file+231
@@ -0,0 +1,231 @@
1+---
2+layout: default
3+title: Auth Configuration
4+permalink: /auth-configuration
5+nav_order: 2
6+---
7+
8+## OAuth Provider Configuration
9+
10+You will need to register an OAuth application with a Provider (Google, GitHub or another provider), and configure it with Redirect URI(s) for the domain you intend to run `oauth2_proxy` on.
11+
12+Valid providers are :
13+
14+- [Google](#google-auth-provider) _default_
15+- [Azure](#azure-auth-provider)
16+- [Facebook](#facebook-auth-provider)
17+- [GitHub](#github-auth-provider)
18+- [GitLab](#gitlab-auth-provider)
19+- [LinkedIn](#linkedin-auth-provider)
20+- [login.gov](#logingov-provider)
21+
22+The provider can be selected using the `provider` configuration value.
23+
24+### Google Auth Provider
25+
26+For Google, the registration steps are:
27+
28+1. Create a new project: https://console.developers.google.com/project
29+2. Choose the new project from the top right project dropdown (only if another project is selected)
30+3. In the project Dashboard center pane, choose **"API Manager"**
31+4. In the left Nav pane, choose **"Credentials"**
32+5. In the center pane, choose **"OAuth consent screen"** tab. Fill in **"Product name shown to users"** and hit save.
33+6. In the center pane, choose **"Credentials"** tab.
34+ - Open the **"New credentials"** drop down
35+ - Choose **"OAuth client ID"**
36+ - Choose **"Web application"**
37+ - Application name is freeform, choose something appropriate
38+ - Authorized JavaScript origins is your domain ex: `https://internal.yourcompany.com`
39+ - Authorized redirect URIs is the location of oauth2/callback ex: `https://internal.yourcompany.com/oauth2/callback`
40+ - Choose **"Create"**
41+7. Take note of the **Client ID** and **Client Secret**
42+
43+It's recommended to refresh sessions on a short interval (1h) with `cookie-refresh` setting which validates that the account is still authorized.
44+
45+#### Restrict auth to specific Google groups on your domain. (optional)
46+
47+1. Create a service account: https://developers.google.com/identity/protocols/OAuth2ServiceAccount and make sure to download the json file.
48+2. Make note of the Client ID for a future step.
49+3. Under "APIs & Auth", choose APIs.
50+4. Click on Admin SDK and then Enable API.
51+5. Follow the steps on https://developers.google.com/admin-sdk/directory/v1/guides/delegation#delegate_domain-wide_authority_to_your_service_account and give the client id from step 2 the following oauth scopes:
52+
53+```
54+https://www.googleapis.com/auth/admin.directory.group.readonly
55+https://www.googleapis.com/auth/admin.directory.user.readonly
56+```
57+
58+6. Follow the steps on https://support.google.com/a/answer/60757 to enable Admin API access.
59+7. Create or choose an existing administrative email address on the Gmail domain to assign to the `google-admin-email` flag. This email will be impersonated by this client to make calls to the Admin SDK. See the note on the link from step 5 for the reason why.
60+8. Create or choose an existing email group and set that email to the `google-group` flag. You can pass multiple instances of this flag with different groups
61+ and the user will be checked against all the provided groups.
62+9. Lock down the permissions on the json file downloaded from step 1 so only oauth2_proxy is able to read the file and set the path to the file in the `google-service-account-json` flag.
63+10. Restart oauth2_proxy.
64+
65+Note: The user is checked against the group members list on initial authentication and every time the token is refreshed ( about once an hour ).
66+
67+### Azure Auth Provider
68+
69+1. Add an application: go to [https://portal.azure.com](https://portal.azure.com), choose **"Azure Active Directory"** in the left menu, select **"App registrations"** and then click on **"New app registration"**.
70+2. Pick a name and choose **"Webapp / API"** as application type. Use `https://internal.yourcompany.com` as Sign-on URL. Click **"Create"**.
71+3. On the **"Settings"** / **"Properties"** page of the app, pick a logo and select **"Multi-tenanted"** if you want to allow users from multiple organizations to access your app. Note down the application ID. Click **"Save"**.
72+4. On the **"Settings"** / **"Required Permissions"** page of the app, click on **"Windows Azure Active Directory"** and then on **"Access the directory as the signed in user"**. Hit **"Save"** and then then on **"Grant permissions"** (you might need another admin to do this).
73+5. On the **"Settings"** / **"Reply URLs"** page of the app, add `https://internal.yourcompanycom/oauth2/callback` for each host that you want to protect by the oauth2 proxy. Click **"Save"**.
74+6. On the **"Settings"** / **"Keys"** page of the app, add a new key and note down the value after hitting **"Save"**.
75+7. Configure the proxy with
76+
77+```
78+ --provider=azure
79+ --client-id=<application ID from step 3>
80+ --client-secret=<value from step 6>
81+```
82+
83+### Facebook Auth Provider
84+
85+1. Create a new FB App from <https://developers.facebook.com/>
86+2. Under FB Login, set your Valid OAuth redirect URIs to `https://internal.yourcompany.com/oauth2/callback`
87+
88+### GitHub Auth Provider
89+
90+1. Create a new project: https://github.com/settings/developers
91+2. Under `Authorization callback URL` enter the correct url ie `https://internal.yourcompany.com/oauth2/callback`
92+
93+The GitHub auth provider supports two additional parameters to restrict authentication to Organization or Team level access. Restricting by org and team is normally accompanied with `--email-domain=*`
94+
95+ -github-org="": restrict logins to members of this organisation
96+ -github-team="": restrict logins to members of any of these teams (slug), separated by a comma
97+
98+If you are using GitHub enterprise, make sure you set the following to the appropriate url:
99+
100+ -login-url="http(s)://<enterprise github host>/login/oauth/authorize"
101+ -redeem-url="http(s)://<enterprise github host>/login/oauth/access_token"
102+ -validate-url="http(s)://<enterprise github host>/api/v3"
103+
104+### GitLab Auth Provider
105+
106+Whether you are using GitLab.com or self-hosting GitLab, follow [these steps to add an application](http://doc.gitlab.com/ce/integration/oauth_provider.html)
107+
108+If you are using self-hosted GitLab, make sure you set the following to the appropriate URL:
109+
110+ -login-url="<your gitlab url>/oauth/authorize"
111+ -redeem-url="<your gitlab url>/oauth/token"
112+ -validate-url="<your gitlab url>/api/v4/user"
113+
114+### LinkedIn Auth Provider
115+
116+For LinkedIn, the registration steps are:
117+
118+1. Create a new project: https://www.linkedin.com/secure/developer
119+2. In the OAuth User Agreement section:
120+ - In default scope, select r_basicprofile and r_emailaddress.
121+ - In "OAuth 2.0 Redirect URLs", enter `https://internal.yourcompany.com/oauth2/callback`
122+3. Fill in the remaining required fields and Save.
123+4. Take note of the **Consumer Key / API Key** and **Consumer Secret / Secret Key**
124+
125+### Microsoft Azure AD Provider
126+
127+For adding an application to the Microsoft Azure AD follow [these steps to add an application](https://azure.microsoft.com/en-us/documentation/articles/active-directory-integrating-applications/).
128+
129+Take note of your `TenantId` if applicable for your situation. The `TenantId` can be used to override the default `common` authorization server with a tenant specific server.
130+
131+### OpenID Connect Provider
132+
133+OpenID Connect is a spec for OAUTH 2.0 + identity that is implemented by many major providers and several open source projects. This provider was originally built against CoreOS Dex and we will use it as an example.
134+
135+1. Launch a Dex instance using the [getting started guide](https://github.com/coreos/dex/blob/master/Documentation/getting-started.md).
136+2. Setup oauth2_proxy with the correct provider and using the default ports and callbacks.
137+3. Login with the fixture use in the dex guide and run the oauth2_proxy with the following args:
138+
139+ -provider oidc
140+ -client-id oauth2_proxy
141+ -client-secret proxy
142+ -redirect-url http://127.0.0.1:4180/oauth2/callback
143+ -oidc-issuer-url http://127.0.0.1:5556
144+ -cookie-secure=false
145+ -email-domain example.com
146+
147+### login.gov Provider
148+
149+login.gov is an OIDC provider for the US Government.
150+If you are a US Government agency, you can contact the login.gov team through the contact information
151+that you can find on https://login.gov/developers/ and work with them to understand how to get login.gov
152+accounts for integration/test and production access.
153+
154+A developer guide is available here: https://developers.login.gov/, though this proxy handles everything
155+but the data you need to create to register your application in the login.gov dashboard.
156+
157+As a demo, we will assume that you are running your application that you want to secure locally on
158+http://localhost:3000/, that you will be starting your proxy up on http://localhost:4180/, and that
159+you have an agency integration account for testing.
160+
161+First, register your application in the dashboard. The important bits are:
162+ * Identity protocol: make this `Openid connect`
163+ * Issuer: do what they say for OpenID Connect. We will refer to this string as `${LOGINGOV_ISSUER}`.
164+ * Public key: This is a self-signed certificate in .pem format generated from a 2048 bit RSA private key.
165+ A quick way to do this is `openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 3650 -nodes -subj '/C=US/ST=Washington/L=DC/O=GSA/OU=18F/CN=localhost'`,
166+ The contents of the `key.pem` shall be referred to as `${OAUTH2_PROXY_JWT_KEY}`.
167+ * Return to App URL: Make this be `http://localhost:4180/`
168+ * Redirect URIs: Make this be `http://localhost:4180/oauth2/callback`.
169+ * Attribute Bundle: Make sure that email is selected.
170+
171+Now start the proxy up with the following options:
172+```
173+./oauth2_proxy -provider login.gov \
174+ -client-id=${LOGINGOV_ISSUER} \
175+ -redirect-url=http://localhost:4180/oauth2/callback \
176+ -oidc-issuer-url=https://idp.int.identitysandbox.gov/ \
177+ -cookie-secure=false \
178+ -email-domain=gsa.gov \
179+ -upstream=http://localhost:3000/ \
180+ -cookie-secret=somerandomstring12341234567890AB \
181+ -cookie-domain=localhost \
182+ -skip-provider-button=true \
183+ -pubjwk-url=https://idp.int.identitysandbox.gov/api/openid_connect/certs \
184+ -profile-url=https://idp.int.identitysandbox.gov/api/openid_connect/userinfo \
185+ -jwt-key="${OAUTH2_PROXY_JWT_KEY}"
186+```
187+You can also set all these options with environment variables, for use in cloud/docker environments.
188+One tricky thing that you may encounter is that some cloud environments will pass in environment
189+variables in a docker env-file, which does not allow multiline variables like a PEM file.
190+If you encounter this, then you can create a `jwt_signing_key.pem` file in the top level
191+directory of the repo which contains the key in PEM format and then do your docker build.
192+The docker build process will copy that file into your image which you can then access by
193+setting the `OAUTH2_PROXY_JWT_KEY_FILE=/etc/ssl/private/jwt_signing_key.pem`
194+environment variable, or by setting `-jwt-key-file=/etc/ssl/private/jwt_signing_key.pem` on the commandline.
195+
196+Once it is running, you should be able to go to `http://localhost:4180/` in your browser,
197+get authenticated by the login.gov integration server, and then get proxied on to your
198+application running on `http://localhost:3000/`. In a real deployment, you would secure
199+your application with a firewall or something so that it was only accessible from the
200+proxy, and you would use real hostnames everywhere.
201+
202+#### Skip OIDC discovery
203+
204+Some providers do not support OIDC discovery via their issuer URL, so oauth2_proxy cannot simply grab the authorization, token and jwks URI endpoints from the provider's metadata.
205+
206+In this case, you can set the `-skip-oidc-discovery` option, and supply those required endpoints manually:
207+
208+```
209+ -provider oidc
210+ -client-id oauth2_proxy
211+ -client-secret proxy
212+ -redirect-url http://127.0.0.1:4180/oauth2/callback
213+ -oidc-issuer-url http://127.0.0.1:5556
214+ -skip-oidc-discovery
215+ -login-url http://127.0.0.1:5556/authorize
216+ -redeem-url http://127.0.0.1:5556/token
217+ -oidc-jwks-url http://127.0.0.1:5556/keys
218+ -cookie-secure=false
219+ -email-domain example.com
220+```
221+
222+## Email Authentication
223+
224+To authorize by email domain use `--email-domain=yourcompany.com`. To authorize individual email addresses use `--authenticated-emails-file=/path/to/file` with one email per line. To authorize all email addresses use `--email-domain=*`.
225+
226+## Adding a new Provider
227+
228+Follow the examples in the [`providers` package](providers/) to define a new
229+`Provider` instance. Add a new `case` to
230+[`providers.New()`](providers/providers.go) to allow `oauth2_proxy` to use the
231+new `Provider`.
docs/3_configuration.mdnew file+306
@@ -0,0 +1,306 @@
1+---
2+layout: default
3+title: Configuration
4+permalink: /configuration
5+nav_order: 3
6+---
7+
8+## Configuration
9+
10+`oauth2_proxy` can be configured via [config file](#config-file), [command line options](#command-line-options) or [environment variables](#environment-variables).
11+
12+To generate a strong cookie secret use `python -c 'import os,base64; print base64.urlsafe_b64encode(os.urandom(16))'`
13+
14+### Config File
15+
16+An example [oauth2_proxy.cfg](contrib/oauth2_proxy.cfg.example) config file is in the contrib directory. It can be used by specifying `-config=/etc/oauth2_proxy.cfg`
17+
18+### Command Line Options
19+
20+```
21+Usage of oauth2_proxy:
22+ -acr-values string: optional, used by login.gov (default "http://idmanagement.gov/ns/assurance/loa/1")
23+ -approval-prompt string: OAuth approval_prompt (default "force")
24+ -auth-logging: Log authentication attempts (default true)
25+ -auth-logging-format string: Template for authentication log lines (see "Logging Configuration" paragraph below)
26+ -authenticated-emails-file string: authenticate against emails via file (one per line)
27+ -azure-tenant string: go to a tenant-specific or common (tenant-independent) endpoint. (default "common")
28+ -basic-auth-password string: the password to set when passing the HTTP Basic Auth header
29+ -client-id string: the OAuth Client ID: ie: "123456.apps.googleusercontent.com"
30+ -client-secret string: the OAuth Client Secret
31+ -config string: path to config file
32+ -cookie-domain string: an optional cookie domain to force cookies to (ie: .yourcompany.com)
33+ -cookie-expire duration: expire timeframe for cookie (default 168h0m0s)
34+ -cookie-httponly: set HttpOnly cookie flag (default true)
35+ -cookie-name string: the name of the cookie that the oauth_proxy creates (default "_oauth2_proxy")
36+ -cookie-path string: an optional cookie path to force cookies to (ie: /poc/)* (default "/")
37+ -cookie-refresh duration: refresh the cookie after this duration; 0 to disable
38+ -cookie-secret string: the seed string for secure cookies (optionally base64 encoded)
39+ -cookie-secure: set secure (HTTPS) cookie flag (default true)
40+ -custom-templates-dir string: path to custom html templates
41+ -display-htpasswd-form: display username / password login form if an htpasswd file is provided (default true)
42+ -email-domain value: authenticate emails with the specified domain (may be given multiple times). Use * to authenticate any email
43+ -flush-interval: period between flushing response buffers when streaming responses (default "1s")
44+ -footer string: custom footer string. Use "-" to disable default footer.
45+ -gcp-healthchecks: will enable /liveness_check, /readiness_check, and / (with the proper user-agent) endpoints that will make it work well with GCP App Engine and GKE Ingresses (default false)
46+ -github-org string: restrict logins to members of this organisation
47+ -github-team string: restrict logins to members of any of these teams (slug), separated by a comma
48+ -google-admin-email string: the google admin to impersonate for api calls
49+ -google-group value: restrict logins to members of this google group (may be given multiple times).
50+ -google-service-account-json string: the path to the service account json credentials
51+ -htpasswd-file string: additionally authenticate against a htpasswd file. Entries must be created with "htpasswd -s" for SHA encryption
52+ -http-address string: [http://]<addr>:<port> or unix://<path> to listen on for HTTP clients (default "127.0.0.1:4180")
53+ -https-address string: <addr>:<port> to listen on for HTTPS clients (default ":443")
54+ -logging-compress: Should rotated log files be compressed using gzip (default false)
55+ -logging-filename string: File to log requests to, empty for stdout (default to stdout)
56+ -logging-local-time: If the time in log files and backup filenames are local or UTC time (default true)
57+ -logging-max-age int: Maximum number of days to retain old log files (default 7)
58+ -logging-max-backups int: Maximum number of old log files to retain; 0 to disable (default 0)
59+ -logging-max-size int: Maximum size in megabytes of the log file before rotation (default 100)
60+ -jwt-key string: private key in PEM format used to sign JWT, so that you can say something like -jwt-key="${OAUTH2_PROXY_JWT_KEY}": required by login.gov
61+ -jwt-key-file string: path to the private key file in PEM format used to sign the JWT so that you can say something like -jwt-key-file=/etc/ssl/private/jwt_signing_key.pem: required by login.gov
62+ -login-url string: Authentication endpoint
63+ -oidc-issuer-url: the OpenID Connect issuer URL. ie: "https://accounts.google.com"
64+ -oidc-jwks-url string: OIDC JWKS URI for token verification; required if OIDC discovery is disabled
65+ -pass-access-token: pass OAuth access_token to upstream via X-Forwarded-Access-Token header
66+ -pass-authorization-header: pass OIDC IDToken to upstream via Authorization Bearer header
67+ -pass-basic-auth: pass HTTP Basic Auth, X-Forwarded-User and X-Forwarded-Email information to upstream (default true)
68+ -pass-host-header: pass the request Host Header to upstream (default true)
69+ -pass-user-headers: pass X-Forwarded-User and X-Forwarded-Email information to upstream (default true)
70+ -profile-url string: Profile access endpoint
71+ -provider string: OAuth provider (default "google")
72+ -proxy-prefix string: the url root path that this proxy should be nested under (e.g. /<oauth2>/sign_in) (default "/oauth2")
73+ -proxy-websockets: enables WebSocket proxying (default true)
74+ -pubjwk-url string: JWK pubkey access endpoint: required by login.gov
75+ -redeem-url string: Token redemption endpoint
76+ -redirect-url string: the OAuth Redirect URL. ie: "https://internalapp.yourcompany.com/oauth2/callback"
77+ -request-logging: Log requests to stdout (default true)
78+ -request-logging-format: Template for request log lines (see "Logging Configuration" paragraph below)
79+ -resource string: The resource that is protected (Azure AD only)
80+ -scope string: OAuth scope specification
81+ -set-xauthrequest: set X-Auth-Request-User and X-Auth-Request-Email response headers (useful in Nginx auth_request mode)
82+ -set-authorization-header: set Authorization Bearer response header (useful in Nginx auth_request mode)
83+ -signature-key string: GAP-Signature request signature key (algorithm:secretkey)
84+ -skip-auth-preflight: will skip authentication for OPTIONS requests
85+ -skip-auth-regex value: bypass authentication for requests path's that match (may be given multiple times)
86+ -skip-oidc-discovery: bypass OIDC endpoint discovery. login-url, redeem-url and oidc-jwks-url must be configured in this case
87+ -skip-provider-button: will skip sign-in-page to directly reach the next step: oauth/start
88+ -ssl-insecure-skip-verify: skip validation of certificates presented when using HTTPS
89+ -standard-logging: Log standard runtime information (default true)
90+ -standard-logging-format string: Template for standard log lines (see "Logging Configuration" paragraph below)
91+ -tls-cert string: path to certificate file
92+ -tls-key string: path to private key file
93+ -upstream value: the http url(s) of the upstream endpoint or file:// paths for static files. Routing is based on the path
94+ -validate-url string: Access token validation endpoint
95+ -version: print version string
96+ -whitelist-domain: allowed domains for redirection after authentication. Prefix domain with a . to allow subdomains (eg .example.com)
97+```
98+
99+Note, when using the `whitelist-domain` option, any domain prefixed with a `.` will allow any subdomain of the specified domain as a valid redirect URL.
100+
101+See below for provider specific options
102+
103+### Upstreams Configuration
104+
105+`oauth2_proxy` supports having multiple upstreams, and has the option to pass requests on to HTTP(S) servers or serve static files from the file system. HTTP and HTTPS upstreams are configured by providing a URL such as `http://127.0.0.1:8080/` for the upstream parameter, that will forward all authenticated requests to be forwarded to the upstream server. If you instead provide `http://127.0.0.1:8080/some/path/` then it will only be requests that start with `/some/path/` which are forwarded to the upstream.
106+
107+Static file paths are configured as a file:// URL. `file:///var/www/static/` will serve the files from that directory at `http://[oauth2_proxy url]/var/www/static/`, which may not be what you want. You can provide the path to where the files should be available by adding a fragment to the configured URL. The value of the fragment will then be used to specify which path the files are available at. `file:///var/www/static/#/static/` will ie. make `/var/www/static/` available at `http://[oauth2_proxy url]/static/`.
108+
109+Multiple upstreams can either be configured by supplying a comma separated list to the `-upstream` parameter, supplying the parameter multiple times or provinding a list in the [config file](#config-file). When multiple upstreams are used routing to them will be based on the path they are set up with.
110+
111+### Environment variables
112+
113+The following environment variables can be used in place of the corresponding command-line arguments:
114+
115+- `OAUTH2_PROXY_CLIENT_ID`
116+- `OAUTH2_PROXY_CLIENT_SECRET`
117+- `OAUTH2_PROXY_COOKIE_NAME`
118+- `OAUTH2_PROXY_COOKIE_SECRET`
119+- `OAUTH2_PROXY_COOKIE_DOMAIN`
120+- `OAUTH2_PROXY_COOKIE_PATH`
121+- `OAUTH2_PROXY_COOKIE_EXPIRE`
122+- `OAUTH2_PROXY_COOKIE_REFRESH`
123+- `OAUTH2_PROXY_SIGNATURE_KEY`
124+
125+## Logging Configuration
126+
127+By default, OAuth2 Proxy logs all output to stdout. Logging can be configured to output to a rotating log file using the `-logging-filename` command.
128+
129+If logging to a file you can also configure the maximum file size (`-logging-max-size`), age (`-logging-max-age`), max backup logs (`-logging-max-backups`), and if backup logs should be compressed (`-logging-compress`).
130+
131+There are three different types of logging: standard, authentication, and HTTP requests. These can each be enabled or disabled with `-standard-logging`, `-auth-logging`, and `-request-logging`.
132+
133+Each type of logging has their own configurable format and variables. By default these formats are similar to the Apache Combined Log.
134+
135+### Auth Log Format
136+Authentication logs are logs which are guaranteed to contain a username or email address of a user attempting to authenticate. These logs are output by default in the below format:
137+
138+```
139+<REMOTE_ADDRESS> - <user@domain.com> [19/Mar/2015:17:20:19 -0400] [<STATUS>] <MESSAGE>
140+```
141+
142+The status block will contain one of the below strings:
143+
144+- `AuthSuccess` If a user has authenticated successfully by any method
145+- `AuthFailure` If the user failed to authenticate explicitly
146+- `AuthError` If there was an unexpected error during authentication
147+
148+If you require a different format than that, you can configure it with the `-auth-logging-format` flag.
149+The default format is configured as follows:
150+
151+```
152+{{.Client}} - {{.Username}} [{{.Timestamp}}] [{{.Status}}] {{.Message}}
153+```
154+
155+Available variables for auth logging:
156+
157+| Variable | Example | Description |
158+| --- | --- | --- |
159+| Client | 74.125.224.72 | The client/remote IP address. Will use the X-Real-IP header it if exists. |
160+| Host | domain.com | The value of the Host header. |
161+| Protocol | HTTP/1.0 | The request protocol. |
162+| RequestMethod | GET | The request method. |
163+| Timestamp | 19/Mar/2015:17:20:19 -0400 | The date and time of the logging event. |
164+| UserAgent | - | The full user agent as reported by the requesting client. |
165+| Username | username@email.com | The email or username of the auth request. |
166+| Status | AuthSuccess | The status of the auth request. See above for details. |
167+| Message | Authenticated via OAuth2 | The details of the auth attempt. |
168+
169+### Request Log Format
170+HTTP request logs will output by default in the below format:
171+
172+```
173+<REMOTE_ADDRESS> - <user@domain.com> [19/Mar/2015:17:20:19 -0400] <HOST_HEADER> GET <UPSTREAM_HOST> "/path/" HTTP/1.1 "<USER_AGENT>" <RESPONSE_CODE> <RESPONSE_BYTES> <REQUEST_DURATION>
174+```
175+
176+If you require a different format than that, you can configure it with the `-request-logging-format` flag.
177+The default format is configured as follows:
178+
179+```
180+{{.Client}} - {{.Username}} [{{.Timestamp}}] {{.Host}} {{.RequestMethod}} {{.Upstream}} {{.RequestURI}} {{.Protocol}} {{.UserAgent}} {{.StatusCode}} {{.ResponseSize}} {{.RequestDuration}}
181+```
182+
183+Available variables for request logging:
184+
185+| Variable | Example | Description |
186+| --- | --- | --- |
187+| Client | 74.125.224.72 | The client/remote IP address. Will use the X-Real-IP header it if exists. |
188+| Host | domain.com | The value of the Host header. |
189+| Protocol | HTTP/1.0 | The request protocol. |
190+| RequestDuration | 0.001 | The time in seconds that a request took to process. |
191+| RequestMethod | GET | The request method. |
192+| RequestURI | "/oauth2/auth" | The URI path of the request. |
193+| ResponseSize | 12 | The size in bytes of the response. |
194+| StatusCode | 200 | The HTTP status code of the response. |
195+| Timestamp | 19/Mar/2015:17:20:19 -0400 | The date and time of the logging event. |
196+| Upstream | - | The upstream data of the HTTP request. |
197+| UserAgent | - | The full user agent as reported by the requesting client. |
198+| Username | username@email.com | The email or username of the auth request. |
199+
200+### Standard Log Format
201+All other logging that is not covered by the above two types of logging will be output in this standard logging format. This includes configuration information at startup and errors that occur outside of a session. The default format is below:
202+
203+```
204+[19/Mar/2015:17:20:19 -0400] [main.go:40] <MESSAGE>
205+```
206+
207+If you require a different format than that, you can configure it with the `-standard-logging-format` flag. The default format is configured as follows:
208+
209+```
210+[{{.Timestamp}}] [{{.File}}] {{.Message}}
211+```
212+
213+Available variables for standard logging:
214+
215+| Variable | Example | Description |
216+| --- | --- | --- |
217+| Timestamp | 19/Mar/2015:17:20:19 -0400 | The date and time of the logging event. |
218+| File | main.go:40 | The file and line number of the logging statement. |
219+| Message | HTTP: listening on 127.0.0.1:4180 | The details of the log statement. |
220+
221+## <a name="nginx-auth-request"></a>Configuring for use with the Nginx `auth_request` directive
222+
223+The [Nginx `auth_request` directive](http://nginx.org/en/docs/http/ngx_http_auth_request_module.html) allows Nginx to authenticate requests via the oauth2_proxy's `/auth` endpoint, which only returns a 202 Accepted response or a 401 Unauthorized response without proxying the request through. For example:
224+
225+```nginx
226+server {
227+ listen 443 ssl;
228+ server_name ...;
229+ include ssl/ssl.conf;
230+
231+ location /oauth2/ {
232+ proxy_pass http://127.0.0.1:4180;
233+ proxy_set_header Host $host;
234+ proxy_set_header X-Real-IP $remote_addr;
235+ proxy_set_header X-Scheme $scheme;
236+ proxy_set_header X-Auth-Request-Redirect $request_uri;
237+ }
238+ location = /oauth2/auth {
239+ proxy_pass http://127.0.0.1:4180;
240+ proxy_set_header Host $host;
241+ proxy_set_header X-Real-IP $remote_addr;
242+ proxy_set_header X-Scheme $scheme;
243+ # nginx auth_request includes headers but not body
244+ proxy_set_header Content-Length "";
245+ proxy_pass_request_body off;
246+ }
247+
248+ location / {
249+ auth_request /oauth2/auth;
250+ error_page 401 = /oauth2/sign_in;
251+
252+ # pass information via X-User and X-Email headers to backend,
253+ # requires running with --set-xauthrequest flag
254+ auth_request_set $user $upstream_http_x_auth_request_user;
255+ auth_request_set $email $upstream_http_x_auth_request_email;
256+ proxy_set_header X-User $user;
257+ proxy_set_header X-Email $email;
258+
259+ # if you enabled --pass-access-token, this will pass the token to the backend
260+ auth_request_set $token $upstream_http_x_auth_request_access_token;
261+ proxy_set_header X-Access-Token $token;
262+
263+ # if you enabled --cookie-refresh, this is needed for it to work with auth_request
264+ auth_request_set $auth_cookie $upstream_http_set_cookie;
265+ add_header Set-Cookie $auth_cookie;
266+
267+ # When using the --set-authorization-header flag, some provider's cookies can exceed the 4kb
268+ # limit and so the OAuth2 Proxy splits these into multiple parts.
269+ # Nginx normally only copies the first `Set-Cookie` header from the auth_request to the response,
270+ # so if your cookies are larger than 4kb, you will need to extract additional cookies manually.
271+ auth_request_set $auth_cookie_name_upstream_1 $upstream_cookie_auth_cookie_name_1;
272+
273+ # Extract the Cookie attributes from the first Set-Cookie header and append them
274+ # to the second part ($upstream_cookie_* variables only contain the raw cookie content)
275+ if ($auth_cookie ~* "(; .*)") {
276+ set $auth_cookie_name_0 $auth_cookie;
277+ set $auth_cookie_name_1 "auth_cookie_name_1=$auth_cookie_name_upstream_1$1";
278+ }
279+
280+ # Send both Set-Cookie headers now if there was a second part
281+ if ($auth_cookie_name_upstream_1) {
282+ add_header Set-Cookie $auth_cookie_name_0;
283+ add_header Set-Cookie $auth_cookie_name_1;
284+ }
285+
286+ proxy_pass http://backend/;
287+ # or "root /path/to/site;" or "fastcgi_pass ..." etc
288+ }
289+}
290+```
291+
292+If you use ingress-nginx in Kubernetes (which includes the Lua module), you also can use the following configuration snippet for your Ingress:
293+
294+```yaml
295+nginx.ingress.kubernetes.io/auth-response-headers: Authorization
296+nginx.ingress.kubernetes.io/auth-signin: https://$host/oauth2/start?rd=$request_uri
297+nginx.ingress.kubernetes.io/auth-url: https://$host/oauth2/auth
298+nginx.ingress.kubernetes.io/configuration-snippet: |
299+ auth_request_set $name_upstream_1 $upstream_cookie_name_1;
300+
301+ access_by_lua_block {
302+ if ngx.var.name_upstream_1 ~= "" then
303+ ngx.header["Set-Cookie"] = "name_1=" .. ngx.var.name_upstream_1 .. ngx.var.auth_cookie:match("(; .*)")
304+ end
305+ }
306+```
docs/404.htmlnew file+24
@@ -0,0 +1,24 @@
1+---
2+layout: default
3+---
4+
5+<style type="text/css" media="screen">
6+ .container {
7+ margin: 10px auto;
8+ max-width: 600px;
9+ text-align: center;
10+ }
11+ h1 {
12+ margin: 30px 0;
13+ font-size: 4em;
14+ line-height: 1;
15+ letter-spacing: -1px;
16+ }
17+</style>
18+
19+<div class="container">
20+ <h1>404</h1>
21+
22+ <p><strong>Page not found :(</strong></p>
23+ <p>The requested page could not be found.</p>
24+</div>
docs/4_tls.mdnew file+73
@@ -0,0 +1,73 @@
1+---
2+layout: default
3+title: TLS Configuration
4+permalink: /tls-configuration
5+nav_order: 4
6+---
7+
8+## SSL Configuration
9+
10+There are two recommended configurations.
11+
12+1. Configure SSL Termination with OAuth2 Proxy by providing a `--tls-cert=/path/to/cert.pem` and `--tls-key=/path/to/cert.key`.
13+
14+The command line to run `oauth2_proxy` in this configuration would look like this:
15+
16+```bash
17+./oauth2_proxy \
18+ --email-domain="yourcompany.com" \
19+ --upstream=http://127.0.0.1:8080/ \
20+ --tls-cert=/path/to/cert.pem \
21+ --tls-key=/path/to/cert.key \
22+ --cookie-secret=... \
23+ --cookie-secure=true \
24+ --provider=... \
25+ --client-id=... \
26+ --client-secret=...
27+```
28+
29+2. Configure SSL Termination with [Nginx](http://nginx.org/) (example config below), Amazon ELB, Google Cloud Platform Load Balancing, or ....
30+
31+Because `oauth2_proxy` listens on `127.0.0.1:4180` by default, to listen on all interfaces (needed when using an
32+external load balancer like Amazon ELB or Google Platform Load Balancing) use `--http-address="0.0.0.0:4180"` or
33+`--http-address="http://:4180"`.
34+
35+Nginx will listen on port `443` and handle SSL connections while proxying to `oauth2_proxy` on port `4180`.
36+`oauth2_proxy` will then authenticate requests for an upstream application. The external endpoint for this example
37+would be `https://internal.yourcompany.com/`.
38+
39+An example Nginx config follows. Note the use of `Strict-Transport-Security` header to pin requests to SSL
40+via [HSTS](http://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security):
41+
42+```
43+server {
44+ listen 443 default ssl;
45+ server_name internal.yourcompany.com;
46+ ssl_certificate /path/to/cert.pem;
47+ ssl_certificate_key /path/to/cert.key;
48+ add_header Strict-Transport-Security max-age=2592000;
49+
50+ location / {
51+ proxy_pass http://127.0.0.1:4180;
52+ proxy_set_header Host $host;
53+ proxy_set_header X-Real-IP $remote_addr;
54+ proxy_set_header X-Scheme $scheme;
55+ proxy_connect_timeout 1;
56+ proxy_send_timeout 30;
57+ proxy_read_timeout 30;
58+ }
59+}
60+```
61+
62+The command line to run `oauth2_proxy` in this configuration would look like this:
63+
64+```bash
65+./oauth2_proxy \
66+ --email-domain="yourcompany.com" \
67+ --upstream=http://127.0.0.1:8080/ \
68+ --cookie-secret=... \
69+ --cookie-secure=true \
70+ --provider=... \
71+ --client-id=... \
72+ --client-secret=...
73+```
docs/5_endpoints.mdnew file+17
@@ -0,0 +1,17 @@
1+---
2+layout: default
3+title: Endpoints
4+permalink: /endpoints
5+nav_order: 5
6+---
7+
8+## Endpoint Documentation
9+
10+OAuth2 Proxy responds directly to the following endpoints. All other endpoints will be proxied upstream when authenticated. The `/oauth2` prefix can be changed with the `--proxy-prefix` config variable.
11+
12+- /robots.txt - returns a 200 OK response that disallows all User-agents from all paths; see [robotstxt.org](http://www.robotstxt.org/) for more info
13+- /ping - returns a 200 OK response, which is intended for use with health checks
14+- /oauth2/sign_in - the login page, which also doubles as a sign out page (it clears cookies)
15+- /oauth2/start - a URL that will redirect to start the OAuth cycle
16+- /oauth2/callback - the URL used at the end of the OAuth cycle. The oauth app will be configured with this as the callback url.
17+- /oauth2/auth - only returns a 202 Accepted response or a 401 Unauthorized response; for use with the [Nginx `auth_request` directive](#nginx-auth-request)
docs/6_request_signatures.mdnew file+24
@@ -0,0 +1,24 @@
1+---
2+layout: default
3+title: Request Signatures
4+permalink: /request-signatures
5+nav_order: 6
6+---
7+
8+## Request signatures
9+
10+If `signature_key` is defined, proxied requests will be signed with the
11+`GAP-Signature` header, which is a [Hash-based Message Authentication Code
12+(HMAC)](https://en.wikipedia.org/wiki/Hash-based_message_authentication_code)
13+of selected request information and the request body [see `SIGNATURE_HEADERS`
14+in `oauthproxy.go`](./oauthproxy.go).
15+
16+`signature_key` must be of the form `algorithm:secretkey`, (ie: `signature_key = "sha1:secret0"`)
17+
18+For more information about HMAC request signature validation, read the
19+following:
20+
21+- [Amazon Web Services: Signing and Authenticating REST
22+ Requests](https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html)
23+- [rc3.org: Using HMAC to authenticate Web service
24+ requests](http://rc3.org/2011/12/02/using-hmac-to-authenticate-web-service-requests/)
docs/Gemfilenew file+11
@@ -0,0 +1,11 @@
1+source "https://rubygems.org"
2+gem "github-pages", group: :jekyll_plugins
3+
4+# just-the-docs Jekyll theme
5+gem "just-the-docs"
6+
7+# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
8+gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
9+
10+# Performance-booster for watching directories on Windows
11+gem "wdm", "~> 0.1.0" if Gem.win_platform?
docs/Gemfile.locknew file+254
@@ -0,0 +1,254 @@
1+GEM
2+ remote: https://rubygems.org/
3+ specs:
4+ activesupport (4.2.10)
5+ i18n (~> 0.7)
6+ minitest (~> 5.1)
7+ thread_safe (~> 0.3, >= 0.3.4)
8+ tzinfo (~> 1.1)
9+ addressable (2.5.2)
10+ public_suffix (>= 2.0.2, < 4.0)
11+ coffee-script (2.4.1)
12+ coffee-script-source
13+ execjs
14+ coffee-script-source (1.11.1)
15+ colorator (1.1.0)
16+ commonmarker (0.17.13)
17+ ruby-enum (~> 0.5)
18+ concurrent-ruby (1.1.4)
19+ dnsruby (1.61.2)
20+ addressable (~> 2.5)
21+ em-websocket (0.5.1)
22+ eventmachine (>= 0.12.9)
23+ http_parser.rb (~> 0.6.0)
24+ ethon (0.12.0)
25+ ffi (>= 1.3.0)
26+ eventmachine (1.2.7)
27+ execjs (2.7.0)
28+ faraday (0.15.4)
29+ multipart-post (>= 1.2, < 3)
30+ ffi (1.10.0)
31+ forwardable-extended (2.6.0)
32+ gemoji (3.0.0)
33+ github-pages (193)
34+ activesupport (= 4.2.10)
35+ github-pages-health-check (= 1.8.1)
36+ jekyll (= 3.7.4)
37+ jekyll-avatar (= 0.6.0)
38+ jekyll-coffeescript (= 1.1.1)
39+ jekyll-commonmark-ghpages (= 0.1.5)
40+ jekyll-default-layout (= 0.1.4)
41+ jekyll-feed (= 0.11.0)
42+ jekyll-gist (= 1.5.0)
43+ jekyll-github-metadata (= 2.9.4)
44+ jekyll-mentions (= 1.4.1)
45+ jekyll-optional-front-matter (= 0.3.0)
46+ jekyll-paginate (= 1.1.0)
47+ jekyll-readme-index (= 0.2.0)
48+ jekyll-redirect-from (= 0.14.0)
49+ jekyll-relative-links (= 0.5.3)
50+ jekyll-remote-theme (= 0.3.1)
51+ jekyll-sass-converter (= 1.5.2)
52+ jekyll-seo-tag (= 2.5.0)
53+ jekyll-sitemap (= 1.2.0)
54+ jekyll-swiss (= 0.4.0)
55+ jekyll-theme-architect (= 0.1.1)
56+ jekyll-theme-cayman (= 0.1.1)
57+ jekyll-theme-dinky (= 0.1.1)
58+ jekyll-theme-hacker (= 0.1.1)
59+ jekyll-theme-leap-day (= 0.1.1)
60+ jekyll-theme-merlot (= 0.1.1)
61+ jekyll-theme-midnight (= 0.1.1)
62+ jekyll-theme-minimal (= 0.1.1)
63+ jekyll-theme-modernist (= 0.1.1)
64+ jekyll-theme-primer (= 0.5.3)
65+ jekyll-theme-slate (= 0.1.1)
66+ jekyll-theme-tactile (= 0.1.1)
67+ jekyll-theme-time-machine (= 0.1.1)
68+ jekyll-titles-from-headings (= 0.5.1)
69+ jemoji (= 0.10.1)
70+ kramdown (= 1.17.0)
71+ liquid (= 4.0.0)
72+ listen (= 3.1.5)
73+ mercenary (~> 0.3)
74+ minima (= 2.5.0)
75+ nokogiri (>= 1.8.2, < 2.0)
76+ rouge (= 2.2.1)
77+ terminal-table (~> 1.4)
78+ github-pages-health-check (1.8.1)
79+ addressable (~> 2.3)
80+ dnsruby (~> 1.60)
81+ octokit (~> 4.0)
82+ public_suffix (~> 2.0)
83+ typhoeus (~> 1.3)
84+ html-pipeline (2.10.0)
85+ activesupport (>= 2)
86+ nokogiri (>= 1.4)
87+ http_parser.rb (0.6.0)
88+ i18n (0.9.5)
89+ concurrent-ruby (~> 1.0)
90+ jekyll (3.7.4)
91+ addressable (~> 2.4)
92+ colorator (~> 1.0)
93+ em-websocket (~> 0.5)
94+ i18n (~> 0.7)
95+ jekyll-sass-converter (~> 1.0)
96+ jekyll-watch (~> 2.0)
97+ kramdown (~> 1.14)
98+ liquid (~> 4.0)
99+ mercenary (~> 0.3.3)
100+ pathutil (~> 0.9)
101+ rouge (>= 1.7, < 4)
102+ safe_yaml (~> 1.0)
103+ jekyll-avatar (0.6.0)
104+ jekyll (~> 3.0)
105+ jekyll-coffeescript (1.1.1)
106+ coffee-script (~> 2.2)
107+ coffee-script-source (~> 1.11.1)
108+ jekyll-commonmark (1.2.0)
109+ commonmarker (~> 0.14)
110+ jekyll (>= 3.0, < 4.0)
111+ jekyll-commonmark-ghpages (0.1.5)
112+ commonmarker (~> 0.17.6)
113+ jekyll-commonmark (~> 1)
114+ rouge (~> 2)
115+ jekyll-default-layout (0.1.4)
116+ jekyll (~> 3.0)
117+ jekyll-feed (0.11.0)
118+ jekyll (~> 3.3)
119+ jekyll-gist (1.5.0)
120+ octokit (~> 4.2)
121+ jekyll-github-metadata (2.9.4)
122+ jekyll (~> 3.1)
123+ octokit (~> 4.0, != 4.4.0)
124+ jekyll-mentions (1.4.1)
125+ html-pipeline (~> 2.3)
126+ jekyll (~> 3.0)
127+ jekyll-optional-front-matter (0.3.0)
128+ jekyll (~> 3.0)
129+ jekyll-paginate (1.1.0)
130+ jekyll-readme-index (0.2.0)
131+ jekyll (~> 3.0)
132+ jekyll-redirect-from (0.14.0)
133+ jekyll (~> 3.3)
134+ jekyll-relative-links (0.5.3)
135+ jekyll (~> 3.3)
136+ jekyll-remote-theme (0.3.1)
137+ jekyll (~> 3.5)
138+ rubyzip (>= 1.2.1, < 3.0)
139+ jekyll-sass-converter (1.5.2)
140+ sass (~> 3.4)
141+ jekyll-seo-tag (2.5.0)
142+ jekyll (~> 3.3)
143+ jekyll-sitemap (1.2.0)
144+ jekyll (~> 3.3)
145+ jekyll-swiss (0.4.0)
146+ jekyll-theme-architect (0.1.1)
147+ jekyll (~> 3.5)
148+ jekyll-seo-tag (~> 2.0)
149+ jekyll-theme-cayman (0.1.1)
150+ jekyll (~> 3.5)
151+ jekyll-seo-tag (~> 2.0)
152+ jekyll-theme-dinky (0.1.1)
153+ jekyll (~> 3.5)
154+ jekyll-seo-tag (~> 2.0)
155+ jekyll-theme-hacker (0.1.1)
156+ jekyll (~> 3.5)
157+ jekyll-seo-tag (~> 2.0)
158+ jekyll-theme-leap-day (0.1.1)
159+ jekyll (~> 3.5)
160+ jekyll-seo-tag (~> 2.0)
161+ jekyll-theme-merlot (0.1.1)
162+ jekyll (~> 3.5)
163+ jekyll-seo-tag (~> 2.0)
164+ jekyll-theme-midnight (0.1.1)
165+ jekyll (~> 3.5)
166+ jekyll-seo-tag (~> 2.0)
167+ jekyll-theme-minimal (0.1.1)
168+ jekyll (~> 3.5)
169+ jekyll-seo-tag (~> 2.0)
170+ jekyll-theme-modernist (0.1.1)
171+ jekyll (~> 3.5)
172+ jekyll-seo-tag (~> 2.0)
173+ jekyll-theme-primer (0.5.3)
174+ jekyll (~> 3.5)
175+ jekyll-github-metadata (~> 2.9)
176+ jekyll-seo-tag (~> 2.0)
177+ jekyll-theme-slate (0.1.1)
178+ jekyll (~> 3.5)
179+ jekyll-seo-tag (~> 2.0)
180+ jekyll-theme-tactile (0.1.1)
181+ jekyll (~> 3.5)
182+ jekyll-seo-tag (~> 2.0)
183+ jekyll-theme-time-machine (0.1.1)
184+ jekyll (~> 3.5)
185+ jekyll-seo-tag (~> 2.0)
186+ jekyll-titles-from-headings (0.5.1)
187+ jekyll (~> 3.3)
188+ jekyll-watch (2.1.2)
189+ listen (~> 3.0)
190+ jemoji (0.10.1)
191+ gemoji (~> 3.0)
192+ html-pipeline (~> 2.2)
193+ jekyll (~> 3.0)
194+ just-the-docs (0.1.6)
195+ jekyll (~> 3.3)
196+ rake (~> 10.0)
197+ kramdown (1.17.0)
198+ liquid (4.0.0)
199+ listen (3.1.5)
200+ rb-fsevent (~> 0.9, >= 0.9.4)
201+ rb-inotify (~> 0.9, >= 0.9.7)
202+ ruby_dep (~> 1.2)
203+ mercenary (0.3.6)
204+ mini_portile2 (2.4.0)
205+ minima (2.5.0)
206+ jekyll (~> 3.5)
207+ jekyll-feed (~> 0.9)
208+ jekyll-seo-tag (~> 2.1)
209+ minitest (5.11.3)
210+ multipart-post (2.0.0)
211+ nokogiri (1.10.1)
212+ mini_portile2 (~> 2.4.0)
213+ octokit (4.13.0)
214+ sawyer (~> 0.8.0, >= 0.5.3)
215+ pathutil (0.16.2)
216+ forwardable-extended (~> 2.6)
217+ public_suffix (2.0.5)
218+ rake (10.5.0)
219+ rb-fsevent (0.10.3)
220+ rb-inotify (0.10.0)
221+ ffi (~> 1.0)
222+ rouge (2.2.1)
223+ ruby-enum (0.7.2)
224+ i18n
225+ ruby_dep (1.5.0)
226+ rubyzip (1.2.2)
227+ safe_yaml (1.0.4)
228+ sass (3.7.3)
229+ sass-listen (~> 4.0.0)
230+ sass-listen (4.0.0)
231+ rb-fsevent (~> 0.9, >= 0.9.4)
232+ rb-inotify (~> 0.9, >= 0.9.7)
233+ sawyer (0.8.1)
234+ addressable (>= 2.3.5, < 2.6)
235+ faraday (~> 0.8, < 1.0)
236+ terminal-table (1.8.0)
237+ unicode-display_width (~> 1.1, >= 1.1.1)
238+ thread_safe (0.3.6)
239+ typhoeus (1.3.1)
240+ ethon (>= 0.9.0)
241+ tzinfo (1.2.5)
242+ thread_safe (~> 0.1)
243+ unicode-display_width (1.4.1)
244+
245+PLATFORMS
246+ ruby
247+
248+DEPENDENCIES
249+ github-pages
250+ just-the-docs
251+ tzinfo-data
252+
253+BUNDLED WITH
254+ 2.0.1
docs/_config.ymlnew file+42
@@ -0,0 +1,42 @@
1+# Welcome to Jekyll!
2+#
3+# This config file is meant for settings that affect your whole blog, values
4+# which you are expected to set up once and rarely edit after that. If you find
5+# yourself editing this file very often, consider using Jekyll's data files
6+# feature for the data you need to update frequently.
7+#
8+# For technical reasons, this file is *NOT* reloaded automatically when you use
9+# 'bundle exec jekyll serve'. If you change this file, please restart the server process.
10+
11+# Site settings
12+# These are used to personalize your new site. If you look in the HTML files,
13+# you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
14+# You can create any custom variable you would like, and they will be accessible
15+# in the templates via {{ site.myvariable }}.
16+title: OAuth2_Proxy
17+description: >- # this means to ignore newlines until "baseurl:"
18+ OAuth2_Proxy documentation site
19+baseurl: "" # the subpath of your site, e.g. /blog
20+url: "" # the base hostname & protocol for your site, e.g. http://example.com
21+
22+# Build settings
23+markdown: kramdown
24+remote_theme: pmarsceill/just-the-docs
25+search_enabled: true
26+
27+# Aux links for the upper right navigation
28+aux_links:
29+ "OAuth2_Proxy on GitHub":
30+ - "https://github.com/pusher/oauth2_proxy"
31+
32+# Exclude from processing.
33+# The following items will not be processed, by default. Create a custom list
34+# to override the default setting.
35+# exclude:
36+# - Gemfile
37+# - Gemfile.lock
38+# - node_modules
39+# - vendor/bundle/
40+# - vendor/cache/
41+# - vendor/gems/
42+# - vendor/ruby/
docs/assets/js/search-data.jsonnew file+12
@@ -0,0 +1,12 @@
1+---
2+---
3+{
4+ {% for page in site.html_pages %}"{{ forloop.index0 }}": {
5+ "id": "{{ forloop.index0 }}",
6+ "title": "{{ page.title | xml_escape }}",
7+ "content": "{{ page.content | markdownify | strip_html | xml_escape | remove: 'Table of contents' | strip_newlines | replace: '\', ' ' }}",
8+ "url": "{{ page.url | absolute_url | xml_escape }}",
9+ "relUrl": "{{ page.url | xml_escape }}"
10+ }{% if forloop.last %}{% else %},
11+ {% endif %}{% endfor %}
12+}