git.iko.soy/typeable/oauth2-proxy
on master help sign in
add contribution guide to documentation (#2318)
53cd0b8Jan Larwig
contrib/local-environment/dex.yaml+2−2
@@ -1,7 +1,7 @@
1# This configuration is intended to be used with the docker-compose testing
1# This configuration is intended to be used with the docker-compose testing
2# environment.
2# environment.
3# This should configure Dex to run on port 4190 and provides a static login
3# This should configure Dex to run on port 4190 and provides a static login
4−issuer: http://dex.localhost:4190/dex
4+issuer: http://dex.localtest.me:4190/dex
5storage:
5storage:
6 type: etcd
6 type: etcd
7 config:
7 config:
@@ -19,7 +19,7 @@ staticClients:
19- id: oauth2-proxy
19- id: oauth2-proxy
20 redirectURIs:
20 redirectURIs:
21 # These redirect URIs point to the `--redirect-url` for OAuth2 proxy.
21 # These redirect URIs point to the `--redirect-url` for OAuth2 proxy.
22− - 'http://localhost:4180/oauth2/callback' # For basic proxy example.
22+ - 'http://oauth2-proxy.localtest.me:4180/oauth2/callback' # For basic proxy example.
23 - 'http://oauth2-proxy.oauth2-proxy.localhost/oauth2/callback' # For nginx and traefik example.
23 - 'http://oauth2-proxy.oauth2-proxy.localhost/oauth2/callback' # For nginx and traefik example.
24 name: 'OAuth2 Proxy'
24 name: 'OAuth2 Proxy'
25 secret: b2F1dGgyLXByb3h5LWNsaWVudC1zZWNyZXQK
25 secret: b2F1dGgyLXByb3h5LWNsaWVudC1zZWNyZXQK
contrib/local-environment/docker-compose-keycloak.yaml+10−7
@@ -12,7 +12,6 @@
12# Access http://keycloak.localtest.me:9080 with the same credentials to check out the settings
12# Access http://keycloak.localtest.me:9080 with the same credentials to check out the settings
13version: '3.0'
13version: '3.0'
14services:
14services:
15−
16 oauth2-proxy:
15 oauth2-proxy:
17 container_name: oauth2-proxy
16 container_name: oauth2-proxy
18 image: quay.io/oauth2-proxy/oauth2-proxy:v7.5.1
17 image: quay.io/oauth2-proxy/oauth2-proxy:v7.5.1
@@ -21,6 +20,8 @@ services:
21 volumes:
20 volumes:
22 - "./oauth2-proxy-keycloak.cfg:/oauth2-proxy.cfg"
21 - "./oauth2-proxy-keycloak.cfg:/oauth2-proxy.cfg"
23 restart: unless-stopped
22 restart: unless-stopped
23+ ports:
24+ - 4180:4180/tcp
24 networks:
25 networks:
25 keycloak: {}
26 keycloak: {}
26 httpbin: {}
27 httpbin: {}
@@ -28,15 +29,17 @@ services:
28 depends_on:
29 depends_on:
29 - httpbin
30 - httpbin
30 - keycloak
31 - keycloak
31− ports:
32− - 4180:4180/tcp
33
32
34 httpbin:
33 httpbin:
35 container_name: httpbin
34 container_name: httpbin
36 image: kennethreitz/httpbin:latest
35 image: kennethreitz/httpbin:latest
37 hostname: httpbin
36 hostname: httpbin
37+ ports:
38+ - 8080:80/tcp
38 networks:
39 networks:
39− httpbin: {}
40+ httpbin:
41+ aliases:
42+ - httpbin.localtest.me
40
43
41 keycloak:
44 keycloak:
42 container_name: keycloak
45 container_name: keycloak
@@ -50,19 +53,19 @@ services:
50 '-Dkeycloak.migration.action=import',
53 '-Dkeycloak.migration.action=import',
51 '-Dkeycloak.migration.provider=dir',
54 '-Dkeycloak.migration.provider=dir',
52 '-Dkeycloak.migration.dir=/realm-config',
55 '-Dkeycloak.migration.dir=/realm-config',
53− '-Dkeycloak.migration.strategy=IGNORE_EXISTING',
56+ '-Dkeycloak.migration.strategy=IGNORE_EXISTING'
54 ]
57 ]
55 volumes:
58 volumes:
56 - ./keycloak:/realm-config
59 - ./keycloak:/realm-config
57 environment:
60 environment:
58 KEYCLOAK_USER: admin@example.com
61 KEYCLOAK_USER: admin@example.com
59 KEYCLOAK_PASSWORD: password
62 KEYCLOAK_PASSWORD: password
63+ ports:
64+ - 9080:9080/tcp
60 networks:
65 networks:
61 keycloak:
66 keycloak:
62 aliases:
67 aliases:
63 - keycloak.localtest.me
68 - keycloak.localtest.me
64− ports:
65− - 9080:9080/tcp
66
69
67networks:
70networks:
68 httpbin: {}
71 httpbin: {}
contrib/local-environment/docker-compose.yaml+9−7
@@ -8,19 +8,19 @@
8# Or:
8# Or:
9# make <command> (eg. make up, make down)
9# make <command> (eg. make up, make down)
10#
10#
11−# Access http://localhost:4180 to initiate a login cycle
11+# Access http://oauth2-proxy.localtest.me:4180 to initiate a login cycle
12version: '3.0'
12version: '3.0'
13services:
13services:
14 oauth2-proxy:
14 oauth2-proxy:
15 container_name: oauth2-proxy
15 container_name: oauth2-proxy
16 image: quay.io/oauth2-proxy/oauth2-proxy:v7.5.1
16 image: quay.io/oauth2-proxy/oauth2-proxy:v7.5.1
17 command: --config /oauth2-proxy.cfg
17 command: --config /oauth2-proxy.cfg
18− ports:
19− - 4180:4180/tcp
20 hostname: oauth2-proxy
18 hostname: oauth2-proxy
21 volumes:
19 volumes:
22 - "./oauth2-proxy.cfg:/oauth2-proxy.cfg"
20 - "./oauth2-proxy.cfg:/oauth2-proxy.cfg"
23 restart: unless-stopped
21 restart: unless-stopped
22+ ports:
23+ - 4180:4180/tcp
24 networks:
24 networks:
25 dex: {}
25 dex: {}
26 httpbin: {}
26 httpbin: {}
@@ -31,16 +31,16 @@ services:
31 container_name: dex
31 container_name: dex
32 image: ghcr.io/dexidp/dex:v2.30.3
32 image: ghcr.io/dexidp/dex:v2.30.3
33 command: dex serve /dex.yaml
33 command: dex serve /dex.yaml
34− ports:
35− - 4190:4190/tcp
36 hostname: dex
34 hostname: dex
37 volumes:
35 volumes:
38 - "./dex.yaml:/dex.yaml"
36 - "./dex.yaml:/dex.yaml"
39 restart: unless-stopped
37 restart: unless-stopped
38+ ports:
39+ - 4190:4190/tcp
40 networks:
40 networks:
41 dex:
41 dex:
42 aliases:
42 aliases:
43− - dex.localhost
43+ - dex.localtest.me
44 etcd: {}
44 etcd: {}
45 depends_on:
45 depends_on:
46 - etcd
46 - etcd
@@ -50,7 +50,9 @@ services:
50 ports:
50 ports:
51 - 8080:80/tcp
51 - 8080:80/tcp
52 networks:
52 networks:
53− httpbin: {}
53+ httpbin:
54+ aliases:
55+ - httpbin.localtest.me
54 etcd:
56 etcd:
55 container_name: etcd
57 container_name: etcd
56 image: gcr.io/etcd-development/etcd:v3.4.7
58 image: gcr.io/etcd-development/etcd:v3.4.7
contrib/local-environment/oauth2-proxy-keycloak.cfg+2−4
@@ -1,8 +1,8 @@
1http_address="0.0.0.0:4180"
1http_address="0.0.0.0:4180"
2cookie_secret="OQINaROshtE9TcZkNAm-5Zs2Pv3xaWytBmc5W7sPX7w="
2cookie_secret="OQINaROshtE9TcZkNAm-5Zs2Pv3xaWytBmc5W7sPX7w="
3−email_domains=["example.com"]
3+email_domains="example.com"
4cookie_secure="false"
4cookie_secure="false"
5−upstreams="http://httpbin"
5+upstreams="http://httpbin.localtest.me:8080"
6cookie_domains=[".localtest.me"] # Required so cookie can be read on all subdomains.
6cookie_domains=[".localtest.me"] # Required so cookie can be read on all subdomains.
7whitelist_domains=[".localtest.me"] # Required to allow redirection back to original requested target.
7whitelist_domains=[".localtest.me"] # Required to allow redirection back to original requested target.
8
8
@@ -16,5 +16,3 @@ redirect_url="http://oauth2-proxy.localtest.me:4180/oauth2/callback"
16oidc_issuer_url="http://keycloak.localtest.me:9080/auth/realms/master"
16oidc_issuer_url="http://keycloak.localtest.me:9080/auth/realms/master"
17provider="oidc"
17provider="oidc"
18provider_display_name="Keycloak"
18provider_display_name="Keycloak"
19−
20−
contrib/local-environment/oauth2-proxy.cfg+10−5
@@ -1,11 +1,16 @@
1http_address="0.0.0.0:4180"
1http_address="0.0.0.0:4180"
2cookie_secret="OQINaROshtE9TcZkNAm-5Zs2Pv3xaWytBmc5W7sPX7w="
2cookie_secret="OQINaROshtE9TcZkNAm-5Zs2Pv3xaWytBmc5W7sPX7w="
3−provider="oidc"
4email_domains="example.com"
3email_domains="example.com"
5−oidc_issuer_url="http://dex.localhost:4190/dex"
4+cookie_secure="false"
5+upstreams="http://httpbin.localtest.me:8080"
6+cookie_domains=[".localtest.me"] # Required so cookie can be read on all subdomains.
7+whitelist_domains=[".localtest.me"] # Required to allow redirection back to original requested target.
8+
9+# dex provider
6client_secret="b2F1dGgyLXByb3h5LWNsaWVudC1zZWNyZXQK"
10client_secret="b2F1dGgyLXByb3h5LWNsaWVudC1zZWNyZXQK"
7client_id="oauth2-proxy"
11client_id="oauth2-proxy"
8−cookie_secure="false"
12+redirect_url="http://oauth2-proxy.localtest.me:4180/oauth2/callback"
9
13
10−redirect_url="http://localhost:4180/oauth2/callback"
14+oidc_issuer_url="http://dex.localtest.me:4190/dex"
11−upstreams="http://httpbin"
15+provider="oidc"
16+provider_display_name="Dex"
docs/docs/community/contribution.mdnew file+78
@@ -0,0 +1,78 @@
1+---
2+id: contribution
3+title: Contribution Guide
4+---
5+
6+We track bugs and issues using Github.
7+
8+If you find a bug, please open an Issue. When opening an Issue or Pull Request please follow the preconfigured template and take special note of the checkboxes.
9+
10+If you want to fix a bug, add a new feature or extend existing functionality, please create a fork, create a feature branch and open a PR back to this repo.
11+Please mention open bug issue number(s) within your PR if applicable.
12+
13+We suggest using [Visual Studio Code](https://code.visualstudio.com/docs/languages/go) with the official [Go for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=golang.go) extension.
14+
15+
16+# Go version
17+
18+This project is currently still using go 1.19. You can follow the installation guide for go [here.](https://go.dev/doc/install) And you can find go version 1.19 in the archived section [here.](https://go.dev/dl/)
19+
20+# Preparing your fork
21+Clone your fork, create a feature branch and update the depedencies to get started.
22+```bash
23+git clone git@github.com:<YOUR_FORK>/oauth2-proxy
24+cd oauth2-proxy
25+git branch feature/<BRANCH_NAME>
26+git push --set-upstream origin feature/<BRANCH_NAME>
27+go mod download
28+```
29+
30+
31+# Testing / Debugging
32+For starting oauth2-proxy locally open the debugging tab and create the `launch.json` and select `Go: Launch Package`.
33+
34+![Debugging Tab](/img/debug-tab.png)
35+```json
36+{
37+ "version": "0.2.0",
38+ "configurations": [
39+ {
40+ "name": "Launch OAuth2-Proxy with Dex",
41+ "type": "go",
42+ "request": "launch",
43+ "mode": "auto",
44+ "program": "${workspaceFolder}",
45+ "args": [
46+ "--config",
47+ // The following configuration contains settings for a locally deployed
48+ // upstream and dex as an idetity provider
49+ "contrib/local-environment/oauth2-proxy.cfg"
50+ ]
51+ },
52+ {
53+ "name": "Launch OAuth2-Proxy with Keycloak",
54+ "type": "go",
55+ "request": "launch",
56+ "mode": "auto",
57+ "program": "${workspaceFolder}",
58+ "args": [
59+ "--config",
60+ // The following configuration contains settings for a locally deployed
61+ // upstream and keycloak as an idetity provider
62+ "contrib/local-environment/oauth2-proxy-keycloak.cfg"
63+ ]
64+ }
65+ ]
66+}
67+```
68+
69+Before you can start your local version of oauth2-proxy, you will have to use the provided docker compose files to start a local upstream service and identity provider. We suggest using [httpbin](https://hub.docker.com/r/kennethreitz/httpbin) as your upstream for testing as it allows for request and response introspection of all things HTTP.
70+
71+Open a terminal and switch to the `contrib/local-environment` directory.
72+
73+- Dex as your IdP: `docker compose -f docker-compose.yaml up dex etcd httpbin`
74+- Keycloak as your IdP: `docker compose -f docker-compose-keycloak.yaml up keycloak httpbin`
75+
76+The username for both is `admin@example.com` and password is `password`.
77+
78+Start oauth2-proxy from the debug tab and open http://oauth2-proxy.localtest.me:4180/ for testing.
docs/sidebars.js+1−1
@@ -67,7 +67,7 @@ module.exports = {
67 id: 'community/security',
67 id: 'community/security',
68 },
68 },
69 collapsed: false,
69 collapsed: false,
70− items: ['community/security'],
70+ items: ['community/contribution', 'community/security'],
71 },
71 },
72 ],
72 ],
73};
73};
docs/src/pages/index.md+2−2
@@ -14,8 +14,8 @@ Versions v3.0.0 and up are from this fork and will have diverged from any change
14A list of changes can be seen in the [CHANGELOG](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/CHANGELOG.md).
14A list of changes can be seen in the [CHANGELOG](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/CHANGELOG.md).
15:::
15:::
16
16
17−![Sign In Page](../../static/img/sign-in-page.png)
17+![Sign In Page](/img/sign-in-page.png)
18
18
19## Architecture
19## Architecture
20
20
21−![OAuth2 Proxy Architecture](../../static/img/architecture.png)
21+![OAuth2 Proxy Architecture](/img/architecture.png)
docs/static/img/debug-tab.pngnew file

Binary file not shown.

docs/versioned_docs/version-7.5.x/community/contribution.mdnew file+78
@@ -0,0 +1,78 @@
1+---
2+id: contribution
3+title: Contribution Guide
4+---
5+
6+We track bugs and issues using Github.
7+
8+If you find a bug, please open an Issue. When opening an Issue or Pull Request please follow the preconfigured template and take special note of the checkboxes.
9+
10+If you want to fix a bug, add a new feature or extend existing functionality, please create a fork, create a feature branch and open a PR back to this repo.
11+Please mention open bug issue number(s) within your PR if applicable.
12+
13+We suggest using [Visual Studio Code](https://code.visualstudio.com/docs/languages/go) with the official [Go for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=golang.go) extension.
14+
15+
16+# Go version
17+
18+This project is currently still using go 1.19. You can follow the installation guide for go [here.](https://go.dev/doc/install) And you can find go version 1.19 in the archived section [here.](https://go.dev/dl/)
19+
20+# Preparing your fork
21+Clone your fork, create a feature branch and update the depedencies to get started.
22+```bash
23+git clone git@github.com:<YOUR_FORK>/oauth2-proxy
24+cd oauth2-proxy
25+git branch feature/<BRANCH_NAME>
26+git push --set-upstream origin feature/<BRANCH_NAME>
27+go mod download
28+```
29+
30+
31+# Testing / Debugging
32+For starting oauth2-proxy locally open the debugging tab and create the `launch.json` and select `Go: Launch Package`.
33+
34+![Debugging Tab](/img/debug-tab.png)
35+```json
36+{
37+ "version": "0.2.0",
38+ "configurations": [
39+ {
40+ "name": "Launch OAuth2-Proxy with Dex",
41+ "type": "go",
42+ "request": "launch",
43+ "mode": "auto",
44+ "program": "${workspaceFolder}",
45+ "args": [
46+ "--config",
47+ // The following configuration contains settings for a locally deployed
48+ // upstream and dex as an idetity provider
49+ "contrib/local-environment/oauth2-proxy.cfg"
50+ ]
51+ },
52+ {
53+ "name": "Launch OAuth2-Proxy with Keycloak",
54+ "type": "go",
55+ "request": "launch",
56+ "mode": "auto",
57+ "program": "${workspaceFolder}",
58+ "args": [
59+ "--config",
60+ // The following configuration contains settings for a locally deployed
61+ // upstream and keycloak as an idetity provider
62+ "contrib/local-environment/oauth2-proxy-keycloak.cfg"
63+ ]
64+ }
65+ ]
66+}
67+```
68+
69+Before you can start your local version of oauth2-proxy, you will have to use the provided docker compose files to start a local upstream service and identity provider. We suggest using [httpbin](https://hub.docker.com/r/kennethreitz/httpbin) as your upstream for testing as it allows for request and response introspection of all things HTTP.
70+
71+Open a terminal and switch to the `contrib/local-environment` directory.
72+
73+- Dex as your IdP: `docker compose -f docker-compose.yaml up dex etcd httpbin`
74+- Keycloak as your IdP: `docker compose -f docker-compose-keycloak.yaml up keycloak httpbin`
75+
76+The username for both is `admin@example.com` and password is `password`.
77+
78+Start oauth2-proxy from the debug tab and open http://oauth2-proxy.localtest.me:4180/ for testing.
docs/versioned_sidebars/version-7.5.x-sidebars.json+1
@@ -33,6 +33,7 @@
33 "label": "Community",
33 "label": "Community",
34 "collapsed": false,
34 "collapsed": false,
35 "items": [
35 "items": [
36+ "community/contribution",
36 "community/security"
37 "community/security"
37 ]
38 ]
38 }
39 }