git.iko.soy/typeable/oauth2-proxy
on master help sign in
add contribution guide to documentation (#2318)

* add contribution guide to doucmentation * fix EOF

commit53cd0b83d3dc455488d24da029f03ee61afbf90c authorJan Larwig <jan@larwig.com> dateMon 13 Nov 2023, 11:27 (3 years ago) parent5e8956b
11 files changed+193−28
contrib/local-environment/dex.yaml+2−2 contrib/local-environment/docker-compose-keycloak.yaml+10−7 contrib/local-environment/docker-compose.yaml+9−7 contrib/local-environment/oauth2-proxy-keycloak.cfg+2−4 contrib/local-environment/oauth2-proxy.cfg+10−5 docs/docs/community/contribution.md+78 docs/sidebars.js+1−1 docs/src/pages/index.md+2−2 docs/static/img/debug-tab.png docs/versioned_docs/version-7.5.x/community/contribution.md+78 docs/versioned_sidebars/version-7.5.x-sidebars.json+1
contrib/local-environment/dex.yaml+2−2
@@ -1,7 +1,7 @@
11# This configuration is intended to be used with the docker-compose testing
22# environment.
33# 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
55storage:
66 type: etcd
77 config:
@@ -19,7 +19,7 @@ staticClients:
1919- id: oauth2-proxy
2020 redirectURIs:
2121 # 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.
2323 - 'http://oauth2-proxy.oauth2-proxy.localhost/oauth2/callback' # For nginx and traefik example.
2424 name: 'OAuth2 Proxy'
2525 secret: b2F1dGgyLXByb3h5LWNsaWVudC1zZWNyZXQK
contrib/local-environment/docker-compose-keycloak.yaml+10−7
@@ -12,7 +12,6 @@
1212# Access http://keycloak.localtest.me:9080 with the same credentials to check out the settings
1313version: '3.0'
1414services:
15−
1615 oauth2-proxy:
1716 container_name: oauth2-proxy
1817 image: quay.io/oauth2-proxy/oauth2-proxy:v7.5.1
@@ -21,6 +20,8 @@ services:
2120 volumes:
2221 - "./oauth2-proxy-keycloak.cfg:/oauth2-proxy.cfg"
2322 restart: unless-stopped
23+ ports:
24+ - 4180:4180/tcp
2425 networks:
2526 keycloak: {}
2627 httpbin: {}
@@ -28,15 +29,17 @@ services:
2829 depends_on:
2930 - httpbin
3031 - keycloak
31− ports:
32− - 4180:4180/tcp
3332
3433 httpbin:
3534 container_name: httpbin
3635 image: kennethreitz/httpbin:latest
3736 hostname: httpbin
37+ ports:
38+ - 8080:80/tcp
3839 networks:
39− httpbin: {}
40+ httpbin:
41+ aliases:
42+ - httpbin.localtest.me
4043
4144 keycloak:
4245 container_name: keycloak
@@ -50,19 +53,19 @@ services:
5053 '-Dkeycloak.migration.action=import',
5154 '-Dkeycloak.migration.provider=dir',
5255 '-Dkeycloak.migration.dir=/realm-config',
53− '-Dkeycloak.migration.strategy=IGNORE_EXISTING',
56+ '-Dkeycloak.migration.strategy=IGNORE_EXISTING'
5457 ]
5558 volumes:
5659 - ./keycloak:/realm-config
5760 environment:
5861 KEYCLOAK_USER: admin@example.com
5962 KEYCLOAK_PASSWORD: password
63+ ports:
64+ - 9080:9080/tcp
6065 networks:
6166 keycloak:
6267 aliases:
6368 - keycloak.localtest.me
64− ports:
65− - 9080:9080/tcp
6669
6770networks:
6871 httpbin: {}
contrib/local-environment/docker-compose.yaml+9−7
@@ -8,19 +8,19 @@
88# Or:
99# make <command> (eg. make up, make down)
1010#
11−# Access http://localhost:4180 to initiate a login cycle
11+# Access http://oauth2-proxy.localtest.me:4180 to initiate a login cycle
1212version: '3.0'
1313services:
1414 oauth2-proxy:
1515 container_name: oauth2-proxy
1616 image: quay.io/oauth2-proxy/oauth2-proxy:v7.5.1
1717 command: --config /oauth2-proxy.cfg
18− ports:
19− - 4180:4180/tcp
2018 hostname: oauth2-proxy
2119 volumes:
2220 - "./oauth2-proxy.cfg:/oauth2-proxy.cfg"
2321 restart: unless-stopped
22+ ports:
23+ - 4180:4180/tcp
2424 networks:
2525 dex: {}
2626 httpbin: {}
@@ -31,16 +31,16 @@ services:
3131 container_name: dex
3232 image: ghcr.io/dexidp/dex:v2.30.3
3333 command: dex serve /dex.yaml
34− ports:
35− - 4190:4190/tcp
3634 hostname: dex
3735 volumes:
3836 - "./dex.yaml:/dex.yaml"
3937 restart: unless-stopped
38+ ports:
39+ - 4190:4190/tcp
4040 networks:
4141 dex:
4242 aliases:
43− - dex.localhost
43+ - dex.localtest.me
4444 etcd: {}
4545 depends_on:
4646 - etcd
@@ -50,7 +50,9 @@ services:
5050 ports:
5151 - 8080:80/tcp
5252 networks:
53− httpbin: {}
53+ httpbin:
54+ aliases:
55+ - httpbin.localtest.me
5456 etcd:
5557 container_name: etcd
5658 image: gcr.io/etcd-development/etcd:v3.4.7
contrib/local-environment/oauth2-proxy-keycloak.cfg+2−4
@@ -1,8 +1,8 @@
11http_address="0.0.0.0:4180"
22cookie_secret="OQINaROshtE9TcZkNAm-5Zs2Pv3xaWytBmc5W7sPX7w="
3−email_domains=["example.com"]
3+email_domains="example.com"
44cookie_secure="false"
5−upstreams="http://httpbin"
5+upstreams="http://httpbin.localtest.me:8080"
66cookie_domains=[".localtest.me"] # Required so cookie can be read on all subdomains.
77whitelist_domains=[".localtest.me"] # Required to allow redirection back to original requested target.
88
@@ -16,5 +16,3 @@ redirect_url="http://oauth2-proxy.localtest.me:4180/oauth2/callback"
1616oidc_issuer_url="http://keycloak.localtest.me:9080/auth/realms/master"
1717provider="oidc"
1818provider_display_name="Keycloak"
19−
20−
contrib/local-environment/oauth2-proxy.cfg+10−5
@@ -1,11 +1,16 @@
11http_address="0.0.0.0:4180"
22cookie_secret="OQINaROshtE9TcZkNAm-5Zs2Pv3xaWytBmc5W7sPX7w="
3−provider="oidc"
43email_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
610client_secret="b2F1dGgyLXByb3h5LWNsaWVudC1zZWNyZXQK"
711client_id="oauth2-proxy"
8−cookie_secure="false"
12+redirect_url="http://oauth2-proxy.localtest.me:4180/oauth2/callback"
913
10−redirect_url="http://localhost:4180/oauth2/callback"
11−upstreams="http://httpbin"
14+oidc_issuer_url="http://dex.localtest.me:4190/dex"
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 = {
6767 id: 'community/security',
6868 },
6969 collapsed: false,
70− items: ['community/security'],
70+ items: ['community/contribution', 'community/security'],
7171 },
7272 ],
7373};
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
1414A list of changes can be seen in the [CHANGELOG](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/CHANGELOG.md).
1515:::
1616
17−![Sign In Page](../../static/img/sign-in-page.png)
17+![Sign In Page](/img/sign-in-page.png)
1818
1919## Architecture
2020
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 @@
3333 "label": "Community",
3434 "collapsed": false,
3535 "items": [
36+ "community/contribution",
3637 "community/security"
3738 ]
3839 }