git.iko.soy/typeable/oauth2-proxy
on 638fba4 help sign in
292 files changed+2059−15514
since splitsnapshots
unifiedsplit
.devcontainer/Dockerfile+1−1 .github/ISSUE_TEMPLATE/config.yml+2−2 .github/PULL_REQUEST_TEMPLATE.md+2−3 .github/renovate.json5−9 .github/workflows/ci.yml+20−57 .github/workflows/codeql.yml+4−4 .github/workflows/create-release.yml+2−2 .github/workflows/docs.yml+7−7 .github/workflows/labeler.yml+1−1 .github/workflows/nightly.yml+4−4 .github/workflows/publish-release.yml+22−22 .github/workflows/stale.yml+1−1 .github/workflows/test.sh+26 .golangci.yml−8 ADOPTERS.md+28 CHANGELOG.md−307 CODE_OF_CONDUCT.md+103−81 DCO.md−34 MAINTAINERS+5−2 MAINTAINERS.md−33 Makefile+5−10 README.md+19−34 contrib/local-environment/Makefile+2−2 contrib/local-environment/dex-traefik.yaml−25 contrib/local-environment/dex.yaml+17−13 contrib/local-environment/docker-compose-alpha-config.yaml+16−3 contrib/local-environment/docker-compose-gitea.yaml+2−2 contrib/local-environment/docker-compose-keycloak.yaml+6−6 contrib/local-environment/docker-compose-nginx.yaml+33−9 contrib/local-environment/docker-compose-traefik.yaml+18−42 contrib/local-environment/docker-compose.yaml+16−3 contrib/local-environment/kubernetes/Chart.lock+3−3 contrib/local-environment/kubernetes/Chart.yaml+1−1 contrib/local-environment/nginx.conf+73−31 contrib/local-environment/oauth2-proxy-nginx.cfg+6−11 contrib/local-environment/oauth2-proxy-traefik.cfg+4−4 contrib/local-environment/traefik/dynamic.yaml+4−11 contrib/local-environment/traefik/traefik.yaml−2 dist.sh+3−10 docs/docs/behaviour.md+5−20 docs/docs/community/contribution.md+3−3 docs/docs/community/security.md+1−1 docs/docs/configuration/alpha_config.md+9−164 docs/docs/configuration/alpha_config.md.tmpl+6−159 docs/docs/configuration/integration.md+310 docs/docs/configuration/integrations/caddy.md−63 docs/docs/configuration/integrations/headlamp.md−105 docs/docs/configuration/integrations/index.md−41 docs/docs/configuration/integrations/kubernetes-dashboard.md−289 docs/docs/configuration/integrations/nginx.md−190 docs/docs/configuration/integrations/traefik.md−192 docs/docs/configuration/overview.md+13−58 docs/docs/configuration/providers/atlassian.md−26 docs/docs/configuration/providers/cisco_duo.md−44 docs/docs/configuration/providers/dtt_sso.md−45 docs/docs/configuration/providers/gitlab.md+1−1 docs/docs/configuration/providers/index.md−3 docs/docs/configuration/providers/ms_entra_id.md−4 docs/docs/configuration/sessions.md+2−2 docs/docs/configuration/systemd_socket.md−8 docs/docs/features/endpoints.md+1−15 docs/docs/installation.md+1−1 docs/docs/welcome.md−10 docs/docusaurus.config.js+2−2 docs/package.json+1−4 docs/sidebars.js+1−19 docs/versioned_docs/version-7.0.x/behaviour.md+1−1 docs/versioned_docs/version-7.1.x/behaviour.md+1−1 docs/versioned_docs/version-7.10.x/behaviour.md+5−20 docs/versioned_docs/version-7.10.x/configuration/integration.md+1−77 docs/versioned_docs/version-7.10.x/configuration/overview.md−1 docs/versioned_docs/version-7.10.x/configuration/providers/gitlab.md+1−1 docs/versioned_docs/version-7.11.x/behaviour.md+5−20 docs/versioned_docs/version-7.11.x/configuration/integration.md+1−77 docs/versioned_docs/version-7.11.x/configuration/overview.md−1 docs/versioned_docs/version-7.11.x/configuration/providers/gitlab.md+1−1 docs/versioned_docs/version-7.12.x/behaviour.md+5−20 docs/versioned_docs/version-7.12.x/configuration/integration.md+1−77 docs/versioned_docs/version-7.12.x/configuration/overview.md+2−3 docs/versioned_docs/version-7.12.x/configuration/providers/gitlab.md+1−1 docs/versioned_docs/version-7.13.x/behaviour.md+5−20 docs/versioned_docs/version-7.13.x/configuration/integration.md+310 docs/versioned_docs/version-7.13.x/configuration/integrations/caddy.md−63 docs/versioned_docs/version-7.13.x/configuration/integrations/headlamp.md−105 docs/versioned_docs/version-7.13.x/configuration/integrations/index.md−41 docs/versioned_docs/version-7.13.x/configuration/integrations/kubernetes-dashboard.md−289 docs/versioned_docs/version-7.13.x/configuration/integrations/nginx.md−174 docs/versioned_docs/version-7.13.x/configuration/integrations/traefik.md−192 docs/versioned_docs/version-7.13.x/configuration/overview.md+2−3 docs/versioned_docs/version-7.13.x/configuration/providers/cisco_duo.md−44 docs/versioned_docs/version-7.13.x/configuration/providers/gitlab.md+1−1 docs/versioned_docs/version-7.13.x/configuration/providers/index.md−1 docs/versioned_docs/version-7.13.x/features/endpoints.md+1−1 docs/versioned_docs/version-7.14.x/behaviour.md−26 docs/versioned_docs/version-7.14.x/community/contribution.md−91 docs/versioned_docs/version-7.14.x/community/security.md−49 docs/versioned_docs/version-7.14.x/configuration/alpha_config.md−637 docs/versioned_docs/version-7.14.x/configuration/alpha_config.md.tmpl−218 docs/versioned_docs/version-7.14.x/configuration/integrations/caddy.md−63 docs/versioned_docs/version-7.14.x/configuration/integrations/headlamp.md−105 docs/versioned_docs/version-7.14.x/configuration/integrations/index.md−41 docs/versioned_docs/version-7.14.x/configuration/integrations/kubernetes-dashboard.md−289 docs/versioned_docs/version-7.14.x/configuration/integrations/nginx.md−174 docs/versioned_docs/version-7.14.x/configuration/integrations/traefik.md−192 docs/versioned_docs/version-7.14.x/configuration/overview.md−407 docs/versioned_docs/version-7.14.x/configuration/providers/adfs.md−19 docs/versioned_docs/version-7.14.x/configuration/providers/bitbucket.md−25 docs/versioned_docs/version-7.14.x/configuration/providers/cidaas.md−37 docs/versioned_docs/version-7.14.x/configuration/providers/cisco_duo.md−44 docs/versioned_docs/version-7.14.x/configuration/providers/digitalocean.md−21 docs/versioned_docs/version-7.14.x/configuration/providers/facebook.md−7 docs/versioned_docs/version-7.14.x/configuration/providers/gitea.md−24 docs/versioned_docs/version-7.14.x/configuration/providers/github.md−81 docs/versioned_docs/version-7.14.x/configuration/providers/gitlab.md−49 docs/versioned_docs/version-7.14.x/configuration/providers/google.md−84 docs/versioned_docs/version-7.14.x/configuration/providers/index.md−46 docs/versioned_docs/version-7.14.x/configuration/providers/keycloak.md−36 docs/versioned_docs/version-7.14.x/configuration/providers/keycloak_oidc.md−151 docs/versioned_docs/version-7.14.x/configuration/providers/linkedin.md−13 docs/versioned_docs/version-7.14.x/configuration/providers/login_gov.md−79 docs/versioned_docs/version-7.14.x/configuration/providers/ms_azure_ad.md−59 docs/versioned_docs/version-7.14.x/configuration/providers/ms_entra_id.md−197 docs/versioned_docs/version-7.14.x/configuration/providers/nextcloud.md−28 docs/versioned_docs/version-7.14.x/configuration/providers/openid_connect.md−146 docs/versioned_docs/version-7.14.x/configuration/providers/sourcehut.md−25 docs/versioned_docs/version-7.14.x/configuration/sessions.md−99 docs/versioned_docs/version-7.14.x/configuration/systemd_socket.md−43 docs/versioned_docs/version-7.14.x/configuration/tls.md−85 docs/versioned_docs/version-7.14.x/features/endpoints.md−59 docs/versioned_docs/version-7.14.x/installation.md−32 docs/versioned_docs/version-7.14.x/welcome.md−32 docs/versioned_docs/version-7.15.x/behaviour.md−26 docs/versioned_docs/version-7.15.x/community/contribution.md−91 docs/versioned_docs/version-7.15.x/community/security.md−49 docs/versioned_docs/version-7.15.x/configuration/alpha_config.md−702 docs/versioned_docs/version-7.15.x/configuration/alpha_config.md.tmpl−281 docs/versioned_docs/version-7.15.x/configuration/integrations/caddy.md−63 docs/versioned_docs/version-7.15.x/configuration/integrations/headlamp.md−105 docs/versioned_docs/version-7.15.x/configuration/integrations/index.md−41 docs/versioned_docs/version-7.15.x/configuration/integrations/kubernetes-dashboard.md−289 docs/versioned_docs/version-7.15.x/configuration/integrations/nginx.md−174 docs/versioned_docs/version-7.15.x/configuration/integrations/traefik.md−192 docs/versioned_docs/version-7.15.x/configuration/overview.md−451 docs/versioned_docs/version-7.15.x/configuration/providers/adfs.md−19 docs/versioned_docs/version-7.15.x/configuration/providers/bitbucket.md−25 docs/versioned_docs/version-7.15.x/configuration/providers/cidaas.md−37 docs/versioned_docs/version-7.15.x/configuration/providers/cisco_duo.md−44 docs/versioned_docs/version-7.15.x/configuration/providers/digitalocean.md−21 docs/versioned_docs/version-7.15.x/configuration/providers/facebook.md−7 docs/versioned_docs/version-7.15.x/configuration/providers/gitea.md−24 docs/versioned_docs/version-7.15.x/configuration/providers/github.md−81 docs/versioned_docs/version-7.15.x/configuration/providers/gitlab.md−49 docs/versioned_docs/version-7.15.x/configuration/providers/google.md−84 docs/versioned_docs/version-7.15.x/configuration/providers/index.md−46 docs/versioned_docs/version-7.15.x/configuration/providers/keycloak.md−36 docs/versioned_docs/version-7.15.x/configuration/providers/keycloak_oidc.md−151 docs/versioned_docs/version-7.15.x/configuration/providers/linkedin.md−13 docs/versioned_docs/version-7.15.x/configuration/providers/login_gov.md−79 docs/versioned_docs/version-7.15.x/configuration/providers/ms_azure_ad.md−59 docs/versioned_docs/version-7.15.x/configuration/providers/ms_entra_id.md−201 docs/versioned_docs/version-7.15.x/configuration/providers/nextcloud.md−28 docs/versioned_docs/version-7.15.x/configuration/providers/openid_connect.md−146 docs/versioned_docs/version-7.15.x/configuration/providers/sourcehut.md−25 docs/versioned_docs/version-7.15.x/configuration/sessions.md−99 docs/versioned_docs/version-7.15.x/configuration/systemd_socket.md−51 docs/versioned_docs/version-7.15.x/configuration/tls.md−85 docs/versioned_docs/version-7.15.x/features/endpoints.md−73 docs/versioned_docs/version-7.15.x/installation.md−32 docs/versioned_docs/version-7.15.x/welcome.md−33 docs/versioned_docs/version-7.2.x/behaviour.md+5−20 docs/versioned_docs/version-7.3.x/behaviour.md+5−20 docs/versioned_docs/version-7.4.x/behaviour.md+5−20 docs/versioned_docs/version-7.5.x/behaviour.md+5−20 docs/versioned_docs/version-7.6.x/behaviour.md+5−20 docs/versioned_docs/version-7.6.x/configuration/overview.md−1 docs/versioned_docs/version-7.6.x/configuration/providers/gitlab.md+1−1 docs/versioned_docs/version-7.7.x/behaviour.md+5−20 docs/versioned_docs/version-7.7.x/configuration/overview.md−1 docs/versioned_docs/version-7.7.x/configuration/providers/gitlab.md+1−1 docs/versioned_docs/version-7.8.x/behaviour.md+5−20 docs/versioned_docs/version-7.8.x/configuration/overview.md−1 docs/versioned_docs/version-7.8.x/configuration/providers/gitlab.md+1−1 docs/versioned_docs/version-7.9.x/behaviour.md+5−20 docs/versioned_docs/version-7.9.x/configuration/overview.md−1 docs/versioned_docs/version-7.9.x/configuration/providers/gitlab.md+1−1 docs/versioned_sidebars/version-7.13.x-sidebars.json+1−17 docs/versioned_sidebars/version-7.14.x-sidebars.json−100 docs/versioned_sidebars/version-7.15.x-sidebars.json−100 docs/versions.json−2 go.mod+48−45 go.sum+110−110 main.go−14 main_test.go+20−97 oauthproxy.go+31−61 oauthproxy_test.go+65−342 pkg/apis/middleware/scope.go+1−48 pkg/apis/middleware/scope_test.go−34 pkg/apis/middleware/session.go+1−4 pkg/apis/options/cookie.go−3 pkg/apis/options/header.go+2−4 pkg/apis/options/legacy_options.go+28−50 pkg/apis/options/legacy_options_test.go+67−103 pkg/apis/options/load.go+3−3 pkg/apis/options/load_test.go+2−2 pkg/apis/options/options.go−2 pkg/apis/options/providers.go+13−35 pkg/apis/options/server.go−9 pkg/apis/options/upstreams.go+15−35 pkg/apis/sessions/session_state.go+1−17 pkg/apis/sessions/session_state_test.go+12−102 pkg/app/redirect/director_test.go+2−33 pkg/authentication/hmacauth/hmacauth_test.go+1−1 pkg/cookies/cookies.go+8−18 pkg/cookies/cookies_suite_test.go−4 pkg/cookies/cookies_test.go+51−39 pkg/cookies/csrf.go+15−34 pkg/cookies/csrf_per_request_test.go+7−12 pkg/cookies/csrf_test.go+1−284 pkg/proxyhttp/http_suite_test.go → pkg/http/http_suite_test.go+1−1 pkg/proxyhttp/server.go → pkg/http/server.go+3−51 pkg/proxyhttp/server_group.go → pkg/http/server_group.go+1−1 pkg/proxyhttp/server_group_test.go → pkg/http/server_group_test.go+1−1 pkg/proxyhttp/server_test.go → pkg/http/server_test.go+1−51 pkg/proxyhttp/systemd_socket.go → pkg/http/systemd_socket.go+1−1 pkg/proxyhttp/systemd_unsupported.go → pkg/http/systemd_unsupported.go+1−1 pkg/ip/parse_ip_net.go−16 pkg/ip/parse_ip_net_test.go−118 pkg/ip/realclientip.go+1−7 pkg/ip/realclientip_test.go−4 pkg/middleware/headers.go+1−1 pkg/middleware/headers_test.go+5−5 pkg/middleware/healthcheck.go+4−7 pkg/middleware/healthcheck_test.go+9−31 pkg/middleware/jwt_session_test.go+2−2 pkg/middleware/redirect_to_https_test.go−15 pkg/middleware/scope.go+3−5 pkg/middleware/scope_test.go+4−18 pkg/middleware/stored_session.go+2−46 pkg/middleware/stored_session_test.go−51 pkg/providers/oidc/provider_verifier.go+1−36 pkg/providers/oidc/provider_verifier_test.go−92 pkg/providers/util/claim_extractor.go+74−10 pkg/providers/util/claim_extractor_test.go+53−2 pkg/requests/builder_test.go+15−15 pkg/requests/util/util.go+15−28 pkg/requests/util/util_test.go+12−74 pkg/sessions/cookie/session_store.go+13−23 pkg/sessions/persistence/ticket.go+14−23 pkg/sessions/redis/redis_store.go+8−15 pkg/sessions/redis/redis_store_test.go−50 pkg/sessions/tests/session_store_tests.go+1−11 pkg/upstream/http.go+18−66 pkg/upstream/http_test.go+14−109 pkg/upstream/proxy.go+14−14 pkg/upstream/proxy_test.go+6−38 pkg/upstream/upstream_suite_test.go+1−3 pkg/util/ptr/ptr.go+2−2 pkg/util/ptr/ptr_test.go+6−6 pkg/util/util.go−64 pkg/util/util_test.go−70 pkg/validation/allowlist.go−13 pkg/validation/allowlist_test.go−30 pkg/validation/header.go−1 pkg/validation/options_test.go+2−2 pkg/validation/providers.go+1−35 pkg/validation/providers_test.go−53 pkg/validation/upstreams.go+3−4 pkg/validation/upstreams_test.go+6−24 providers/adfs_test.go+1−1 providers/atlassian-cloud.go−99 providers/atlassian-cloud_test.go−93 providers/azure.go+2−3 providers/dtt_sso.go−202 providers/dtt_sso_test.go−237 providers/google.go+4−4 providers/internal_util.go+1−2 providers/internal_util_test.go−6 providers/keycloak_oidc.go−1 providers/logingov.go+1−2 providers/ms_entra_id.go+1−4 providers/ms_entra_id_test.go+3−3 providers/oidc.go+7−5 providers/provider_data.go+5−44 providers/provider_data_test.go−23 providers/provider_default.go+1−3 providers/provider_default_test.go−12 providers/providers.go+3−9 providers/providers_test.go+4−94 providers/srht.go+1−2 providers/util_test.go−33 validator.go+1−4 validator_test.go−21
.devcontainer/Dockerfile+1−1
@@ -1,4 +1,4 @@
1−FROM mcr.microsoft.com/vscode/devcontainers/go:1-1.26
1+FROM mcr.microsoft.com/vscode/devcontainers/go:1-1.23
22
33SHELL ["/bin/bash", "-o", "pipefail", "-c"]
44
.github/ISSUE_TEMPLATE/config.yml+2−2
@@ -1,6 +1,6 @@
11blank_issues_enabled: false
22contact_links:
3− - name: OAuth2 Proxy Slack
4− url: https://cloud-native.slack.com/archives/C098Y5URZ2N
3+ - name: OAuth2-Proxy Slack
4+ url: https://gophers.slack.com/messages/CM2RSS25N
55 about: Feel free to ask any questions here.
66
.github/PULL_REQUEST_TEMPLATE.md+2−3
@@ -20,8 +20,7 @@
2020<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
2121<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
2222
23−- [ ] I have added an entry for my changes to the [CHANGELOG.md](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/CHANGELOG.md).
24−- [ ] I have [signed off](https://github.com/apps/dco) all my commits.
23+- [ ] My change requires a change to the documentation or CHANGELOG.
24+- [ ] I have updated the documentation/CHANGELOG accordingly.
2525- [ ] I have created a feature (non-master) branch for my PR.
26−- [ ] I have used [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#examples) for the PR title.
2726- [ ] I have written tests for my code changes.
.github/renovate.json5−9
@@ -46,15 +46,6 @@
4646 depNameTemplate: "alpine",
4747 datasourceTemplate: "docker",
4848 },
49− {
50− customType: "regex",
51− fileMatch: [
52− "^Makefile",
53− ],
54− matchStrings: [
55− "# renovate: datasource=(?<datasource>.*?) depName=(?<depName>.*?)\\s+?GOLANGCILINT_VERSION \\?= (?<currentValue>.*)\\s",
56− ],
57− },
5849 {
5950 customType: "regex",
6051 fileMatch: ["(^|/)\\.github/workflows/[^/]+\\.ya?ml$"],
.github/workflows/ci.yml+20−57
@@ -7,33 +7,29 @@ on:
77 pull_request:
88 branches:
99 - '**'
10− workflow_dispatch:
11−
12−permissions:
13− contents: read
14− id-token: write
15− security-events: write
16−
1710jobs:
1811 build:
1912 runs-on: ubuntu-latest
13+ env:
14+ COVER: true
2015 steps:
2116 - name: Check out code
22− uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
23− with:
24− fetch-depth: 0
25−
26− - name: Get Go version
27− run: |
28− version=$(grep "^go " go.mod | cut -d' ' -f2 | cut -d. -f1,2)
29− echo "version=${version}" >> "$GITHUB_OUTPUT"
30− id: go-version
17+ uses: actions/checkout@v5
3118
3219 - name: Set up Go
33− uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
20+ uses: actions/setup-go@v6
3421 with:
35− go-version: ${{ steps.go-version.outputs.version }}
36− check-latest: true
22+ go-version-file: go.mod
23+ id: go
24+
25+ - name: Get dependencies
26+ env:
27+ # renovate: datasource=github-tags depName=golangci/golangci-lint
28+ GOLANGCI_LINT_VERSION: v2.5.0
29+ run: |
30+ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}
31+ curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
32+ chmod +x ./cc-test-reporter
3733
3834 - name: Verify Code Generation
3935 run: |
@@ -56,55 +52,22 @@ jobs:
5652
5753 - name: Test
5854 env:
59− COVER: true
60− run: |
61− make test
62−
63− - name: Generate Coverage Report
64− if: github.event_name == 'push'
55+ CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
6556 run: |
66− go install github.com/jandelgado/gcov2lcov@25681830fb515e3d4c117e136b4f049e21efb4d0
67− gcov2lcov -infile=c.out -outfile=lcov.info
68−
69− - name: Upload Coverage Report
70− if: github.event_name == 'push'
71− uses: qltysh/qlty-action/coverage@08a0a862c159eae9b9003081da6663d96efef637 # v2.3.0
72− with:
73− oidc: true
74− files: lcov.info
75−
76− - name: Run Trivy vulnerability scanner
77− if: (!startsWith(github.head_ref, 'release'))
78− uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
79− with:
80− scan-type: 'rootfs'
81− scan-ref: './oauth2-proxy'
82− severity: 'CRITICAL,HIGH'
83− hide-progress: true
84− format: 'sarif'
85− output: 'trivy-results.sarif'
86− exit-code: '0'
87−
88− - name: Upload Trivy scan results
89− if: (!startsWith(github.head_ref, 'release'))
90− uses: github/codeql-action/upload-sarif@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v4.37.7
91− with:
92− sarif_file: 'trivy-results.sarif'
57+ ./.github/workflows/test.sh
9358
9459 docker:
9560 runs-on: ubuntu-latest
9661 steps:
9762 - name: Check out code
98− uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
99− with:
100− fetch-depth: 0
63+ uses: actions/checkout@v5
10164
10265 - name: Set up QEMU
103− uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
66+ uses: docker/setup-qemu-action@v3
10467
10568 - name: Set up Docker Buildx
10669 id: buildx
107− uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
70+ uses: docker/setup-buildx-action@v3
10871
10972 - name: Docker Build
11073 if: (!startsWith(github.head_ref, 'release'))
.github/workflows/codeql.yml+4−4
@@ -32,18 +32,18 @@ jobs:
3232
3333 steps:
3434 - name: Checkout repository
35− uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
35+ uses: actions/checkout@v5
3636
3737 # Initializes the CodeQL tools for scanning.
3838 - name: Initialize CodeQL
39− uses: github/codeql-action/init@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v4.37.7
39+ uses: github/codeql-action/init@v3
4040 with:
4141 languages: go
4242
4343 # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
4444 # If this step fails, then you should remove it and run the build manually (see below)
4545 - name: Autobuild
46− uses: github/codeql-action/autobuild@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v4.37.7
46+ uses: github/codeql-action/autobuild@v3
4747
4848 # ℹ️ Command-line programs to run using the OS shell.
4949 # 📚 https://git.io/JvXDl
@@ -57,4 +57,4 @@ jobs:
5757 # make release
5858
5959 - name: Perform CodeQL Analysis
60− uses: github/codeql-action/analyze@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v4.37.7
60+ uses: github/codeql-action/analyze@v3
.github/workflows/create-release.yml+2−2
@@ -17,7 +17,7 @@ jobs:
1717 runs-on: ubuntu-latest
1818 steps:
1919 - name: Check out code
20− uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
20+ uses: actions/checkout@v5
2121 with:
2222 ref: master
2323 fetch-depth: 0
@@ -54,7 +54,7 @@ jobs:
5454 git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
5555
5656 - name: Setup node
57− uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
57+ uses: actions/setup-node@v6
5858 with:
5959 node-version-file: docs/package.json
6060
.github/workflows/docs.yml+7−7
@@ -14,13 +14,13 @@ jobs:
1414 if: github.event_name == 'pull_request'
1515 runs-on: ubuntu-latest
1616 steps:
17− - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
17+ - uses: actions/checkout@v5
1818
1919 - name: Setup Pages
2020 id: pages
21− uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
21+ uses: actions/configure-pages@v5
2222
23− - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
23+ - uses: actions/setup-node@v6
2424 with:
2525 # renovate: datasource=node-version depName=node
2626 node-version: 24
@@ -35,9 +35,9 @@ jobs:
3535 if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
3636 runs-on: ubuntu-latest
3737 steps:
38− - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
38+ - uses: actions/checkout@v5
3939
40− - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
40+ - uses: actions/setup-node@v6
4141 with:
4242 # renovate: datasource=node-version depName=node
4343 node-version: 24
@@ -49,7 +49,7 @@ jobs:
4949 npm run build
5050
5151 - name: Upload artifact
52− uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
52+ uses: actions/upload-pages-artifact@v3
5353 with:
5454 path: ./docs/build
5555
@@ -65,4 +65,4 @@ jobs:
6565 steps:
6666 - name: Deploy to GitHub Pages
6767 id: deployment
68− uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0
68+ uses: actions/deploy-pages@v4
.github/workflows/labeler.yml+1−1
@@ -9,7 +9,7 @@ jobs:
99 pull-requests: write
1010 runs-on: ubuntu-latest
1111 steps:
12− - uses: actions/labeler@bf12e9b00b37c5c0ca2b87b79b2daf7891dbda13 # v7.0.0
12+ - uses: actions/labeler@v6
1313 with:
1414 sync-labels: true
1515 dot: true
.github/workflows/nightly.yml+4−4
@@ -12,21 +12,21 @@ jobs:
1212 if: github.repository == 'oauth2-proxy/oauth2-proxy'
1313 steps:
1414 - name: Check out code
15− uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
15+ uses: actions/checkout@v5
1616 with:
1717 ref: master
1818 fetch-depth: 0
1919 fetch-tags: true
2020
2121 - name: Set up QEMU
22− uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
22+ uses: docker/setup-qemu-action@v3
2323
2424 - name: Set up Docker Buildx
2525 id: buildx
26− uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
26+ uses: docker/setup-buildx-action@v3
2727
2828 - name: Login to quay.io
29− uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
29+ uses: docker/login-action@v3
3030 with:
3131 registry: quay.io/oauth2-proxy
3232 username: ${{ secrets.REGISTRY_USERNAME_NIGHTLY }}
.github/workflows/publish-release.yml+22−22
@@ -14,49 +14,49 @@ permissions:
1414
1515jobs:
1616 publish:
17− if: github.event.pull_request.merged && startsWith(github.event.pull_request.head.ref, 'release/') && github.event.pull_request.head.repo.full_name == github.repository
17+ if: github.event.pull_request.merged && startsWith(github.event.pull_request.head.ref, 'release/')
1818 runs-on: ubuntu-latest
1919 outputs:
2020 tag: ${{ steps.tag.outputs.version }}
2121 steps:
2222 - name: Check out code
23− uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
23+ uses: actions/checkout@v5
2424 with:
2525 ref: ${{ github.event.pull_request.merge_commit_sha }}
2626 fetch-depth: 0
2727 fetch-tags: true
2828
2929 - name: Tag release
30− env:
31− BRANCH: ${{ github.event.pull_request.head.ref }}
3230 run: |
3331 # Set up github-actions[bot] user
3432 git config --local user.name "github-actions[bot]"
3533 git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
3634
3735 # Get the version from the branch name
38− version="${BRANCH#release/}"
36+ branch="${{ github.event.pull_request.head.ref }}"
37+ version="${branch#release/}"
3938 echo ${version}
4039
4140 # Tag and create release
4241 git tag -a "${version}" -m "Release ${version}"
4342 echo "version=${version}" >> $GITHUB_OUTPUT
4443 id: tag
45−
46− - name: Get Go version
47− run: |
48− version=$(grep "^go " go.mod | cut -d' ' -f2 | cut -d. -f1,2)
49− echo "version=${version}" >> "$GITHUB_OUTPUT"
50− id: go-version
51−
52− - name: Set up Go
53− uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
44+
45+ - name: Set up go
46+ uses: actions/setup-go@v6
5447 with:
55− go-version: ${{ steps.go-version.outputs.version }}
56− check-latest: true
48+ go-version-file: go.mod
5749
58− - name: Get go dependencies
50+ - name: Get dependencies
51+ env:
52+ # renovate: datasource=github-tags depName=golangci/golangci-lint
53+ GOLANGCI_LINT_VERSION: v2.5.0
5954 run: |
55+ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}
56+ curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
57+ chmod +x ./cc-test-reporter
58+
59+ # Install go dependencies
6060 go mod download
6161
6262 - name: Build Artifacts
@@ -64,7 +64,7 @@ jobs:
6464
6565 # Upload artifacts in case of workflow failure
6666 - name: Upload Artifacts
67− uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
67+ uses: actions/upload-artifact@v5
6868 with:
6969 name: oauth2-proxy-artifacts
7070 path: |
@@ -100,21 +100,21 @@ jobs:
100100 runs-on: ubuntu-latest
101101 steps:
102102 - name: Check out code
103− uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
103+ uses: actions/checkout@v5
104104 with:
105105 ref: ${{ needs.publish.outputs.tag }}
106106 fetch-depth: 0
107107 fetch-tags: true
108108
109109 - name: Set up QEMU
110− uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
110+ uses: docker/setup-qemu-action@v3
111111
112112 - name: Set up Docker Buildx
113113 id: buildx
114− uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
114+ uses: docker/setup-buildx-action@v3
115115
116116 - name: Login to quay.io
117− uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
117+ uses: docker/login-action@v3
118118 with:
119119 registry: quay.io/oauth2-proxy
120120 username: ${{ secrets.REGISTRY_USERNAME }}
.github/workflows/stale.yml+1−1
@@ -10,7 +10,7 @@ jobs:
1010 runs-on: ubuntu-latest
1111
1212 steps:
13− - uses: actions/stale@4391f3da665fdf50b6810c1a66712fb9ba21aa93 # v11.0.0
13+ - uses: actions/stale@v10
1414 with:
1515 repo-token: ${{ secrets.GITHUB_TOKEN }}
1616 days-before-stale: 180
.github/workflows/test.shnew file+26
@@ -0,0 +1,26 @@
1+#!/bin/bash
2+# manually exiting from script, because after-build needs to run always
3+set +e
4+
5+if [ -z $CC_TEST_REPORTER_ID ]; then
6+ echo "1. CC_TEST_REPORTER_ID is unset, skipping"
7+else
8+ echo "1. Running before-build"
9+ ./cc-test-reporter before-build
10+fi
11+
12+echo "2. Running test"
13+make test
14+TEST_STATUS=$?
15+
16+if [ -z $CC_TEST_REPORTER_ID ]; then
17+ echo "3. CC_TEST_REPORTER_ID is unset, skipping"
18+else
19+ echo "3. Running after-build"
20+ ./cc-test-reporter after-build --exit-code $TEST_STATUS --prefix $(go list -m)
21+fi
22+
23+if [ "$TEST_STATUS" -ne 0 ]; then
24+ echo "Test failed, status code: $TEST_STATUS"
25+ exit $TEST_STATUS
26+fi
.golangci.yml−8
@@ -53,14 +53,6 @@ linters:
5353 - revive
5454 path: util/.*\.go$
5555 text: "var-naming: avoid meaningless package names"
56− # pkg/version conflicts with go/version (added in Go 1.22)
57− - linters:
58− - revive
59− path: pkg/version/.*\.go$
60− text: "var-naming: avoid package names that conflict with"
61− - linters:
62− - prealloc
63− path: _test\.go
6456 paths:
6557 - third_party$
6658 - builtin$
ADOPTERS.mdnew file+28
@@ -0,0 +1,28 @@
1+# Adopters
2+
3+This list showcases organizations that leverage OAuth2-Proxy within their
4+infrastructure. If your organization uses OAuth2-Proxy and isn't yet listed, we
5+encourage you to add it!
6+
7+This list aims to be a comprehensive and trusted resource for the OAuth2-Proxy
8+community, demonstrating successful adoption across all kinds of industries.
9+
10+Contributing to this list is a simple way to impact the project's growth,
11+maturity, and momentum. Thank you to all adopters and contributors of the
12+OAuth2-Proxy project!
13+
14+## Updating this list
15+
16+To add your organization to this list, you can just [open a PR](https://github.com/oauth2-proxy/oauth2-proxy/pulls)
17+to directly update this list.
18+
19+Add your organization name, your github username and if you desire a short
20+description on how you utilize oauth2-proxy.
21+
22+## OAuth2-Proxy Adopters
23+
24+This list is sorted in the order that organizations were added to it.
25+
26+| Organization | Contact | Description of Use |
27+| ------------ | ------- | ------------------ |
28+| | | |
CHANGELOG.md−307
@@ -6,316 +6,9 @@
66
77## Breaking Changes
88
9−## Changes since v7.15.4
10−
11−# V7.15.4
12−
13−## Release Highlights
14−
15−- 🔵 Golang version upgrade to v1.26.7
16− - Upgrade of all dependencies to their latest versions
17−- 🕵️‍♀️ Vulnerabilities have been addressed
18− - [CVE-2026-33818](https://nvd.nist.gov/vuln/detail/CVE-2026-33818)
19− - [CVE-2026-39821](https://nvd.nist.gov/vuln/detail/CVE-2026-39821)
20− - [CVE-2026-39822](https://nvd.nist.gov/vuln/detail/CVE-2026-39822)
21− - [CVE-2026-42505](https://nvd.nist.gov/vuln/detail/CVE-2026-42505)
22− - [CVE-2026-46600](https://nvd.nist.gov/vuln/detail/CVE-2026-46600)
23− - [CVE-2026-56852](https://nvd.nist.gov/vuln/detail/CVE-2026-56852)
24− - [CVE-2026-56853](https://nvd.nist.gov/vuln/detail/CVE-2026-56853)
25− - [CVE-2026-56858](https://nvd.nist.gov/vuln/detail/CVE-2026-56858)
26− - [CVE-2026-56859](https://nvd.nist.gov/vuln/detail/CVE-2026-56859)
27− - [CVE-2026-56860](https://nvd.nist.gov/vuln/detail/CVE-2026-56860)
28− - [CVE-2026-56862](https://nvd.nist.gov/vuln/detail/CVE-2026-56862)
29−
30−## Important Notes
31−
32−## Breaking Changes
33−
34−## Changes since v7.15.3
35−
36−- [#3493](https://github.com/oauth2-proxy/oauth2-proxy/pull/3493) chore(deps): update gomod @tuunit
37−
38−# V7.15.3
39−
40−## Release Highlights
41−
42−- 🔵 Golang version upgrade to v1.26.4
43− - Upgrade of all dependencies to their latest versions
44−- 🕵️‍♀️ Vulnerabilities have ben addressed
45− - [CVE-2026-33811](https://nvd.nist.gov/vuln/detail/)
46− - [CVE-2026-33814](https://nvd.nist.gov/vuln/detail/)
47− - [CVE-2026-39820](https://nvd.nist.gov/vuln/detail/)
48− - [CVE-2026-39836](https://nvd.nist.gov/vuln/detail/)
49− - [CVE-2026-42499](https://nvd.nist.gov/vuln/detail/)
50− - [CVE-2026-42504](https://nvd.nist.gov/vuln/detail/)
51− - [CVE-2026-39823](https://nvd.nist.gov/vuln/detail/)
52− - [CVE-2026-39826](https://nvd.nist.gov/vuln/detail/)
53− - [CVE-2026-39825](https://nvd.nist.gov/vuln/detail/)
54− - [CVE-2026-27145](https://nvd.nist.gov/vuln/detail/)
55− - [CVE-2026-42507](https://nvd.nist.gov/vuln/detail/)
56−
57−## Important Notes
58−
59−## Breaking Changes
60−
61−## Changes since v7.15.2
62−
63−- [#3477](https://github.com/oauth2-proxy/oauth2-proxy/pull/3477) chore(dep): bump go to 1.26 and migrate of reverse proxy handling
64−
65−# V7.15.2
66−
67−## Release Highlights
68−
69−- 🔵 Golang version upgrade to v1.25.9
70− - Upgrade of all dependencies to their latest versions
71− - [CVE-2026-34986](https://nvd.nist.gov/vuln/detail/CVE-2026-34986)
72− - [CVE-2026-32281](https://nvd.nist.gov/vuln/detail/CVE-2026-32281)
73− - [CVE-2026-32289](https://nvd.nist.gov/vuln/detail/CVE-2026-32289)
74− - [CVE-2026-32288](https://nvd.nist.gov/vuln/detail/CVE-2026-32288)
75− - [CVE-2026-32280](https://nvd.nist.gov/vuln/detail/CVE-2026-32280)
76− - [CVE-2026-32282](https://nvd.nist.gov/vuln/detail/CVE-2026-32282)
77− - [CVE-2026-32283](https://nvd.nist.gov/vuln/detail/CVE-2026-32283)
78−- 🕵️‍♀️ Vulnerabilities have been addressed
79−
80−## Important Notes
81−
82−We have had security audits performed on OAuth2 Proxy in the past couple of weeks and as a result we have fixed
83−several CRITICAL vulnerabilities.
84−
85−The security vulnerabilities include multiple authentication bypasses and a potential session fixation attack.
86−For more details and to identify if you are effects, we urge all users of OAuth2 Proxy to read the security
87−disclosures.
88−
89−- (Critical) [GHSA-5hvv-m4w4-gf6v](https://github.com/oauth2-proxy/oauth2-proxy/security/advisories/GHSA-5hvv-m4w4-gf6v) fix: health check user-agent authentication bypass
90−- (Critical) [GHSA-7x63-xv5r-3p2x](https://github.com/oauth2-proxy/oauth2-proxy/security/advisories/GHSA-7x63-xv5r-3p2x) fix: authentication bypass via X-Forwarded-Uri header spoofing
91−- (High) [GHSA-pxq7-h93f-9jrg](https://github.com/oauth2-proxy/oauth2-proxy/security/advisories/GHSA-pxq7-h93f-9jrg) fix: fragment evaluation as part of the allowed routes
92−- (Moderate) [GHSA-c5c4-8r6x-56w3](https://github.com/oauth2-proxy/oauth2-proxy/security/advisories/GHSA-c5c4-8r6x-56w3) fix: email validation bypass via malformed multi-@ email claims
93−
94−Furthermore, for improving the security of OAuth2 Proxy we introduced a new flag `--trusted-proxy-ip` that allows users
95−to explicitly specify trusted reverse proxy IPs for the `X-Forwarded-*` headers. This is an important step to prevent
96−potential header spoofing attacks and to ensure that OAuth2 Proxy only trusts headers from known and trusted sources.
97−We highly recommend users to review their deployment architecture and consider using this flag to enhance the security
98−of their OAuth2 Proxy instances. Check the docs for more details: https://oauth2-proxy.github.io/oauth2-proxy/configuration/overview#proxy-options
99−
100−Furthermore, we want to thank everyone who contributed to the audits and reported potential issues to make open source
101−software like OAuth2 Proxy more secure for everyone.
102−
103−## Breaking Changes
104−
105−## Changes since v7.15.1
106−
107−- [#3411](https://github.com/oauth2-proxy/oauth2-proxy/pull/3411) chore(deps): update gomod dependencies (@tuunit)
108−- [#3333](https://github.com/oauth2-proxy/oauth2-proxy/pull/3333) fix: invalidate session on fatal OAuth2 refresh errors (@frhack)
109−- [GHSA-f24x-5g9q-753f](https://github.com/oauth2-proxy/oauth2-proxy/security/advisories/GHSA-f24x-5g9q-753f) fix: clear session cookie at beginning of signinpage handler (@fnoehWM / @bella-WI / @tuunit)
110−- [GHSA-5hvv-m4w4-gf6v](https://github.com/oauth2-proxy/oauth2-proxy/security/advisories/GHSA-5hvv-m4w4-gf6v) fix: health check user-agent authentication bypass (@tuunit)
111−- [GHSA-7x63-xv5r-3p2x](https://github.com/oauth2-proxy/oauth2-proxy/security/advisories/GHSA-7x63-xv5r-3p2x) fix: authentication bypass via X-Forwarded-Uri header spoofing (@tuunit)
112−- [GHSA-pxq7-h93f-9jrg](https://github.com/oauth2-proxy/oauth2-proxy/security/advisories/GHSA-pxq7-h93f-9jrg) fix: fragment evaluation as part of the allowed routes (@tuunit)
113−- [GHSA-c5c4-8r6x-56w3](https://github.com/oauth2-proxy/oauth2-proxy/security/advisories/GHSA-c5c4-8r6x-56w3) fix: email validation bypass via malformed multi-@ email claims (@tuunit)
114−
115−# V7.15.1
116−
117−## Release Highlights
118−
119−- 🐛 Squashed some bugs
120−- 🕵️‍♀️ Vulnerabilities have been addressed
121− - [CVE-2026-33186](https://nvd.nist.gov/vuln/detail/CVE-2026-33186)
122− OAuth2 Proxy was not impacted by this vulnerability as it isn't in the path of execution
123−
124−## Important Notes
125−
126−## Breaking Changes
127−
128−## Changes since v7.15.0
129−
130−- [#3382](https://github.com/oauth2-proxy/oauth2-proxy/pull/3382) chore(deps): update gomod and golangci/golangci-lint to v2.11.4 (@tuunit)
131−- [#3374](https://github.com/oauth2-proxy/oauth2-proxy/pull/3374) fix: handle Unix socket RemoteAddr in IP resolution (@H1net)
132−- [#3381](https://github.com/oauth2-proxy/oauth2-proxy/pull/3381) fix: do not log error for backend logout 204 (@artificiosus)
133−- [#3327](https://github.com/oauth2-proxy/oauth2-proxy/pull/3327) fix: improve logging when session refresh token is missing (@yosri-brh)
134−- [#2767](https://github.com/oauth2-proxy/oauth2-proxy/pull/2767) fix: propagate errors during route building (@sybereal)
135−
136−# V7.15.0
137−
138−## Release Highlights
139−
140−- 🔒 OIDC JWT signing algorithms can now be configured
141−- 🍪 CSRF cookie improvements (SameSite option, proper expiration validation)
142−- 🧪 Configuration validation flag: --config-test
143−- 🔌 Unix socket file mode support
144−- 👤 Session state can now be extend with arbitrary claims from ID Token and upstream IDP user profiles endpoint
145− - This opens the door for multiple features like:
146− - Additional arbitrary header values for any claims your IDP provides
147− - Extended OAuth2 Proxy UserInfo endpoint with all additional claims
148− - Read the docs [here](https://oauth2-proxy.github.io/oauth2-proxy/configuration/alpha-config#how-to-utilize-arbitrary-claims-provided-by-your-identity-provider)
149−
150−## Important Notes
151−
152−CSRF cookie validation now correctly uses `CSRFExpire` instead of `Expire`. If you relied on the previous behavior, review your session timeout configuration.
153−Check the [documentation(https://oauth2-proxy.github.io/oauth2-proxy/configuration/overview#cookie-options) for `cookie-csrf-expire`.
154−
155−## Breaking Changes
156−
157−## Changes since v7.14.3
158−
159−- [#3352](https://github.com/oauth2-proxy/oauth2-proxy/pull/3352) fix: backend logout URL call on sign out (#3172)(@vsejpal)
160−- [#3332](https://github.com/oauth2-proxy/oauth2-proxy/pull/3332) ci: distribute windows binary with .exe extension (@igitur)
161−- [#2685](https://github.com/oauth2-proxy/oauth2-proxy/pull/2685) feat: allow arbitrary claims from the IDToken and IdentityProvider UserInfo endpoint to be added to the session state (@vegetablest)
162−- [#3278](https://github.com/oauth2-proxy/oauth2-proxy/pull/3278) feat: possibility to inject id_token in redirect url during sign out (@albanf)
163−- [#2851](https://github.com/oauth2-proxy/oauth2-proxy/pull/2851) feat: add support for specifying allowed OIDC JWT signing algorithms (#2753) (@andoks / @tuunit)
164−- [#3369](https://github.com/oauth2-proxy/oauth2-proxy/pull/3369) fix: use CSRFExpire instead of Expire for CSRF cookie validation (@Br1an67)
165−- [#3365](https://github.com/oauth2-proxy/oauth2-proxy/pull/3365) fix: filter empty strings from allowed groups (@Br1an67)
166−- [#3338](https://github.com/oauth2-proxy/oauth2-proxy/pull/3338) feat: add --config-test flag for validating configuration (@MayorFaj)
167−- [#3347](https://github.com/oauth2-proxy/oauth2-proxy/pull/3347) feat: add same site option for csrf cookies (@jvnoije)
168−- [#3376](https://github.com/oauth2-proxy/oauth2-proxy/pull/3376) feat: allow setting unix socket file mode when declaring listener (@Tristan971 / @tuunit)
169−
170−# V7.14.3
171−
172−## Release Highlights
173−
174−- 🔵 Go1.25.7 and upgrade of dependencies to latest versions
175− - Fixes [CVE-2025-68121](https://nvd.nist.gov/vuln/detail/cve-2025-68121)
176−- 🐛 Bug fixes
177− - Allow Redis URL parameters to configure username, password and max idle connection timeout if the matching configuration is empty.
178−
179−## Important Notes
180−
181−We improved our supply chain security by added additional checks to prevent potential command injection in the publish release workflow and to ensure that it can only be triggered from branches originating in the local repository. This potential issue was reported by automated systems as well as a couple of security researchers, and we want to thank everyone for their diligence in looking out for the security of the project. Especially Aastha Aggarwal for her detailed report and follow-up. @Aastha2602
182−
183−
184−## Breaking Changes
185−
186−## Changes since v7.14.2
187−
188−- [#3183](https://github.com/oauth2-proxy/oauth2-proxy/pull/3183) fix: allow URL parameters to configure username, password and max idle connection timeout if the matching configuration is empty.
189−
190−# V7.14.2
191−
192−## Release Highlights
193−
194−- Revert AuthOnly endpoint change from v7.14.1 that caused issues when using `skip-provider-button` enabled
195−
196−## Important Notes
197−
198−- This release reverts the change made in v7.14.1 that caused issues when using the `skip-provider-button` enabled. Now, when a session does not exist, the AuthOnly endpoint will send a 401 status code as expected instead of a 302 redirect. And instead we extended the documentation to clarify the behavior when using `nginx` with `auth_request` and `skip-provider-button` and how to properly configure redirects for browser and API routes.
199−
200−## Breaking Changes
201−
202−## Changes since v7.14.1
203−
204−- [#3314](https://github.com/oauth2-proxy/oauth2-proxy/pull/3314) revert: fix: skip provider button auth only redirect (#3309) (@StefanMarkmann / @tuunit)
205−- [#3315](https://github.com/oauth2-proxy/oauth2-proxy/pull/3315) docs: clarify browser vs API routes for nginx auth_request redirects (@StefanMarkmann)
206−
207−# V7.14.1
208−
209−## Release Highlights
210−
211−- 🔵 Go1.25.6 and upgrade of dependencies to latest versions
212−- 🐛 Bug fixes
213− - AuthOnly now starts the auth flow and send status code 302 if no session exists and skip-provider-button is true
214− - Fixed static upstream validation issue due to incorrect defaults
215−
216−## Important Notes
217−
218−## Breaking Changes
219−
220−## Changes since v7.14.0
221−
222−- [#3309](https://github.com/oauth2-proxy/oauth2-proxy/pull/3309) fix: Return 302 redirect from AuthOnly endpoint when skip-provider-button is true (@StefanMarkmann)
223−- [#3302](https://github.com/oauth2-proxy/oauth2-proxy/pull/3302) fix: static upstreams failing validation due to `passHostHeader` and `proxyWebSockets` defaults being set incorrectly (@sourava01 / @tuunit)
224−- [#3312](https://github.com/oauth2-proxy/oauth2-proxy/pull/3312) chore(deps): upgrade to go1.25.6 and latest dependencies (@tuunit)
225−
226−# V7.14.0
227−
228−## Release Highlights
229−
230−- 🕵️‍♀️ Vulnerabilities have been addressed
231− - [CVE-2025-61729](https://access.redhat.com/security/cve/cve-2025-61729)
232− - [CVE-2025-61727](https://access.redhat.com/security/cve/cve-2025-61727)
233− - [CVE-2025-47914](https://access.redhat.com/security/cve/cve-2025-47914)
234− - [CVE-2025-58181](https://access.redhat.com/security/cve/cve-2025-58181)
235−- 🗂️ AMajor Alpha Config YAML parsing revamped for better extensibility and preparing v8
236−- 🐛 Squashed some bugs
237−
238−## Important Notes
239−
240−This release introduces a breaking change for Alpha Config users and moves us significantly
241−closer to removing legacy configuration parameters, making the codebase of OAuth2 Proxy more
242−future proof and extensible.
243−
244−From v7.14.0 onward, header injection sources must be explicitly nested. If you
245−previously relied on squashed fields, update to the new structure before upgrading:
246−
247−```yaml
248−# before v7.14.0
249−injectRequestHeaders:
250−- name: X-Forwarded-User
251− values:
252− - claim: user
253−- name: X-Custom-Secret-header
254− values:
255− - value: my-super-secret
256−
257−# v7.14.0 and later
258−injectRequestHeaders:
259−- name: X-Forwarded-User
260− values:
261− - claimSource:
262− claim: user
263−- name: X-Custom-Secret-header
264− values:
265− - secretSource:
266− value: my-super-secret
267−```
268−
269−Furthermore, Alpha Config now fully supports configuring the `Server` struct using YAML.
270−
271−```yaml
272−// Server represents the configuration for the Proxy HTTP(S) configuration.
273−type Server struct {
274− // BindAddress is the address on which to serve traffic.
275− BindAddress string `yaml:"bindAddress,omitempty"`
276−
277− // SecureBindAddress is the address on which to serve secure traffic.
278− SecureBindAddress string `yaml:"secureBindAddress,omitempty"`
279−
280− // TLS contains the information for loading the certificate and key for the
281− // secure traffic and further configuration for the TLS server.
282− TLS *TLS `yaml:"tls,omitempty"`
283−}
284−
285−// TLS contains the information for loading a TLS certificate and key
286−// as well as an optional minimal TLS version that is acceptable.
287−type TLS struct {
288− // Key is the TLS key data to use.
289− Key *SecretSource `yaml:"key,omitempty"`
290− // Cert is the TLS certificate data to use.
291− Cert *SecretSource `yaml:"cert,omitempty"`
292− // MinVersion is the minimal TLS version that is acceptable.
293− MinVersion string `yaml:"minVersion,omitempty"`
294− // CipherSuites is a list of TLS cipher suites that are allowed.
295− CipherSuites []string `yaml:"cipherSuites,omitempty"`
296−}
297−```
298−
299−More about how to use Alpha Config can be found in the [documentation](https://oauth2-proxy.github.io/oauth2-proxy/configuration/alpha-config#server).
300−
301−We are committed to Semantic Versioning and usually avoid breaking changes without a major version release.
302−Advancing Alpha Config toward its Beta stage required this exception, and even for the Alpha Config we try
303−to keep breaking changes in v7 to a minium. Thank you for understanding the need for this step to prepare
304−the project for future maintainability and future improvements like structured logging.
305−
306−## Breaking Changes
307−
308−- Alpha Config: header injection no longer supports squashed claim/secret sources; they must now be set explicitly (see example above).
309−
3109## Changes since v7.13.0
31110
312−- [#2628](https://github.com/oauth2-proxy/oauth2-proxy/pull/2628) feat(structured config): revamp of yaml parsing using mapstructure decoder and custom decoders (@tuunit)
31311- [#3197](https://github.com/oauth2-proxy/oauth2-proxy/pull/3197) fix: NewRemoteKeySet is not using DefaultHTTPClient (@rsrdesarrollo / @tuunit)
314−- [#3292](https://github.com/oauth2-proxy/oauth2-proxy/pull/3292) chore(deps): upgrade gomod and bump to golang v1.25.5 (@tuunit)
315−- [#3304](https://github.com/oauth2-proxy/oauth2-proxy/pull/3304) fix: added conditional so default is not always set and env vars are honored fixes 3303 (@pixeldrew)
316−- [#3264](https://github.com/oauth2-proxy/oauth2-proxy/pull/3264) fix: more aggressively truncate logged access_token (@MartinNowak / @tuunit)
317−- [#3267](https://github.com/oauth2-proxy/oauth2-proxy/pull/3267) fix: Session refresh handling in OIDC provider (@gysel)
318−- [#3290](https://github.com/oauth2-proxy/oauth2-proxy/pull/3290) fix: WebSocket proxy to respect PassHostHeader setting (@UnsignedLong)
31912
32013# V7.13.0
32114
CODE_OF_CONDUCT.md+103−81
@@ -1,112 +1,134 @@
1−## CNCF Community Code of Conduct v1.3
2−
3−Other languages available:
4−- [Arabic/العربية](https://github.com/cncf/foundation/blob/main/code-of-conduct-languages/ar.md)
5−- [Bengali/বাংলা](https://github.com/cncf/foundation/blob/main/code-of-conduct-languages/bn.md)
6−- [Bulgarian/Български](https://github.com/cncf/foundation/blob/main/code-of-conduct-languages/bg.md)
7−- [Chinese/中文](https://github.com/cncf/foundation/blob/main/code-of-conduct-languages/zh.md)
8−- [Czech/Česky](https://github.com/cncf/foundation/blob/main/code-of-conduct-languages/cs.md)
9−- [Farsi/فارسی](https://github.com/cncf/foundation/blob/main/code-of-conduct-languages/fa.md)
10−- [French/Français](https://github.com/cncf/foundation/blob/main/code-of-conduct-languages/fr.md)
11−- [German/Deutsch](https://github.com/cncf/foundation/blob/main/code-of-conduct-languages/de.md)
12−- [Hebrew/עברית](https://github.com/cncf/foundation/blob/main/code-of-conduct-languages/he.md)
13−- [Hindi/हिन्दी](https://github.com/cncf/foundation/blob/main/code-of-conduct-languages/hi.md)
14−- [Hungarian/Magyar](https://github.com/cncf/foundation/blob/main/code-of-conduct-languages/hu.md)
15−- [Indonesian/Bahasa Indonesia](https://github.com/cncf/foundation/blob/main/code-of-conduct-languages/id.md)
16−- [Italian/Italiano](https://github.com/cncf/foundation/blob/main/code-of-conduct-languages/it.md)
17−- [Japanese/日本語](https://github.com/cncf/foundation/blob/main/code-of-conduct-languages/ja.md)
18−- [Korean/한국어](https://github.com/cncf/foundation/blob/main/code-of-conduct-languages/ko.md)
19−- [Polish/Polski](https://github.com/cncf/foundation/blob/main/code-of-conduct-languages/pl.md)
20−- [Portuguese/Português](https://github.com/cncf/foundation/blob/main/code-of-conduct-languages/pt.md)
21−- [Russian/Русский](https://github.com/cncf/foundation/blob/main/code-of-conduct-languages/ru.md)
22−- [Spanish/Español](https://github.com/cncf/foundation/blob/main/code-of-conduct-languages/es.md)
23−- [Turkish/Türkçe](https://github.com/cncf/foundation/blob/main/code-of-conduct-languages/tr.md)
24−- [Ukrainian/Українська](https://github.com/cncf/foundation/blob/main/code-of-conduct-languages/uk.md)
25−- [Vietnamese/Tiếng Việt](https://github.com/cncf/foundation/blob/main/code-of-conduct-languages/vi.md)
26−
27−### Community Code of Conduct
28−
29−As contributors, maintainers, and participants in the CNCF community, and in the interest of fostering
30−an open and welcoming community, we pledge to respect all people who participate or contribute
31−through reporting issues, posting feature requests, updating documentation,
32−submitting pull requests or patches, attending conferences or events, or engaging in other community or project activities.
33−
34−We are committed to making participation in the CNCF community a harassment-free experience for everyone, regardless of age, body size, caste, disability, ethnicity, level of experience, family status, gender, gender identity and expression, marital status, military or veteran status, nationality, personal appearance, race, religion, sexual orientation, socioeconomic status, tribe, or any other dimension of diversity.
1+# Contributor Covenant Code of Conduct
352
36−## Scope
37−
38−This code of conduct applies:
39−* within project and community spaces,
40−* in other spaces when an individual CNCF community participant's words or actions are directed at or are about a CNCF project, the CNCF community, or another CNCF community participant in the context of a CNCF activity.
3+## Our Pledge
414
42−### CNCF Events
5+We as members, contributors, and leaders pledge to make participation in our
6+community a harassment-free experience for everyone, regardless of age, body
7+size, visible or invisible disability, ethnicity, sex characteristics, gender
8+identity and expression, level of experience, education, socio-economic status,
9+nationality, personal appearance, race, caste, color, religion, or sexual
10+identity and orientation.
4311
44−CNCF events that are produced by the Linux Foundation with professional events staff are governed by the Linux Foundation [Events Code of Conduct](https://events.linuxfoundation.org/code-of-conduct/) available on the event page. This is designed to be used in conjunction with the CNCF Code of Conduct.
12+We pledge to act and interact in ways that contribute to an open, welcoming,
13+diverse, inclusive, and healthy community.
4514
4615## Our Standards
4716
48−The CNCF Community is open, inclusive and respectful. Every member of our community has the right to have their identity respected.
49−
50−Examples of behavior that contributes to a positive environment include but are not limited to:
17+Examples of behavior that contributes to a positive environment for our
18+community include:
5119
5220* Demonstrating empathy and kindness toward other people
5321* Being respectful of differing opinions, viewpoints, and experiences
5422* Giving and gracefully accepting constructive feedback
5523* Accepting responsibility and apologizing to those affected by our mistakes,
5624 and learning from the experience
57−* Focusing on what is best not just for us as individuals, but for the
58− overall community
59−* Using welcoming and inclusive language
25+* Focusing on what is best not just for us as individuals, but for the overall
26+ community
6027
28+Examples of unacceptable behavior include:
6129
62−Examples of unacceptable behavior include but are not limited to:
63−
64−* The use of sexualized language or imagery
30+* The use of sexualized language or imagery, and sexual attention or advances of
31+ any kind
6532* Trolling, insulting or derogatory comments, and personal or political attacks
66−* Public or private harassment in any form
67−* Publishing others' private information, such as a physical or email
68− address, without their explicit permission
69−* Violence, threatening violence, or encouraging others to engage in violent behavior
70−* Stalking or following someone without their consent
71−* Unwelcome physical contact
72−* Unwelcome sexual or romantic attention or advances
73−* Using CNCF projects or community spaces for political campaigning or promotion of political causes
74− that are unrelated to the advancement of cloud native technology. To clarify, this policy does not restrict individuals' personal attire, including attire that expresses personal beliefs or aspects of identity.
33+* Public or private harassment
34+* Publishing others' private information, such as a physical or email address,
35+ without their explicit permission
7536* Other conduct which could reasonably be considered inappropriate in a
7637 professional setting
7738
78−The following behaviors are also prohibited:
79−* Providing knowingly false or misleading information in connection with a Code of Conduct investigation or otherwise intentionally tampering with an investigation.
80−* Retaliating against a person because they reported an incident or provided information about an incident as a witness.
39+## Enforcement Responsibilities
8140
82−Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct.
83−By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect
84−of managing a CNCF project.
85−Project maintainers who do not follow or enforce the Code of Conduct may be temporarily or permanently removed from the project team.
41+Community leaders are responsible for clarifying and enforcing our standards of
42+acceptable behavior and will take appropriate and fair corrective action in
43+response to any behavior that they deem inappropriate, threatening, offensive,
44+or harmful.
8645
87−## Reporting
46+Community leaders have the right and responsibility to remove, edit, or reject
47+comments, commits, code, wiki edits, issues, and other contributions that are
48+not aligned to this Code of Conduct, and will communicate reasons for moderation
49+decisions when appropriate.
8850
89−For incidents occurring in the Kubernetes community, contact the [Kubernetes Code of Conduct Committee](https://git.k8s.io/community/committee-code-of-conduct) via <conduct@kubernetes.io>. You can expect a response within three business days.
51+## Scope
9052
91−For other projects, or for incidents that are project-agnostic or impact multiple CNCF projects, please contact the [CNCF Code of Conduct Committee](https://www.cncf.io/conduct/committee/) via <conduct@cncf.io>. Alternatively, you can contact any of the individual members of the [CNCF Code of Conduct Committee](https://www.cncf.io/conduct/committee/) to submit your report. For more detailed instructions on how to submit a report, including how to submit a report anonymously, please see our [Incident Resolution Procedures](https://github.com/cncf/foundation/blob/main/code-of-conduct/coc-incident-resolution-procedures.md). You can expect a response within three business days.
53+This Code of Conduct applies within all community spaces, and also applies when
54+an individual is officially representing the community in public spaces.
55+Examples of representing our community include using an official email address,
56+posting via an official social media account, or acting as an appointed
57+representative at an online or offline event.
9258
93−For incidents occurring at CNCF event that is produced by the Linux Foundation, please contact <eventconduct@cncf.io>.
59+## Enforcement
9460
95−## Frequently asked questions
96−For more information about this Code of Conduct, please see the [CNCF Code of Conduct Frequently Asked Questions](https://www.cncf.io/conduct/faq/).
61+Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+reported to the community leaders responsible for enforcement at
63+https://gophers.slack.com/messages/CM2RSS25N or directly contacting one of the
64+maintainers from the MAINTAINERS file.
65+All complaints will be reviewed and investigated promptly and fairly.
9766
98−## Enforcement
67+All community leaders are obligated to respect the privacy and security of the
68+reporter of any incident.
69+
70+## Enforcement Guidelines
71+
72+Community leaders will follow these Community Impact Guidelines in determining
73+the consequences for any action they deem in violation of this Code of Conduct:
74+
75+### 1. Correction
76+
77+**Community Impact**: Use of inappropriate language or other behavior deemed
78+unprofessional or unwelcome in the community.
79+
80+**Consequence**: A private, written warning from community leaders, providing
81+clarity around the nature of the violation and an explanation of why the
82+behavior was inappropriate. A public apology may be requested.
83+
84+### 2. Warning
85+
86+**Community Impact**: A violation through a single incident or series of
87+actions.
88+
89+**Consequence**: A warning with consequences for continued behavior. No
90+interaction with the people involved, including unsolicited interaction with
91+those enforcing the Code of Conduct, for a specified period of time. This
92+includes avoiding interactions in community spaces as well as external channels
93+like social media. Violating these terms may lead to a temporary or permanent
94+ban.
95+
96+### 3. Temporary Ban
97+
98+**Community Impact**: A serious violation of community standards, including
99+sustained inappropriate behavior.
100+
101+**Consequence**: A temporary ban from any sort of interaction or public
102+communication with the community for a specified period of time. No public or
103+private interaction with the people involved, including unsolicited interaction
104+with those enforcing the Code of Conduct, is allowed during this period.
105+Violating these terms may lead to a permanent ban.
106+
107+### 4. Permanent Ban
108+
109+**Community Impact**: Demonstrating a pattern of violation of community
110+standards, including sustained inappropriate behavior, harassment of an
111+individual, or aggression toward or disparagement of classes of individuals.
112+
113+**Consequence**: A permanent ban from any sort of public interaction within the
114+community.
99115
100−Upon review and investigation of a reported incident, the CoC response team that has jurisdiction will determine what action is appropriate based on this Code of Conduct and its related documentation.
116+## Attribution
101117
102−For information about which Code of Conduct incidents are handled by project leadership, which incidents are handled by the CNCF Code of Conduct Committee, and which incidents are handled by the Linux Foundation (including its events team), see our [Jurisdiction Policy](https://github.com/cncf/foundation/blob/main/code-of-conduct/coc-committee-jurisdiction-policy.md).
118+This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119+version 2.1, available at
120+[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
103121
104−## Amendments
122+Community Impact Guidelines were inspired by
123+[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
105124
106−Consistent with the CNCF Charter, any substantive changes to this Code of Conduct must be approved by the Technical Oversight Committee.
125+For answers to common questions about this code of conduct, see the FAQ at
126+[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
127+[https://www.contributor-covenant.org/translations][translations].
107128
108−## Acknowledgements
129+[homepage]: https://www.contributor-covenant.org
130+[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
131+[Mozilla CoC]: https://github.com/mozilla/diversity
132+[FAQ]: https://www.contributor-covenant.org/faq
133+[translations]: https://www.contributor-covenant.org/translations
109134
110−This Code of Conduct is adapted from the Contributor Covenant
111−(http://contributor-covenant.org), version 2.0 available at
112−http://contributor-covenant.org/version/2/0/code_of_conduct/
DCO.mddeleted−34
@@ -1,34 +0,0 @@
1−Developer Certificate of Origin
2−Version 1.1
3−
4−Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
5−
6−Everyone is permitted to copy and distribute verbatim copies of this
7−license document, but changing it is not allowed.
8−
9−
10−Developer's Certificate of Origin 1.1
11−
12−By making a contribution to this project, I certify that:
13−
14−(a) The contribution was created in whole or in part by me and I
15− have the right to submit it under the open source license
16− indicated in the file; or
17−
18−(b) The contribution is based upon previous work that, to the best
19− of my knowledge, is covered under an appropriate open source
20− license and I have the right under that license to submit that
21− work with modifications, whether created in whole or in part
22− by me, under the same open source license (unless I am
23− permitted to submit under a different license), as indicated
24− in the file; or
25−
26−(c) The contribution was provided directly to me by some other
27− person who certified (a), (b) or (c) and I have not modified
28− it.
29−
30−(d) I understand and agree that this project and the contribution
31− are public and that a record of the contribution (including all
32− personal information I submit with it, including my sign-off) is
33− maintained indefinitely and may be redistributed consistent with
34− this project or the open source license(s) involved.
MAINTAINERS+5−2
@@ -1,2 +1,5 @@
1−
2−Moved to https://github.com/oauth2-proxy/oauth2-proxy/blob/master/MAINTAINERS.md
1+Joel Speed <joel@oauth2-proxy.dev> (@JoelSpeed)
2+Nick Meves <nick@oauth2-proxy.dev> (@NickMeves)
3+Braunson <braunson@oauth2-proxy.dev> (@braunsonm)
4+Jan Larwig <jan@oauth2-proxy.dev> (@tuunit)
5+Koen van Zuijlen <koen@oauth2-proxy.dev> (@kvanzuijlen)
MAINTAINERS.mddeleted−33
@@ -1,33 +0,0 @@
1−# Maintainers
2−
3−The table below lists all current maintainers for the oauth2-proxy as defined
4−by our [project governance](GOVERNANCE.md).
5−
6−| Name | GitHub Handle | Domains of reponsibility | Email Alias | Affiliation |
7−| ---------------- | ------------------------------------------------------ | ------------------------ | -------------------------- | ----------- |
8−| Joel Speed | [@JoelSpeed](https://github.com/joelspeed) | Governance, Core | joel@oauth2-proxy.dev | Red Hat |
9−| Jan Larwig | [@tuunit](https://github.com/tuunit) | Governance, Core | jan@oauth2-proxy.dev | STACKIT |
10−| JJ Łakis | [@jjlakis](https://github.com/jjlakis) | Provider | jj@oauth2-proxy.dev | - |
11−| Koen van Zuijlen | [@kvanzuijlen](https://github.com/kvanzuijlen) | CI | koen@oauth2-proxy.dev | - |
12−| Pierluigi Lenoci | [@pierluigilenoci](https://github.com/pierluigilenoci) | Helm | pierluigi@oauth2-proxy.dev | SAP |
13−
14−## Emeritus Maintainers
15−
16−We would like to highlight that this project does have prior maintainers and
17−core contributors that, if they so wished, could (and should) be granted the
18−status of emeritus maintainers.
19−
20−| Name | GitHub Handle |
21−| ------------- | ------------------------------------------------------ |
22−| Nick Meves | [@NickMeves](https://github.com/NickMeves) |
23−| Braunson | [@braunsonm](https://github.com/braunsonm) |
24−| Henry Jenkins | [@steakunderscore](https://github.com/steakunderscore) |
25−
26−
27−## Security Response Team and GitHub Organization Owners
28−
29−The following maintainers are members of the security response team and owners
30−of the GitHub organization.
31−
32−- Joel Speed
33−- Jan Larwig
Makefile+5−10
@@ -25,8 +25,7 @@ help: ## Display this help
2525
2626
2727GO ?= go
28−# renovate: datasource=github-tags depName=golangci/golangci-lint
29−GOLANGCILINT_VERSION ?= v2.11.4
28+GOLANGCILINT ?= golangci-lint
3029
3130BINARY := oauth2-proxy
3231VERSION ?= $(shell git describe --always --dirty --tags 2>/dev/null || echo "undefined")
@@ -67,7 +66,7 @@ DOCKER_BUILDX_PUSH := $(DOCKER_BUILDX) --push
6766DOCKER_BUILDX_PUSH_X_PLATFORM := $(DOCKER_BUILDX_PUSH) --platform ${DOCKER_BUILD_PLATFORM}
6867
6968DOCKER_BUILD_PLATFORM_ALPINE ?= linux/amd64,linux/arm64,linux/ppc64le,linux/arm/v6,linux/arm/v7,linux/s390x
70−DOCKER_BUILD_RUNTIME_IMAGE_ALPINE ?= alpine:3.24.1
69+DOCKER_BUILD_RUNTIME_IMAGE_ALPINE ?= alpine:3.22.2
7170DOCKER_BUILDX_ARGS_ALPINE ?= --build-arg RUNTIME_IMAGE=${DOCKER_BUILD_RUNTIME_IMAGE_ALPINE} ${DOCKER_BUILDX_COMMON_ARGS}
7271DOCKER_BUILDX_X_PLATFORM_ALPINE := docker buildx build ${DOCKER_BUILDX_ARGS_ALPINE} --platform ${DOCKER_BUILD_PLATFORM_ALPINE}
7372DOCKER_BUILDX_PUSH_X_PLATFORM_ALPINE := $(DOCKER_BUILDX_X_PLATFORM_ALPINE) --push
@@ -144,11 +143,11 @@ verify-generate: generate ## Verify command to check if alpha config docs are in
144143##@ Miscellaneous
145144
146145.PHONY: test
147−test: ## Run all Go tests
146+test: lint ## Run all Go tests
148147 GO111MODULE=on $(GO) test $(TESTCOVER) -v -race ./...
149148
150149.PHONY: release
151−release: validate-go-version ## Create a full release for all architectures (binaries and checksums)
150+release: validate-go-version lint test ## Create a full release for all architectures (binaries and checksums)
152151 BINARY=${BINARY} VERSION=${VERSION} ./dist.sh
153152
154153.PHONY: clean
@@ -158,11 +157,7 @@ clean: ## Cleanup release and build files
158157
159158.PHONY: lint
160159lint: validate-go-version ## Lint all files using golangci-lint
161− GO111MODULE=on $(GO) run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCILINT_VERSION) run --timeout 10m
162−
163−.PHONY: lint-fix
164−lint-fix: validate-go-version ## Lint all files and apply fixes using golangci-lint
165− GO111MODULE=on $(GO) run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCILINT_VERSION) run --timeout 10m --fix
160+ GO111MODULE=on $(GOLANGCILINT) run
166161
167162.PHONY: validate-go-version
168163validate-go-version: ## Validate Go environment requirements
README.md+19−34
@@ -1,29 +1,27 @@
11[![Continuous Integration](https://github.com/oauth2-proxy/oauth2-proxy/actions/workflows/ci.yml/badge.svg)](https://github.com/oauth2-proxy/oauth2-proxy/actions/workflows/ci.yml)
2−[![Go Report Card](https://goreportcard.com/badge/github.com/oauth2-proxy/oauth2-proxy)](https://goreportcard.com/report/github.com/oauth2-proxy/oauth2-proxy/v7)
3−[![GoDoc](https://godoc.org/github.com/oauth2-proxy/oauth2-proxy?status.svg)](https://godoc.org/github.com/oauth2-proxy/oauth2-proxy/v7)
2+[![Go Report Card](https://goreportcard.com/badge/github.com/oauth2-proxy/oauth2-proxy)](https://goreportcard.com/report/github.com/oauth2-proxy/oauth2-proxy)
3+[![GoDoc](https://godoc.org/github.com/oauth2-proxy/oauth2-proxy?status.svg)](https://godoc.org/github.com/oauth2-proxy/oauth2-proxy)
44[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
5−[![Maintainability](https://qlty.sh/gh/oauth2-proxy/projects/oauth2-proxy/maintainability.svg)](https://qlty.sh/gh/oauth2-proxy/projects/oauth2-proxy)
6−[![Code Coverage](https://qlty.sh/gh/oauth2-proxy/projects/oauth2-proxy/coverage.svg)](https://qlty.sh/gh/oauth2-proxy/projects/oauth2-proxy)
7−[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/oauth2-proxy/oauth2-proxy/badge)](https://scorecard.dev/viewer/?uri=github.com/oauth2-proxy/oauth2-proxy)
8−[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/11223/badge)](https://www.bestpractices.dev/projects/11223)
5+[![Maintainability](https://api.codeclimate.com/v1/badges/a58ff79407212e2beacb/maintainability)](https://codeclimate.com/github/oauth2-proxy/oauth2-proxy/maintainability)
6+[![Test Coverage](https://api.codeclimate.com/v1/badges/a58ff79407212e2beacb/test_coverage)](https://codeclimate.com/github/oauth2-proxy/oauth2-proxy/test_coverage)
97[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Foauth2-proxy%2Foauth2-proxy.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Foauth2-proxy%2Foauth2-proxy?ref=badge_shield)
108
119![OAuth2 Proxy](docs/static/img/logos/OAuth2_Proxy_horizontal.svg)
1210
13−OAuth2 Proxy is a flexible, open-source tool that can act as either a standalone reverse proxy or a middleware component integrated into existing reverse proxy or load balancer setups. It provides a simple and secure way to protect your web applications with OAuth2 / OIDC authentication. As a reverse proxy, it intercepts requests to your application and redirects users to an OAuth2 provider for authentication. As a middleware, it can be seamlessly integrated into your existing infrastructure to handle authentication for multiple applications.
11+OAuth2-Proxy is a flexible, open-source tool that can act as either a standalone reverse proxy or a middleware component integrated into existing reverse proxy or load balancer setups. It provides a simple and secure way to protect your web applications with OAuth2 / OIDC authentication. As a reverse proxy, it intercepts requests to your application and redirects users to an OAuth2 provider for authentication. As a middleware, it can be seamlessly integrated into your existing infrastructure to handle authentication for multiple applications.
1412
15−OAuth2 Proxy supports a lot of OAuth2 as well as OIDC providers. Either through a generic OIDC client or a specific implementation for Google, Microsoft Entra ID, GitHub, login.gov and others. Through specialised provider implementations OAuth2 Proxy can extract more details about the user like preferred usernames and groups. Those details can then be forwarded as HTTP headers to your upstream applications.
13+OAuth2-Proxy supports a lot of OAuth2 as well as OIDC providers. Either through a generic OIDC client or a specific implementation for Google, Microsoft Entra ID, GitHub, login.gov and others. Through specialised provider implementations oauth2-proxy can extract more details about the user like preferred usernames and groups. Those details can then be forwarded as HTTP headers to your upstream applications.
1614
1715![Simplified Architecture](docs/static/img/simplified-architecture.svg)
1816
1917## Get Started
2018
21−OAuth2 Proxy's [Installation Docs](https://oauth2-proxy.github.io/oauth2-proxy/installation) cover how to install and configure your setup. Additionally you can take a further look at the [example setup files](https://github.com/oauth2-proxy/oauth2-proxy/tree/master/contrib/local-environment).
19+OAuth2-Proxy's [Installation Docs](https://oauth2-proxy.github.io/oauth2-proxy/installation) cover how to install and configure your setup. Additionally you can take a further look at the [example setup files](https://github.com/oauth2-proxy/oauth2-proxy/tree/master/contrib/local-environment).
2220
2321## Releases
2422
2523### Binaries
26−We publish OAuth2 Proxy as compiled binaries on GitHub for all major architectures as well as more exotic ones like `ppc64le` as well as `s390x`.
24+We publish oauth2-proxy as compiled binaries on GitHub for all major architectures as well as more exotic ones like `ppc64le` as well as `s390x`.
2725
2826Check out the [latest release](https://github.com/oauth2-proxy/oauth2-proxy/releases/latest).
2927
@@ -37,26 +35,24 @@ Since 2023-11-18 we build nightly images directly from the `master` branch and p
3735These images are considered unstable and therefore should **NOT** be used for production purposes unless you know what you're doing.
3836
3937## Sponsors
40−Would you like to sponsor the project then please contact us at [sponsors@oauth2-proxy.dev](mailto:sponsors@oauth2-proxy.dev)
41−
42−![SAP](https://avatars.githubusercontent.com/u/2531208?s=300&v=4)
43−
44−SAP Open Source Program
45−
46−## Former Sponsors
47−![Microsoft](https://avatars.githubusercontent.com/u/6154722?s=100&v=4)
4838
39+![Microsoft](https://upload.wikimedia.org/wikipedia/commons/9/96/Microsoft_logo_%282012%29.svg)
4940Microsoft Azure credits for open source projects
5041
42+Would you like to sponsor the project then please contact us at [sponsors@oauth2-proxy.dev](mailto:sponsors@oauth2-proxy.dev)
43+
5144## Getting Involved
52−[![Slack](https://img.shields.io/badge/slack-CNCF_%23oauth2--proxy-blue?logo=slack)](https://cloud-native.slack.com/archives/C098Y5URZ2N)
45+[![Slack](https://img.shields.io/badge/slack-Gopher_%23oauth2--proxy-red?logo=slack)](https://gophers.slack.com/archives/CM2RSS25N)
5346
54−Join the #oauth2-proxy [Slack channel](https://cloud-native.slack.com/archives/C098Y5URZ2N) to chat with other users of OAuth2 Proxy or reach out to the maintainers directly. Use the [public invite link](https://slack.cncf.io/) to get an invite for the CNCF space.
47+Join the #oauth2-proxy [Slack channel](https://gophers.slack.com/archives/CM2RSS25N) to chat with other users of oauth2-proxy or reach out to the maintainers directly. Use the [public invite link](https://invite.slack.golangbridge.org/) to get an invite for the Gopher Slack space.
5548
56−OAuth2 Proxy is a community-driven project. We rely on the contribut️ions of our users to continually improve it. While review times can vary, we appreciate your patience and understanding. As a volunteer-driven project, we strive to keep this project stable and might take longer to merge changes.
49+OAuth2-Proxy is a community-driven project. We rely on the contribut️ions of our users to continually improve it. While review times can vary, we appreciate your patience and understanding. As a volunteer-driven project, we strive to keep this project stable and might take longer to merge changes.
5750
5851If you want to contribute to the project. Please see our [Contributing](https://oauth2-proxy.github.io/oauth2-proxy/community/contribution) guide.
5952
53+Who uses OAuth2-Proxy? Have a look at our new [ADOPTERS](ADOPTERS.md) file and
54+feel free to open a PR to add your organisation.
55+
6056Thanks to all the people who already contributed ❤
6157
6258<a href="https://github.com/oauth2-proxy/oauth2-proxy/graphs/contributors">
@@ -70,7 +66,7 @@ Made with [contrib.rocks](https://contrib.rocks).
7066
7167If you believe you have found a vulnerability within OAuth2 Proxy or any of its dependencies, please do **NOT** open an issue or PR on GitHub, please do **NOT** post any details publicly.
7268
73−Security disclosures **MUST** be done in private. If you have found an issue that you would like to bring to the attention of the maintainers, please compose an email and send it to the list of people listed in our [MAINTAINERS.md](MAINTAINERS.md) file.
69+Security disclosures **MUST** be done in private. If you have found an issue that you would like to bring to the attention of the maintainers, please compose an email and send it to the list of people listed in our [MAINTAINERS](MAINTAINERS) file.
7470
7571For more details read our full [Security Docs](https://oauth2-proxy.github.io/oauth2-proxy/community/security#security-disclosures)
7672
@@ -86,20 +82,9 @@ See [open redirect vulnerability](https://github.com/oauth2-proxy/oauth2-proxy/s
8682
8783**2020-03-29:** This project was formerly hosted as `pusher/oauth2_proxy` but has been renamed to `oauth2-proxy/oauth2-proxy`. Going forward, all images shall be available at `quay.io/oauth2-proxy/oauth2-proxy` and binaries will be named `oauth2-proxy`.
8884
89−## Code of Conduct
90−Participation in the OAuth2 Proxy project is governed by the [CNCF Code of Conduct](CODE_OF_CONDUCT.md).
91−
9285## License
9386
94−OAuth2 Proxy is distributed under [The MIT License](LICENSE).
87+OAuth2-Proxy is distributed under [The MIT License](LICENSE).
9588
9689
9790[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Foauth2-proxy%2Foauth2-proxy.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Foauth2-proxy%2Foauth2-proxy?ref=badge_large)
98−
99−## Trademarks
100−
101−OAuth2 Proxy is a [Cloud Native Computing Foundation](https://cncf.io) Sandbox project.
102−
103−![CNCF](https://www.cncf.io/wp-content/uploads/2023/04/cncf-main-site-logo.svg)
104−
105−The Linux Foundation® (TLF) has registered trademarks and uses trademarks. For a list of TLF trademarks, see [Trademark Usage](https://www.linuxfoundation.org/legal/trademark-usage).
contrib/local-environment/Makefile+2−2
@@ -49,8 +49,8 @@ kubernetes-down:
4949
5050.PHONY: traefik-up
5151traefik-up:
52− docker compose -f docker-compose-traefik.yaml up -d
52+ docker compose -f docker-compose.yaml -f docker-compose-traefik.yaml up -d
5353
5454.PHONY: traefik-%
5555traefik-%:
56− docker compose -f docker-compose-traefik.yaml $*
56+ docker compose -f docker-compose.yaml -f docker-compose-traefik.yaml $*
contrib/local-environment/dex-traefik.yamldeleted−25
@@ -1,25 +0,0 @@
1−# This configuration is intended to be used with the Traefik local environment.
2−# Dex uses in-memory storage because this environment is disposable.
3−issuer: http://dex.localtest.me/dex
4−storage:
5− type: memory
6−web:
7− http: 0.0.0.0:5556
8−oauth2:
9− skipApprovalScreen: true
10−expiry:
11− signingKeys: "4h"
12− idTokens: "1h"
13−staticClients:
14− - id: oauth2-proxy
15− redirectURIs:
16− - "http://oauth2-proxy.localtest.me/oauth2/callback"
17− name: "OAuth2 Proxy"
18− secret: b2F1dGgyLXByb3h5LWNsaWVudC1zZWNyZXQK
19−enablePasswordDB: true
20−staticPasswords:
21− - email: "admin@example.com"
22− # bcrypt hash of the string "password"
23− hash: "$2a$10$2b2cU8CPhOTaGrs1HRQuAueS7JTT5ZHsHSzYiFPm1leZck7Mc8T4W"
24− username: "admin"
25− userID: "08a8684b-db88-4b73-90a9-3cd1661f5466"
contrib/local-environment/dex.yaml+17−13
@@ -3,7 +3,11 @@
33# This should configure Dex to run on port 5556 and provides a static login
44issuer: http://dex.localtest.me:5556/dex
55storage:
6− type: memory
6+ type: etcd
7+ config:
8+ endpoints:
9+ - http://etcd:2379
10+ namespace: dex/
711web:
812 http: 0.0.0.0:5556
913oauth2:
@@ -12,17 +16,17 @@ expiry:
1216 signingKeys: "4h"
1317 idTokens: "1h"
1418staticClients:
15− - id: oauth2-proxy
16− redirectURIs:
17− # These redirect URIs point to the `--redirect-url` for OAuth2 proxy.
18− - "http://oauth2-proxy.localtest.me:4180/oauth2/callback" # For basic proxy example.
19− - "http://oauth2-proxy.localtest.me:8080/oauth2/callback" # For nginx example.
20− name: "OAuth2 Proxy"
21− secret: b2F1dGgyLXByb3h5LWNsaWVudC1zZWNyZXQK
19+- id: oauth2-proxy
20+ redirectURIs:
21+ # These redirect URIs point to the `--redirect-url` for OAuth2 proxy.
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.
24+ name: 'OAuth2 Proxy'
25+ secret: b2F1dGgyLXByb3h5LWNsaWVudC1zZWNyZXQK
2226enablePasswordDB: true
2327staticPasswords:
24− - email: "admin@example.com"
25− # bcrypt hash of the string "password"
26− hash: "$2a$10$2b2cU8CPhOTaGrs1HRQuAueS7JTT5ZHsHSzYiFPm1leZck7Mc8T4W"
27− username: "admin"
28− userID: "08a8684b-db88-4b73-90a9-3cd1661f5466"
28+- email: "admin@example.com"
29+ # bcrypt hash of the string "password"
30+ hash: "$2a$10$2b2cU8CPhOTaGrs1HRQuAueS7JTT5ZHsHSzYiFPm1leZck7Mc8T4W"
31+ username: "admin"
32+ userID: "08a8684b-db88-4b73-90a9-3cd1661f5466"
contrib/local-environment/docker-compose-alpha-config.yaml+16−3
@@ -1,7 +1,7 @@
11# This docker-compose file can be used to bring up an example instance of oauth2-proxy
22# for manual testing and exploration of features.
33# Alongside OAuth2-Proxy, this file also starts Dex to act as the identity provider,
4−# HTTPBin as an example upstream.
4+# etcd for storage for Dex and HTTPBin as an example upstream.
55# This file also uses alpha configuration when configuring OAuth2 Proxy.
66#
77# This file is an extension of the main compose file and must be used with it
@@ -14,7 +14,7 @@ version: "3.0"
1414services:
1515 oauth2-proxy:
1616 container_name: oauth2-proxy
17− image: quay.io/oauth2-proxy/oauth2-proxy:v7.15.4
17+ image: quay.io/oauth2-proxy/oauth2-proxy:v7.13.0
1818 command: --config /oauth2-proxy.cfg --alpha-config /oauth2-proxy-alpha-config.yaml
1919 hostname: oauth2-proxy
2020 volumes:
@@ -31,7 +31,7 @@ services:
3131 - httpbin
3232 dex:
3333 container_name: dex
34− image: ghcr.io/dexidp/dex:v2.45.1
34+ image: ghcr.io/dexidp/dex:v2.43.1
3535 command: dex serve /dex.yaml
3636 hostname: dex
3737 volumes:
@@ -43,12 +43,25 @@ services:
4343 dex:
4444 aliases:
4545 - dex.localtest.me
46+ etcd: {}
47+ depends_on:
48+ - etcd
4649 httpbin:
4750 container_name: httpbin
4851 image: kennethreitz/httpbin
4952 ports: []
5053 networks:
5154 httpbin: {}
55+ etcd:
56+ container_name: etcd
57+ image: gcr.io/etcd-development/etcd:v3.6.2
58+ entrypoint: /usr/local/bin/etcd
59+ command:
60+ - --listen-client-urls=http://0.0.0.0:2379
61+ - --advertise-client-urls=http://etcd:2379
62+ networks:
63+ etcd: {}
5264networks:
5365 dex: {}
66+ etcd: {}
5467 httpbin: {}
contrib/local-environment/docker-compose-gitea.yaml+2−2
@@ -14,7 +14,7 @@ version: '3.0'
1414services:
1515 oauth2-proxy:
1616 container_name: oauth2-proxy
17− image: quay.io/oauth2-proxy/oauth2-proxy:v7.15.4
17+ image: quay.io/oauth2-proxy/oauth2-proxy:v7.13.0
1818 command: --config /oauth2-proxy.cfg
1919 hostname: oauth2-proxy
2020 volumes:
@@ -39,7 +39,7 @@ services:
3939 httpbin: {}
4040
4141 gitea:
42− image: gitea/gitea:1.27.2
42+ image: gitea/gitea:1.25.1
4343 container_name: gitea
4444 environment:
4545 - USER_UID=1000
contrib/local-environment/docker-compose-keycloak.yaml+6−6
@@ -10,11 +10,11 @@
1010#
1111# Access http://oauth2-proxy.localtest.me:4180 to initiate a login cycle using user=admin@example.com, password=password
1212# Access http://keycloak.localtest.me:9080 with the same credentials to check out the settings
13−version: "3.0"
13+version: '3.0'
1414services:
1515 oauth2-proxy:
1616 container_name: oauth2-proxy
17− image: quay.io/oauth2-proxy/oauth2-proxy:v7.15.4
17+ image: quay.io/oauth2-proxy/oauth2-proxy:v7.13.0
1818 command: --config /oauth2-proxy.cfg
1919 hostname: oauth2-proxy
2020 volumes:
@@ -40,12 +40,12 @@ services:
4040
4141 keycloak:
4242 container_name: keycloak
43− image: keycloak/keycloak:26.7
43+ image: keycloak/keycloak:25.0
4444 hostname: keycloak
4545 command:
46− - "start-dev"
47− - "--http-port=9080"
48− - "--import-realm"
46+ - 'start-dev'
47+ - '--http-port=9080'
48+ - '--import-realm'
4949 volumes:
5050 - ./keycloak:/opt/keycloak/data/import
5151 environment:
contrib/local-environment/docker-compose-nginx.yaml+33−9
@@ -1,28 +1,38 @@
11# This docker-compose file can be used to bring up an example instance of oauth2-proxy
22# for manual testing and exploration of features.
33# Alongside OAuth2-Proxy, this file also starts Dex to act as the identity provider,
4−# nginx as a reverse proxy and other HTTP services for upstreams.
4+# etcd for storage for Dex, nginx as a reverse proxy and other http services for upstreams
55#
66# This file is an extension of the main compose file and must be used with it
77# docker-compose -f docker-compose.yaml -f docker-compose-nginx.yaml <command>
88# Alternatively:
99# make nginx-<command> (eg make nginx-up, make nginx-down)
1010#
11−# Access http://oauth2-proxy.localtest.me:8080 to initiate a login flow.
12−version: "3.0"
11+# Access one of the following URLs to initiate a login flow:
12+# - http://oauth2-proxy.localhost
13+# - http://httpbin.oauth2-proxy.localhost
14+#
15+# The OAuth2 Proxy itself is hosted at http://oauth2-proxy.oauth2-proxy.localhost
16+#
17+# Note, the above URLs should work with Chrome, but you may need to add hosts
18+# entries for other browsers
19+# 127.0.0.1 oauth2-proxy.localhost
20+# 127.0.0.1 httpbin.oauth2-proxy.localhost
21+# 127.0.0.1 oauth2-proxy.oauth2-proxy.localhost
22+version: '3.0'
1323services:
1424 oauth2-proxy:
15− image: quay.io/oauth2-proxy/oauth2-proxy:v7.15.4
25+ image: quay.io/oauth2-proxy/oauth2-proxy:v7.13.0
1626 ports: []
1727 hostname: oauth2-proxy
1828 container_name: oauth2-proxy
1929 command: --config /oauth2-proxy.cfg
20− restart: unless-stopped
2130 volumes:
2231 - "./oauth2-proxy-nginx.cfg:/oauth2-proxy.cfg"
2332 networks:
2433 oauth2-proxy: {}
2534 dex: {}
35+ etcd: {}
2636 httpbin: {}
2737 depends_on:
2838 - dex
@@ -31,38 +41,52 @@ services:
3141 depends_on:
3242 - oauth2-proxy
3343 container_name: nginx
34− image: nginx:1.31
44+ image: nginx:1.29
3545 restart: unless-stopped
3646 ports:
37− - 8080:8080/tcp
47+ - 80:80/tcp
3848 hostname: nginx
3949 volumes:
4050 - "./nginx.conf:/etc/nginx/conf.d/default.conf"
4151 networks:
4252 oauth2-proxy: {}
4353 dex: {}
54+ etcd: {}
4455 httpbin: {}
4556 dex:
4657 container_name: dex
47− image: ghcr.io/dexidp/dex:v2.45.1
58+ image: ghcr.io/dexidp/dex:v2.44.0
4859 command: dex serve /dex.yaml
4960 hostname: dex
5061 volumes:
5162 - "./dex.yaml:/dex.yaml"
5263 restart: unless-stopped
5364 ports:
54− - 5556:5556/tcp
65+ - 5556:4181/tcp
5566 networks:
5667 dex:
5768 aliases:
5869 - dex.localtest.me
70+ etcd: {}
71+ depends_on:
72+ - etcd
5973 httpbin:
6074 container_name: httpbin
6175 image: kennethreitz/httpbin
6276 ports: []
6377 networks:
6478 httpbin: {}
79+ etcd:
80+ container_name: etcd
81+ image: gcr.io/etcd-development/etcd:v3.6.5
82+ entrypoint: /usr/local/bin/etcd
83+ command:
84+ - --listen-client-urls=http://0.0.0.0:2379
85+ - --advertise-client-urls=http://etcd:2379
86+ networks:
87+ etcd: {}
6588networks:
6689 dex: {}
90+ etcd: {}
6791 httpbin: {}
6892 oauth2-proxy: {}
contrib/local-environment/docker-compose-traefik.yaml+18−42
@@ -1,7 +1,7 @@
11# This docker-compose file can be used to bring up an example instance of oauth2-proxy
22# for manual testing and exploration of features.
3−# Alongside OAuth2-Proxy, this file also starts Dex to act as the identity provider
4−# and HTTPBin as an example upstream.
3+# Alongside OAuth2-Proxy, this file also starts Dex to act as the identity provider,
4+# HTTPBin as an example upstream.
55#
66# This can either be created using docker-compose
77# docker-compose -f docker-compose-traefik.yaml <command>
@@ -9,51 +9,32 @@
99# make traefik-<command> (eg. make traefik-up, make traefik-down)
1010#
1111# Access one of the following URLs to initiate a login flow:
12−# - http://oauth2-proxy.localtest.me
13−# - http://httpbin.localtest.me
14−# - http://dex.localtest.me/dex
12+# - http://oauth2-proxy.localhost
13+# - http://httpbin.oauth2-proxy.localhost
1514#
16−# The OAuth2 Proxy itself is hosted at http://oauth2-proxy.localtest.me
15+# The OAuth2 Proxy itself is hosted at http://oauth2-proxy.oauth2-proxy.localhost
16+#
17+# Note, the above URLs should work with Chrome, but you may need to add hosts
18+# entries for other browsers
19+# 127.0.0.1 oauth2-proxy.localhost
20+# 127.0.0.1 httpbin.oauth2-proxy.localhost
21+# 127.0.0.1 oauth2-proxy.oauth2-proxy.localhost
22+version: '3.0'
1723services:
1824
1925 oauth2-proxy:
20− container_name: oauth2-proxy
21− image: quay.io/oauth2-proxy/oauth2-proxy:v7.15.4
22− command: --config /oauth2-proxy.cfg
26+ image: quay.io/oauth2-proxy/oauth2-proxy:v7.13.0
2327 ports: []
2428 hostname: oauth2-proxy
2529 volumes:
2630 - "./oauth2-proxy-traefik.cfg:/oauth2-proxy.cfg"
27− restart: unless-stopped
28− networks:
29− oauth2-proxy: {}
30− dex: {}
31− depends_on:
32− - dex
33− - httpbin
34−
35− dex:
36− container_name: dex
37− image: ghcr.io/dexidp/dex:v2.45.1
38− command: dex serve /dex.yaml
39− hostname: dex
40− volumes:
41− - "./dex-traefik.yaml:/dex.yaml"
42− restart: unless-stopped
4331 networks:
44− dex: {}
45−
46− httpbin:
47− container_name: httpbin
48− image: kennethreitz/httpbin
49− ports: []
50− networks:
51− httpbin: {}
32+ oauth2-proxy:
5233
5334 # Reverse proxy
5435 gateway:
5536 container_name: traefik
56− image: traefik:v3.7.10
37+ image: traefik:v2.11.30
5738 volumes:
5839 - "./traefik:/etc/traefik"
5940 ports:
@@ -62,13 +43,8 @@ services:
6243 depends_on:
6344 - oauth2-proxy
6445 networks:
65− oauth2-proxy: {}
66− httpbin: {}
67− dex:
68− aliases:
69− - dex.localtest.me
46+ oauth2-proxy:
47+ httpbin:
7048
7149networks:
72− dex: {}
73− httpbin: {}
74− oauth2-proxy: {}
50+ oauth2-proxy:
contrib/local-environment/docker-compose.yaml+16−3
@@ -1,7 +1,7 @@
11# This docker-compose file can be used to bring up an example instance of oauth2-proxy
22# for manual testing and exploration of features.
33# Alongside OAuth2-Proxy, this file also starts Dex to act as the identity provider,
4−# HTTPBin as an example upstream.
4+# etcd for storage for Dex and HTTPBin as an example upstream.
55#
66# This can either be created using docker-compose
77# docker-compose -f docker-compose.yaml <command>
@@ -13,7 +13,7 @@ version: "3.0"
1313services:
1414 oauth2-proxy:
1515 container_name: oauth2-proxy
16− image: quay.io/oauth2-proxy/oauth2-proxy:v7.15.4
16+ image: quay.io/oauth2-proxy/oauth2-proxy:v7.13.0
1717 command: --config /oauth2-proxy.cfg
1818 hostname: oauth2-proxy
1919 volumes:
@@ -29,7 +29,7 @@ services:
2929 - httpbin
3030 dex:
3131 container_name: dex
32− image: ghcr.io/dexidp/dex:v2.45.1
32+ image: ghcr.io/dexidp/dex:v2.44.0
3333 command: dex serve /dex.yaml
3434 hostname: dex
3535 volumes:
@@ -41,12 +41,25 @@ services:
4141 dex:
4242 aliases:
4343 - dex.localtest.me
44+ etcd: {}
45+ depends_on:
46+ - etcd
4447 httpbin:
4548 container_name: httpbin
4649 image: kennethreitz/httpbin
4750 ports: []
4851 networks:
4952 httpbin: {}
53+ etcd:
54+ container_name: etcd
55+ image: gcr.io/etcd-development/etcd:v3.6.5
56+ entrypoint: /usr/local/bin/etcd
57+ command:
58+ - --listen-client-urls=http://0.0.0.0:2379
59+ - --advertise-client-urls=http://etcd:2379
60+ networks:
61+ etcd: {}
5062networks:
5163 dex: {}
64+ etcd: {}
5265 httpbin: {}
contrib/local-environment/kubernetes/Chart.lock+3−3
@@ -1,7 +1,7 @@
11dependencies:
22- name: dex
33 repository: https://charts.dexidp.io
4− version: 0.24.1
4+ version: 0.24.0
55- name: oauth2-proxy
66 repository: https://oauth2-proxy.github.io/manifests
77 version: 7.18.0
@@ -11,5 +11,5 @@ dependencies:
1111- name: hello-world
1212 repository: https://conservis.github.io/helm-charts
1313 version: 1.1.0
14−digest: sha256:3fff8bf99cebcd20a73c984423d5f1c2dfa1e5a394f82a5dc60d9aaffe5361b7
15−generated: "2026-08-18T07:33:03.791274914Z"
14+digest: sha256:fee913531bfb67e5555e995d8fb040c330e6eb4b5a8c777ceb9841135ea9bb84
15+generated: "2025-10-28T06:46:35.38300324Z"
contrib/local-environment/kubernetes/Chart.yaml+1−1
@@ -3,7 +3,7 @@ description: K8S example based on https://kind.sigs.k8s.io
33name: kubernetes
44dependencies:
55 - name: dex
6− version: 0.24.1
6+ version: 0.24.0
77 repository: https://charts.dexidp.io
88 - name: oauth2-proxy
99 version: &chartVersion 7.18.0
contrib/local-environment/nginx.conf+73−31
@@ -1,44 +1,86 @@
1+# Reverse proxy to oauth2-proxy
2+server {
3+ listen 80;
4+ server_name oauth2-proxy.oauth2-proxy.localhost;
5+
6+ location / {
7+ proxy_set_header Host $host;
8+ proxy_set_header X-Real-IP $remote_addr;
9+
10+ proxy_pass http://oauth2-proxy:4180/;
11+ }
12+}
13+
114# Reverse proxy to httpbin
215server {
3− listen 8080;
4− server_name oauth2-proxy.localtest.me;
5−
6− location /oauth2/ {
7− proxy_pass http://oauth2-proxy:4180;
8− proxy_set_header Host $host;
9− proxy_set_header X-Real-IP $remote_addr;
10− proxy_set_header X-Forwarded-Uri $request_uri;
11− proxy_set_header X-Auth-Request-Redirect $request_uri;
16+ listen 80;
17+ server_name httpbin.oauth2-proxy.localhost;
18+
19+ auth_request /internal-auth/oauth2/auth;
20+
21+ # If the auth_request denies the request (401), redirect to the sign_in page
22+ # and include the final rd URL back to the user's original request.
23+ error_page 401 =403 http://oauth2-proxy.oauth2-proxy.localhost/oauth2/sign_in?rd=$scheme://$host$request_uri;
24+
25+ # Alternatively send the request to `start` to skip the provider button
26+ # error_page 401 = http://oauth2-proxy.oauth2-proxy.localhost/oauth2/start?rd=$scheme://$host$request_uri;
27+
28+ location / {
29+ proxy_pass http://httpbin/;
1230 }
1331
14− location = /oauth2/auth {
15− proxy_pass http://oauth2-proxy:4180;
16− proxy_set_header Host $host;
17− proxy_set_header X-Real-IP $remote_addr;
18− proxy_set_header X-Forwarded-Uri $request_uri;
19− # nginx auth_request includes headers but not body
20− proxy_set_header Content-Length "";
21− proxy_pass_request_body off;
32+ # auth_request must be a URI so this allows an internal path to then proxy to
33+ # the real auth_request path.
34+ # The trailing /'s are required so that nginx strips the prefix before proxying.
35+ location /internal-auth/ {
36+ internal; # Ensure external users can't access this path
37+
38+ # Make sure the OAuth2 Proxy knows where the original request came from.
39+ proxy_set_header Host $host;
40+ proxy_set_header X-Real-IP $remote_addr;
41+ proxy_set_header X-Forwarded-Uri $request_uri;
42+
43+ proxy_pass http://oauth2-proxy:4180/;
2244 }
45+}
46+
47+# Statically serve the nginx welcome
48+server {
49+ listen 80;
50+ server_name oauth2-proxy.localhost;
2351
2452 location / {
25− auth_request /oauth2/auth;
26− error_page 401 = @oauth2_signin;
53+ auth_request /internal-auth/oauth2/auth;
2754
28− # pass information via X-User and X-Email headers to backend,
29− # requires running with --set-xauthrequest flag
30− auth_request_set $user $upstream_http_x_auth_request_user;
31− auth_request_set $email $upstream_http_x_auth_request_email;
32− proxy_set_header X-User $user;
33− proxy_set_header X-Email $email;
55+ # If the auth_request denies the request (401), redirect to the sign_in page
56+ # and include the final rd URL back to the user's original request.
57+ error_page 401 =403 http://oauth2-proxy.oauth2-proxy.localhost/oauth2/sign_in?rd=$scheme://$host$request_uri;
3458
35− proxy_pass http://httpbin/;
36− # or "root /path/to/site;" or "fastcgi_pass ..." etc
59+ # Alternatively send the request to `start` to skip the provider button
60+ # error_page 401 = http://oauth2-proxy.oauth2-proxy.localhost/oauth2/start?rd=$scheme://$host$request_uri;
61+
62+
63+ root /usr/share/nginx/html;
64+ index index.html index.htm;
65+ }
66+
67+ # redirect server error pages to the static page /50x.html
68+ error_page 500 502 503 504 /50x.html;
69+ location = /50x.html {
70+ root /usr/share/nginx/html;
3771 }
3872
39− # Named location for handling OAuth2 sign-in redirects
40− # This ensures the browser receives a proper 302 redirect that it will follow
41− location @oauth2_signin {
42− return 302 /oauth2/sign_in?rd=$scheme://$http_host$request_uri;
73+ # auth_request must be a URI so this allows an internal path to then proxy to
74+ # the real auth_request path.
75+ # The trailing /'s are required so that nginx strips the prefix before proxying.
76+ location /internal-auth/ {
77+ internal; # Ensure external users can't access this path
78+
79+ # Make sure the OAuth2 Proxy knows where the original request came from.
80+ proxy_set_header Host $host;
81+ proxy_set_header X-Real-IP $remote_addr;
82+ proxy_set_header X-Forwarded-Uri $request_uri;
83+
84+ proxy_pass http://oauth2-proxy:4180/;
4385 }
4486}
contrib/local-environment/oauth2-proxy-nginx.cfg+6−11
@@ -1,19 +1,14 @@
11http_address="0.0.0.0:4180"
22cookie_secret="OQINaROshtE9TcZkNAm-5Zs2Pv3xaWytBmc5W7sPX7w="
3+provider="oidc"
34email_domains="example.com"
4−cookie_secure="false"
5−upstreams="static://200"
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
5+oidc_issuer_url="http://dex.localtest.me:5556/dex"
106client_secret="b2F1dGgyLXByb3h5LWNsaWVudC1zZWNyZXQK"
117client_id="oauth2-proxy"
12−redirect_url="http://oauth2-proxy.localtest.me:8080/oauth2/callback"
13−
14−oidc_issuer_url="http://dex.localtest.me:5556/dex"
15−provider="oidc"
16−provider_display_name="Dex"
8+cookie_secure="false"
179
10+redirect_url="http://oauth2-proxy.oauth2-proxy.localhost/oauth2/callback"
11+cookie_domains=".oauth2-proxy.localhost" # Required so cookie can be read on all subdomains.
12+whitelist_domains=".oauth2-proxy.localhost" # Required to allow redirection back to original requested target.
1813# Enables the use of `X-Forwarded-*` headers to determine request correctly
1914reverse_proxy="true"
contrib/local-environment/oauth2-proxy-traefik.cfg+4−4
@@ -2,14 +2,14 @@ http_address="0.0.0.0:4180"
22cookie_secret="OQINaROshtE9TcZkNAm-5Zs2Pv3xaWytBmc5W7sPX7w="
33provider="oidc"
44email_domains=["example.com"]
5−oidc_issuer_url="http://dex.localtest.me/dex"
5+oidc_issuer_url="http://dex.localhost:5556/dex"
66client_secret="b2F1dGgyLXByb3h5LWNsaWVudC1zZWNyZXQK"
77client_id="oauth2-proxy"
88cookie_secure="false"
99
10−redirect_url="http://oauth2-proxy.localtest.me/oauth2/callback"
11−cookie_domains=".localtest.me" # Required so cookie can be read on all subdomains.
12−whitelist_domains=".localtest.me" # Required to allow redirection back to original requested target.
10+redirect_url="http://oauth2-proxy.oauth2-proxy.localhost/oauth2/callback"
11+cookie_domains=".oauth2-proxy.localhost" # Required so cookie can be read on all subdomains.
12+whitelist_domains=".oauth2-proxy.localhost" # Required to allow redirection back to original requested target.
1313
1414# Mandatory option when using oauth2-proxy with traefik
1515reverse_proxy="true"
contrib/local-environment/traefik/dynamic.yaml+4−11
@@ -1,25 +1,22 @@
11http:
22 routers:
33 oauth2-proxy-route:
4− rule: "Host(`oauth2-proxy.localtest.me`)"
4+ rule: "Host(`oauth2-proxy.oauth2-proxy.localhost`)"
55 middlewares:
66 - auth-headers
77 service: oauth-backend
8− dex-route:
9− rule: "Host(`dex.localtest.me`)"
10− service: dex-service
118 httpbin-route:
12− rule: "Host(`httpbin.localtest.me`)"
9+ rule: "Host(`httpbin.oauth2-proxy.localhost`)"
1310 service: httpbin-service
1411 middlewares:
1512 - oauth-auth-redirect # redirects all unauthenticated to oauth2 signin
1613 httpbin-route-2:
17− rule: "Host(`httpbin.localtest.me`) && PathPrefix(`/no-auto-redirect`)"
14+ rule: "Host(`httpbin.oauth2-proxy.localhost`) && PathPrefix(`/no-auto-redirect`)"
1815 service: httpbin-service
1916 middlewares:
2017 - oauth-auth-wo-redirect # unauthenticated session will return a 401
2118 services-oauth2-route:
22− rule: "Host(`httpbin.localtest.me`) && PathPrefix(`/oauth2/`)"
19+ rule: "Host(`httpbin.oauth2-proxy.localhost`) && PathPrefix(`/oauth2/`)"
2320 middlewares:
2421 - auth-headers
2522 service: oauth-backend
@@ -33,10 +30,6 @@ http:
3330 loadBalancer:
3431 servers:
3532 - url: http://oauth2-proxy:4180
36− dex-service:
37− loadBalancer:
38− servers:
39− - url: http://dex:5556
4033
4134 middlewares:
4235 auth-headers:
contrib/local-environment/traefik/traefik.yaml−2
@@ -5,5 +5,3 @@ log:
55providers:
66 file:
77 filename: /etc/traefik/dynamic.yaml
8− # Routes are static for this example; disabling watch avoids host inotify limits.
9− watch: false
dist.sh+3−10
@@ -30,23 +30,16 @@ for ARCH in "${ARCHS[@]}"; do
3030 GO_OS=$(echo $ARCH | awk -F- '{print $1}')
3131 GO_ARCH=$(echo $ARCH | awk -F- '{print $2}')
3232
33− # Determine binary name based on OS
34− if [[ "${GO_OS}" == "windows" ]]; then
35− BINARY_NAME="${BINARY}.exe"
36− else
37− BINARY_NAME="${BINARY}"
38− fi
39−
4033 # Create architecture specific binaries
4134 if [[ ${GO_ARCH} == armv* ]]; then
4235 GO_ARM=$(echo $GO_ARCH | awk -Fv '{print $2}')
4336 GO111MODULE=on GOOS=${GO_OS} GOARCH=arm GOARM=${GO_ARM} CGO_ENABLED=0 go build \
4437 -ldflags="-X github.com/oauth2-proxy/oauth2-proxy/v7/pkg/version.VERSION=${VERSION}" \
45− -o release/${BINARY}-${VERSION}.${ARCH}/${BINARY_NAME} .
38+ -o release/${BINARY}-${VERSION}.${ARCH}/${BINARY} .
4639 else
4740 GO111MODULE=on GOOS=${GO_OS} GOARCH=${GO_ARCH} CGO_ENABLED=0 go build \
4841 -ldflags="-X github.com/oauth2-proxy/oauth2-proxy/v7/pkg/version.VERSION=${VERSION}" \
49− -o release/${BINARY}-${VERSION}.${ARCH}/${BINARY_NAME} .
42+ -o release/${BINARY}-${VERSION}.${ARCH}/${BINARY} .
5043 fi
5144
5245 cd release
@@ -58,7 +51,7 @@ for ARCH in "${ARCHS[@]}"; do
5851 sha256sum ${BINARY}-${VERSION}.${ARCH}.tar.gz > ${BINARY}-${VERSION}.${ARCH}.tar.gz-sha256sum.txt
5952
6053 # Create sha256sum for architecture specific binary
61− sha256sum ${BINARY}-${VERSION}.${ARCH}/${BINARY_NAME} > ${BINARY}-${VERSION}.${ARCH}-sha256sum.txt
54+ sha256sum ${BINARY}-${VERSION}.${ARCH}/${BINARY} > ${BINARY}-${VERSION}.${ARCH}-sha256sum.txt
6255
6356 cd ..
6457done
docs/docs/behaviour.md+5−20
@@ -3,24 +3,9 @@ id: behaviour
33title: Behaviour
44---
55
6−1. Authentication Requirement: All requests passing through the proxy to upstream applications require authentication, excluding default proxy endpoints.
7− - Exception: If the request matches a skipped route (configured via `--skip-auth-route`):
8− - Authentication is not enforced, but the proxy will opportunistically attempt to validate a session cookie (`--cookie-name`) or JWT (`--skip-jwt-bearer-tokens`) if present in the request.
9− - Configured user info and authentication headers (e.g., `--pass-access-token`) are injected to upstream routes when validation succeeds.
6+1. Any request passing through the proxy (and not matched by `--skip-auth-regex`) is checked for the proxy's session cookie (`--cookie-name`) (or, if allowed, a JWT token - see `--skip-jwt-bearer-tokens`).
7+2. If authentication is required but missing then the user is asked to log in and redirected to the authentication provider (unless it is an Ajax request, i.e. one with `Accept: application/json`, in which case 401 Unauthorized is returned)
8+3. After returning from the authentication provider, the oauth tokens are stored in the configured session store (cookie, redis, ...) and a cookie is set
9+4. The request is forwarded to the upstream server with added user info and authentication headers (depending on the configuration)
1010
11−2. Unauthenticated Requests: When authentication is missing but required, the user is redirected to the configured Identity Provider (IdP) login page by default.
12− - Ajax Requests: If the request has `Accept: application/json` header:
13− - Returns `401 Unauthorized`.
14− - Invalid JWT Tokens: If `--skip-jwt-bearer-tokens` is set and the request includes an invalid JWT:
15− - Redirects to the login page by default.
16− - Returns `403 Forbidden` if `--bearer-token-login-fallback` is set to `false`.
17−
18−3. Post-Authentication: After successful authentication with the IdP, OAuth tokens are stored in the configured session store (cookie or Redis), and a cookie is set.
19−
20−4. Request Forwarding: The authenticated request is processed based on configuration:
21− - Forwarded to the configured upstream application with added user info and authentication headers, or
22− - Returns a valid status code for downstream processing by another proxy or load balancer (e.g., Nginx or Traefik).
23−
24−---
25−
26−Note: The proxy also provides a number of useful [endpoints](features/endpoints.md) for monitoring and management.
11+Notice that the proxy also provides a number of useful [endpoints](features/endpoints.md).
docs/docs/community/contribution.md+3−3
@@ -39,7 +39,7 @@ For starting oauth2-proxy locally open the debugging tab and create the `launch.
3939 "version": "0.2.0",
4040 "configurations": [
4141 {
42− "name": "Launch OAuth2 Proxy with Dex",
42+ "name": "Launch OAuth2-Proxy with Dex",
4343 "type": "go",
4444 "request": "launch",
4545 "mode": "auto",
@@ -52,7 +52,7 @@ For starting oauth2-proxy locally open the debugging tab and create the `launch.
5252 ]
5353 },
5454 {
55− "name": "Launch OAuth2 Proxy with Keycloak",
55+ "name": "Launch OAuth2-Proxy with Keycloak",
5656 "type": "go",
5757 "request": "launch",
5858 "mode": "auto",
@@ -85,7 +85,7 @@ The username and password for all setups is usually `admin@example.com` and `pas
8585
8686The docker compose setups expose the services with a dynamic reverse DNS resolver: localtest.me
8787
88−- OAuth2 Proxy: http://oauth2-proxy.localtest.me:4180
88+- OAuth2-Proxy: http://oauth2-proxy.localtest.me:4180
8989- Upstream: http://httpbin.localtest.me:8080
9090- Dex: http://dex.localtest.me:5556
9191
docs/docs/community/security.md+1−1
@@ -21,7 +21,7 @@ any details publicly.
2121Security disclosures MUST be done in private.
2222If you have found an issue that you would like to bring to the attention of the
2323maintenance team for OAuth2 Proxy, please compose an email and send it to the
24−list of maintainers in our [MAINTAINERS.md](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/MAINTAINERS.md) file.
24+list of maintainers in our [MAINTAINERS](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/MAINTAINERS) file.
2525
2626Please include as much detail as possible.
2727Ideally, your disclosure should include:
docs/docs/configuration/alpha_config.md+9−164
@@ -24,56 +24,17 @@ When using alpha configuration, your config file will look something like below:
2424upstreams:
2525 - id: ...
2626 ...: ...
27−providers:
28− - id: ...
29− ...: ...
30−cookie:
31− secret: ...
32− ...: ...
3327injectRequestHeaders:
34− - secretSource:
35− ...: ...
28+ - name: ...
29+ ...: ...
3630injectResponseHeaders:
37− - claimSource:
38− ...: ...
31+ - name: ...
32+ ...: ...
3933```
4034
4135Please browse the [reference](#configuration-reference) below for the structure
4236of the new configuration format.
4337
44−# Migration Guide
45−
46−This section details breaking changes and migration steps for moving to the new
47−alpha configuration format.
48−
49−## Migrating header injections in v7.14.0
50−
51−From v7.14.0 onward, header injection sources must be explicitly nested. If you
52−previously relied on squashed fields, update to the new structure before
53−upgrading:
54−
55−```yaml
56−# before v7.14.0
57−injectRequestHeaders:
58−- name: X-Forwarded-User
59− values:
60− - claim: user
61−- name: X-Custom-Secret-header
62− values:
63− - value: my-super-secret
64−
65−# v7.14.0 and later
66−injectRequestHeaders:
67−- name: X-Forwarded-User
68− values:
69− - claimSource:
70− claim: user
71−- name: X-Custom-Secret-header
72− values:
73− - secretSource:
74− value: my-super-secret
75−```
76−
7738## Using Alpha Configuration
7839
7940To use the new **alpha** configuration, generate a YAML file based on the format
@@ -106,20 +67,9 @@ the new config.
10667oauth2-proxy --alpha-config ./path/to/new/config.yaml --config ./path/to/existing/config.cfg
10768```
10869
109−### Validating Alpha Configuration
110−
111−Use `--config-test` to validate your alpha configuration without starting the proxy:
112−
113−```bash
114−oauth2-proxy --config core.cfg --alpha-config alpha.yaml --config-test
115−```
116−
117−This is useful for CI/CD pipelines to catch configuration errors before deployment.
118−See the [Configuration Validation](./overview.md#configuration-validation) section for more details.
70+## Using ENV variables in the alpha configuration
11971
120−### How to use environment variables
121−
122−The alpha package supports the use of environment variables in place of yaml values, allowing sensitive data to be pulled from somewhere other than the yaml file.
72+The alpha package supports the use of environment variables in place of yaml keys, allowing sensitive values to be pulled from somewhere other than the yaml file.
12373When using environment variables, your yaml will look like this:
12474
12575```yaml
@@ -131,109 +81,6 @@ When using environment variables, your yaml will look like this:
13181Where CLIENT_SECRET is an environment variable.
13282More information and available patterns can be found [here](https://github.com/a8m/envsubst#docs)
13383
134−### How to inject custom headers
135−
136−Configure `injectRequestHeaders` and `injectResponseHeaders` in alpha config YAML.
137−
138−```yaml
139−injectRequestHeaders:
140− - name: "X-User-Email"
141− values:
142− - claimSource:
143− claim: "email" # extract the email claim contents from the id token
144− - name: "X-Static-Secret"
145− values:
146− # secrets need to be encoded with base64 when directly in the yaml config but will be send decoded
147− - secretSource:
148− value: "c3VwZXItc2VjcmV0"
149− - name: "X-Static-File-Secret"
150− - secretSource:
151− fromFile: "/path/to/my/secret"
152− - name: "X-Static-Env-Secret"
153− - secretSource:
154− value: "${MY_SECRET_ENV}" # content still needs to be base64 encoded
155−injectResponseHeaders:
156− # Following will result in a header "Authorization: Basic <user:password> (encoded)"
157− - name: "Authorization"
158− values:
159− - claimSource:
160− claim: user
161− prefix: "Basic "
162− basicAuthPassword:
163− value: c3VwZXItc2VjcmV0LXBhc3N3b3Jk # base64 encoded password
164−```
165−
166−**Value sources:**
167−* `claimSource` - `claim` (session claims either from id token or from profile URL)
168−* `secretSource` - `value` (base64), `fromFile` (file path)
169−
170−#### Claim value serialization
171−
172−`claimSource` converts the selected claim into one or more string header values. Scalars
173−produce one value, while arrays produce one value per element. Values that cannot be
174−converted directly to strings, such as objects, are JSON-encoded individually.
175−
176−Each non-empty value is added separately under the configured header name. An array of
177−objects therefore produces multiple header values containing one JSON object each, not a
178−single JSON array. HTTP libraries and intermediaries may expose repeated values as a
179−comma-joined string, so consumers should retrieve and parse each header value separately.
180−
181−**Request option:** `preserveRequestValue: true` retains existing header values
182−
183−**Incompatibility:** Remove legacy flags `pass-user-headers`, `set-xauthrequest`
184−
185−### How to utilize arbitrary claims provided by your Identity Provider
186−
187−With the additionalClaims attribute you can specify which claims you want to extract
188−from the ID Token or userinfo (ProfileURL) endpoint.
189−
190−Configure these on the relevant provider entry:
191−
192−```yaml
193−providers:
194− - id: my-oidc-provider
195− provider: oidc
196− clientID: ${OAUTH_CLIENT_ID}
197− clientSecret: ${OAUTH_CLIENT_SECRET}
198− oidcConfig:
199− issuerURL: https://issuer.example.com
200− profileURL: https://issuer.example.com/oauth2/userinfo
201− additionalClaims:
202− - department
203− - employee_id
204− - organization.name
205−```
206−
207−OAuth2 Proxy resolves each configured claim using the following order:
208−
209−1. The raw ID token is checked first.
210−2. If the claim is not present there and `profileURL` is configured, the userinfo endpoint is queried.
211−3. If `skipClaimsFromProfileURL: true` is set, only the ID token is used.
212−
213−Claims that are not found are ignored rather than causing authentication to fail.
214−
215−You can use dot-separated paths for nested JSON objects, for example `organization.name`.
216−Array indexes are not supported.
217−
218−Once loaded, these claims are stored in the session as `additionalClaims`. They can then be
219−used anywhere session claims are accepted, including header injection:
220−
221−```yaml
222−injectRequestHeaders:
223− - name: X-Department
224− values:
225− - claimSource:
226− claim: department
227− - name: X-Organization
228− values:
229− - claimSource:
230− claim: organization.name
231−```
232−
233−This is useful when your IdP exposes application-specific attributes such as department,
234−tenant, employee ID, entitlement, or other custom claims that are not part of the default
235−OAuth2 Proxy session fields.
236−
23784## Removed options
23885
23986The following flags/options and their respective environment variables are no
@@ -562,7 +409,6 @@ character.
562409| `userIDClaim` | _string_ | UserIDClaim indicates which claim contains the user ID<br/>default set to 'email' |
563410| `audienceClaims` | _[]string_ | AudienceClaim allows to define any claim that is verified against the client id<br/>By default `aud` claim is used for verification. |
564411| `extraAudiences` | _[]string_ | ExtraAudiences is a list of additional audiences that are allowed<br/>to pass verification in addition to the client id. |
565−| `enabledSigningAlgs` | _[]string_ | EnabledSigningAlgs is a list of allowed JWT signing algorithms.<br/>When discovery is enabled, the effective set is the intersection<br/>between this list and the provider's discovered supported algorithms.<br/>By default `RS256` is used if nothing has been discovered or specified. |
566412
567413### Provider
568414
@@ -601,7 +447,6 @@ Provider holds all configuration for a single provider
601447| `scope` | _string_ | Scope is the OAuth scope specification |
602448| `allowedGroups` | _[]string_ | AllowedGroups is a list of restrict logins to members of this group |
603449| `code_challenge_method` | _string_ | The code challenge method |
604−| `additionalClaims` | _[]string_ | Additional claims to be obtained from the upstream IDP, either from the id_token or from the userinfo endpoint if configured. |
605450| `backendLogoutURL` | _string_ | URL to call to perform backend logout, `{id_token}` would be replaced by the actual `id_token` if available in the session |
606451
607452### ProviderType
@@ -647,8 +492,8 @@ Server represents the configuration for an HTTP(S) server
647492
648493| Field | Type | Description |
649494| ----- | ---- | ----------- |
650−| `bindAddress` | _string_ | BindAddress is the address on which to serve traffic.<br/>Different types of bind addresses are supported:<br/>* `[http://]<addr>:<port>`<br/>* `fd:<int>` (case insensitive)<br/>* `unix://<path>`<br/>Unix sockets are created with default system umask mode, which can be overridden, e.g.: `unix://my-socket,mode=0777`<br/>Square brackets are required for ipv6 address, e.g. `http://[::1]:4180`<br/>Leave blank or set to "-" to disable. |
651−| `secureBindAddress` | _string_ | SecureBindAddress is the address on which to serve secure traffic.<br/>Secure bind addresses need to respond with valid SSL and use the following format:<br/>* `[https://]<addr>:<port>`<br/>Square brackets are required for ipv6 address, e.g. `https://[::1]:4180`<br/>Leave blank or set to "-" to disable. |
495+| `bindAddress` | _string_ | BindAddress is the address on which to serve traffic.<br/>Leave blank or set to "-" to disable. |
496+| `secureBindAddress` | _string_ | SecureBindAddress is the address on which to serve secure traffic.<br/>Leave blank or set to "-" to disable. |
652497| `tls` | _[TLS](#tls)_ | TLS contains the information for loading the certificate and key for the<br/>secure traffic and further configuration for the TLS server. |
653498
654499### TLS
@@ -689,7 +534,7 @@ Requests will be proxied to this upstream if the path matches the request path.
689534| Field | Type | Description |
690535| ----- | ---- | ----------- |
691536| `id` | _string_ | ID should be a unique identifier for the upstream.<br/>This value is required for all upstreams. |
692−| `path` | _string_ | Path is used to map requests to the upstream server.<br/>The closest match will take precedence and all Paths must be unique.<br/>Without RewriteTarget, Path follows gorilla/mux route syntax.<br/>Eg:<br/>- `/foo`: Match only the explicit path `/foo`<br/>- `/bar/`: Match any path prefixed with `/bar/`<br/>- `/baz/{path:.*}`: Match any path prefixed with `/baz/`<br/>When RewriteTarget is set, Path is treated as a regular expression.<br/>Eg: `^/baz/(.*)$` matches any path prefixed with `/baz` and captures the<br/>remaining path for use with RewriteTarget. |
537+| `path` | _string_ | Path is used to map requests to the upstream server.<br/>The closest match will take precedence and all Paths must be unique.<br/>Path can also take a pattern when used with RewriteTarget.<br/>Path segments can be captured and matched using regular experessions.<br/>Eg:<br/>- `^/foo$`: Match only the explicit path `/foo`<br/>- `^/bar/$`: Match any path prefixed with `/bar/`<br/>- `^/baz/(.*)$`: Match any path prefixed with `/baz` and capture the remaining path for use with RewriteTarget |
693538| `rewriteTarget` | _string_ | RewriteTarget allows users to rewrite the request path before it is sent to<br/>the upstream server (for an HTTP/HTTPS upstream) or mapped to the filesystem<br/>(for a `file:` upstream).<br/>Use the Path to capture segments for reuse within the rewrite target.<br/>Eg: With a Path of `^/baz/(.*)`, a RewriteTarget of `/foo/$1` would rewrite<br/>the request `/baz/abc/123` to `/foo/abc/123` before proxying to the<br/>upstream server. Or if the upstream were `file:///app`, a request for<br/>`/baz/info.html` would return the contents of the file `/app/foo/info.html`. |
694539| `uri` | _string_ | The URI of the upstream server. This may be an HTTP(S) server of a File<br/>based URL. It may include a path, in which case all requests will be served<br/>under that path.<br/>Eg:<br/>- http://localhost:8080<br/>- https://service.localhost<br/>- https://service.localhost/path<br/>- file://host/path<br/>If the URI's path is "/base" and the incoming request was for "/dir",<br/>the upstream request will be for "/base/dir". |
695540| `insecureSkipTLSVerify` | _bool_ | InsecureSkipTLSVerify will skip TLS verification of upstream HTTPS hosts.<br/>This option is insecure and will allow potential Man-In-The-Middle attacks<br/>between OAuth2 Proxy and the upstream server.<br/>Defaults to false. |
docs/docs/configuration/alpha_config.md.tmpl+6−159
@@ -24,56 +24,17 @@ When using alpha configuration, your config file will look something like below:
2424upstreams:
2525 - id: ...
2626 ...: ...
27−providers:
28− - id: ...
29− ...: ...
30−cookie:
31− secret: ...
32− ...: ...
3327injectRequestHeaders:
34− - secretSource:
35− ...: ...
28+ - name: ...
29+ ...: ...
3630injectResponseHeaders:
37− - claimSource:
38− ...: ...
31+ - name: ...
32+ ...: ...
3933```
4034
4135Please browse the [reference](#configuration-reference) below for the structure
4236of the new configuration format.
4337
44−# Migration Guide
45−
46−This section details breaking changes and migration steps for moving to the new
47−alpha configuration format.
48−
49−## Migrating header injections in v7.14.0
50−
51−From v7.14.0 onward, header injection sources must be explicitly nested. If you
52−previously relied on squashed fields, update to the new structure before
53−upgrading:
54−
55−```yaml
56−# before v7.14.0
57−injectRequestHeaders:
58−- name: X-Forwarded-User
59− values:
60− - claim: user
61−- name: X-Custom-Secret-header
62− values:
63− - value: my-super-secret
64−
65−# v7.14.0 and later
66−injectRequestHeaders:
67−- name: X-Forwarded-User
68− values:
69− - claimSource:
70− claim: user
71−- name: X-Custom-Secret-header
72− values:
73− - secretSource:
74− value: my-super-secret
75−```
76−
7738## Using Alpha Configuration
7839
7940To use the new **alpha** configuration, generate a YAML file based on the format
@@ -106,20 +67,9 @@ the new config.
10667oauth2-proxy --alpha-config ./path/to/new/config.yaml --config ./path/to/existing/config.cfg
10768```
10869
109−### Validating Alpha Configuration
110−
111−Use `--config-test` to validate your alpha configuration without starting the proxy:
112−
113−```bash
114−oauth2-proxy --config core.cfg --alpha-config alpha.yaml --config-test
115−```
116−
117−This is useful for CI/CD pipelines to catch configuration errors before deployment.
118−See the [Configuration Validation](./overview.md#configuration-validation) section for more details.
70+## Using ENV variables in the alpha configuration
11971
120−### How to use environment variables
121−
122−The alpha package supports the use of environment variables in place of yaml values, allowing sensitive data to be pulled from somewhere other than the yaml file.
72+The alpha package supports the use of environment variables in place of yaml keys, allowing sensitive values to be pulled from somewhere other than the yaml file.
12373When using environment variables, your yaml will look like this:
12474
12575```yaml
@@ -131,109 +81,6 @@ When using environment variables, your yaml will look like this:
13181Where CLIENT_SECRET is an environment variable.
13282More information and available patterns can be found [here](https://github.com/a8m/envsubst#docs)
13383
134−### How to inject custom headers
135−
136−Configure `injectRequestHeaders` and `injectResponseHeaders` in alpha config YAML.
137−
138−```yaml
139−injectRequestHeaders:
140− - name: "X-User-Email"
141− values:
142− - claimSource:
143− claim: "email" # extract the email claim contents from the id token
144− - name: "X-Static-Secret"
145− values:
146− # secrets need to be encoded with base64 when directly in the yaml config but will be send decoded
147− - secretSource:
148− value: "c3VwZXItc2VjcmV0"
149− - name: "X-Static-File-Secret"
150− - secretSource:
151− fromFile: "/path/to/my/secret"
152− - name: "X-Static-Env-Secret"
153− - secretSource:
154− value: "${MY_SECRET_ENV}" # content still needs to be base64 encoded
155−injectResponseHeaders:
156− # Following will result in a header "Authorization: Basic <user:password> (encoded)"
157− - name: "Authorization"
158− values:
159− - claimSource:
160− claim: user
161− prefix: "Basic "
162− basicAuthPassword:
163− value: c3VwZXItc2VjcmV0LXBhc3N3b3Jk # base64 encoded password
164−```
165−
166−**Value sources:**
167−* `claimSource` - `claim` (session claims either from id token or from profile URL)
168−* `secretSource` - `value` (base64), `fromFile` (file path)
169−
170−#### Claim value serialization
171−
172−`claimSource` converts the selected claim into one or more string header values. Scalars
173−produce one value, while arrays produce one value per element. Values that cannot be
174−converted directly to strings, such as objects, are JSON-encoded individually.
175−
176−Each non-empty value is added separately under the configured header name. An array of
177−objects therefore produces multiple header values containing one JSON object each, not a
178−single JSON array. HTTP libraries and intermediaries may expose repeated values as a
179−comma-joined string, so consumers should retrieve and parse each header value separately.
180−
181−**Request option:** `preserveRequestValue: true` retains existing header values
182−
183−**Incompatibility:** Remove legacy flags `pass-user-headers`, `set-xauthrequest`
184−
185−### How to utilize arbitrary claims provided by your Identity Provider
186−
187−With the additionalClaims attribute you can specify which claims you want to extract
188−from the ID Token or userinfo (ProfileURL) endpoint.
189−
190−Configure these on the relevant provider entry:
191−
192−```yaml
193−providers:
194− - id: my-oidc-provider
195− provider: oidc
196− clientID: ${OAUTH_CLIENT_ID}
197− clientSecret: ${OAUTH_CLIENT_SECRET}
198− oidcConfig:
199− issuerURL: https://issuer.example.com
200− profileURL: https://issuer.example.com/oauth2/userinfo
201− additionalClaims:
202− - department
203− - employee_id
204− - organization.name
205−```
206−
207−OAuth2 Proxy resolves each configured claim using the following order:
208−
209−1. The raw ID token is checked first.
210−2. If the claim is not present there and `profileURL` is configured, the userinfo endpoint is queried.
211−3. If `skipClaimsFromProfileURL: true` is set, only the ID token is used.
212−
213−Claims that are not found are ignored rather than causing authentication to fail.
214−
215−You can use dot-separated paths for nested JSON objects, for example `organization.name`.
216−Array indexes are not supported.
217−
218−Once loaded, these claims are stored in the session as `additionalClaims`. They can then be
219−used anywhere session claims are accepted, including header injection:
220−
221−```yaml
222−injectRequestHeaders:
223− - name: X-Department
224− values:
225− - claimSource:
226− claim: department
227− - name: X-Organization
228− values:
229− - claimSource:
230− claim: organization.name
231−```
232−
233−This is useful when your IdP exposes application-specific attributes such as department,
234−tenant, employee ID, entitlement, or other custom claims that are not part of the default
235−OAuth2 Proxy session fields.
236−
23784## Removed options
23885
23986The following flags/options and their respective environment variables are no
docs/docs/configuration/integration.mdnew file+310
@@ -0,0 +1,310 @@
1+---
2+id: integration
3+title: Integration
4+---
5+
6+## Configuring for use with the Nginx `auth_request` directive
7+
8+**This option requires `--reverse-proxy` option to be set.**
9+
10+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:
11+
12+```nginx
13+server {
14+ listen 443 ssl;
15+ server_name ...;
16+ include ssl/ssl.conf;
17+
18+ location /oauth2/ {
19+ proxy_pass http://127.0.0.1:4180;
20+ proxy_set_header Host $host;
21+ proxy_set_header X-Real-IP $remote_addr;
22+ proxy_set_header X-Auth-Request-Redirect $request_uri;
23+ # or, if you are handling multiple domains:
24+ # proxy_set_header X-Auth-Request-Redirect $scheme://$host$request_uri;
25+ }
26+ location = /oauth2/auth {
27+ proxy_pass http://127.0.0.1:4180;
28+ proxy_set_header Host $host;
29+ proxy_set_header X-Real-IP $remote_addr;
30+ proxy_set_header X-Forwarded-Uri $request_uri;
31+ # nginx auth_request includes headers but not body
32+ proxy_set_header Content-Length "";
33+ proxy_pass_request_body off;
34+ }
35+
36+ location / {
37+ auth_request /oauth2/auth;
38+ error_page 401 =403 /oauth2/sign_in;
39+
40+ # pass information via X-User and X-Email headers to backend,
41+ # requires running with --set-xauthrequest flag
42+ auth_request_set $user $upstream_http_x_auth_request_user;
43+ auth_request_set $email $upstream_http_x_auth_request_email;
44+ proxy_set_header X-User $user;
45+ proxy_set_header X-Email $email;
46+
47+ # if you enabled --pass-access-token, this will pass the token to the backend
48+ auth_request_set $token $upstream_http_x_auth_request_access_token;
49+ proxy_set_header X-Access-Token $token;
50+
51+ # if you enabled --cookie-refresh, this is needed for it to work with auth_request
52+ auth_request_set $auth_cookie $upstream_http_set_cookie;
53+ add_header Set-Cookie $auth_cookie;
54+
55+ # When using the --set-authorization-header flag, some provider's cookies can exceed the 4kb
56+ # limit and so the OAuth2 Proxy splits these into multiple parts.
57+ # Nginx normally only copies the first `Set-Cookie` header from the auth_request to the response,
58+ # so if your cookies are larger than 4kb, you will need to extract additional cookies manually.
59+ auth_request_set $auth_cookie_name_upstream_1 $upstream_cookie_auth_cookie_name_1;
60+
61+ # Extract the Cookie attributes from the first Set-Cookie header and append them
62+ # to the second part ($upstream_cookie_* variables only contain the raw cookie content)
63+ if ($auth_cookie ~* "(; .*)") {
64+ set $auth_cookie_name_0 $auth_cookie;
65+ set $auth_cookie_name_1 "auth_cookie_name_1=$auth_cookie_name_upstream_1$1";
66+ }
67+
68+ # Send both Set-Cookie headers now if there was a second part
69+ if ($auth_cookie_name_upstream_1) {
70+ add_header Set-Cookie $auth_cookie_name_0;
71+ add_header Set-Cookie $auth_cookie_name_1;
72+ }
73+
74+ proxy_pass http://backend/;
75+ # or "root /path/to/site;" or "fastcgi_pass ..." etc
76+ }
77+}
78+```
79+
80+When you use ingress-nginx in Kubernetes, you can configure the same behavior with the following annotations on your Ingress resource:
81+
82+```yaml
83+nginx.ingress.kubernetes.io/auth-url: "https://<oauth2-proxy-fqdn>/oauth2/auth"
84+nginx.ingress.kubernetes.io/auth-signin: "https://<oauth2-proxy-fqdn>/oauth2/start?rd=$escaped_request_uri"
85+```
86+
87+This minimal configuration works for standard authentication flows. Lua/cookie handling is only needed for advanced scenarios (e.g., multi-part cookies, custom session logic). See the official ingress-nginx example: https://kubernetes.github.io/ingress-nginx/examples/auth/oauth-external-auth/.
88+
89+It is recommended to use `--session-store-type=redis` when expecting large sessions/OIDC tokens (_e.g._ with MS Azure).
90+
91+You have to substitute *name* with the actual cookie name you configured via --cookie-name parameter. If you don't set a custom cookie name the variable should be "$upstream_cookie__oauth2_proxy_1" instead of "$upstream_cookie_name_1" and the new cookie-name should be "_oauth2_proxy_1=" instead of "name_1=".
92+
93+## Configuring for use with the Traefik (v2) `ForwardAuth` middleware
94+
95+**This option requires `--reverse-proxy` option to be set.**
96+
97+### ForwardAuth with 401 errors middleware
98+
99+The [Traefik v2 `ForwardAuth` middleware](https://doc.traefik.io/traefik/middlewares/http/forwardauth/) allows Traefik to authenticate requests via the oauth2-proxy's `/oauth2/auth` endpoint on every request, which only returns a 202 Accepted response or a 401 Unauthorized response without proxying the whole request through. For example, on Dynamic File (YAML) Configuration:
100+
101+```yaml
102+http:
103+ routers:
104+ a-service:
105+ rule: "Host(`a-service.example.com`)"
106+ service: a-service-backend
107+ middlewares:
108+ - oauth-errors
109+ - oauth-auth
110+ tls:
111+ certResolver: default
112+ domains:
113+ - main: "example.com"
114+ sans:
115+ - "*.example.com"
116+ oauth:
117+ rule: "Host(`a-service.example.com`, `oauth.example.com`) && PathPrefix(`/oauth2/`)"
118+ middlewares:
119+ - auth-headers
120+ service: oauth-backend
121+ tls:
122+ certResolver: default
123+ domains:
124+ - main: "example.com"
125+ sans:
126+ - "*.example.com"
127+
128+ services:
129+ a-service-backend:
130+ loadBalancer:
131+ servers:
132+ - url: http://172.16.0.2:7555
133+ oauth-backend:
134+ loadBalancer:
135+ servers:
136+ - url: http://172.16.0.1:4180
137+
138+ middlewares:
139+ auth-headers:
140+ headers:
141+ sslRedirect: true
142+ stsSeconds: 315360000
143+ browserXssFilter: true
144+ contentTypeNosniff: true
145+ forceSTSHeader: true
146+ sslHost: example.com
147+ stsIncludeSubdomains: true
148+ stsPreload: true
149+ frameDeny: true
150+ oauth-auth:
151+ forwardAuth:
152+ address: https://oauth.example.com/oauth2/auth
153+ trustForwardHeader: true
154+ oauth-errors:
155+ errors:
156+ status:
157+ - "401-403"
158+ service: oauth-backend
159+ query: "/oauth2/sign_in?rd={url}"
160+```
161+
162+### ForwardAuth with static upstreams configuration
163+
164+Redirect to sign_in functionality provided without the use of `errors` middleware with [Traefik v2 `ForwardAuth` middleware](https://doc.traefik.io/traefik/middlewares/http/forwardauth/) pointing to oauth2-proxy service's `/` endpoint
165+
166+**Following options need to be set on `oauth2-proxy`:**
167+- `--upstream=static://202`: Configures a static response for authenticated sessions
168+- `--reverse-proxy=true`: Enables the use of `X-Forwarded-*` headers to determine redirects correctly
169+
170+```yaml
171+http:
172+ routers:
173+ a-service-route-1:
174+ rule: "Host(`a-service.example.com`, `b-service.example.com`) && PathPrefix(`/`)"
175+ service: a-service-backend
176+ middlewares:
177+ - oauth-auth-redirect # redirects all unauthenticated to oauth2 signin
178+ tls:
179+ certResolver: default
180+ domains:
181+ - main: "example.com"
182+ sans:
183+ - "*.example.com"
184+ a-service-route-2:
185+ rule: "Host(`a-service.example.com`) && PathPrefix(`/no-auto-redirect`)"
186+ service: a-service-backend
187+ middlewares:
188+ - oauth-auth-wo-redirect # unauthenticated session will return a 401
189+ tls:
190+ certResolver: default
191+ domains:
192+ - main: "example.com"
193+ sans:
194+ - "*.example.com"
195+ services-oauth2-route:
196+ rule: "Host(`a-service.example.com`, `b-service.example.com`) && PathPrefix(`/oauth2/`)"
197+ middlewares:
198+ - auth-headers
199+ service: oauth-backend
200+ tls:
201+ certResolver: default
202+ domains:
203+ - main: "example.com"
204+ sans:
205+ - "*.example.com"
206+ oauth2-proxy-route:
207+ rule: "Host(`oauth.example.com`) && PathPrefix(`/`)"
208+ middlewares:
209+ - auth-headers
210+ service: oauth-backend
211+ tls:
212+ certResolver: default
213+ domains:
214+ - main: "example.com"
215+ sans:
216+ - "*.example.com"
217+
218+ services:
219+ a-service-backend:
220+ loadBalancer:
221+ servers:
222+ - url: http://172.16.0.2:7555
223+ b-service-backend:
224+ loadBalancer:
225+ servers:
226+ - url: http://172.16.0.3:7555
227+ oauth-backend:
228+ loadBalancer:
229+ servers:
230+ - url: http://172.16.0.1:4180
231+
232+ middlewares:
233+ auth-headers:
234+ headers:
235+ sslRedirect: true
236+ stsSeconds: 315360000
237+ browserXssFilter: true
238+ contentTypeNosniff: true
239+ forceSTSHeader: true
240+ sslHost: example.com
241+ stsIncludeSubdomains: true
242+ stsPreload: true
243+ frameDeny: true
244+ oauth-auth-redirect:
245+ forwardAuth:
246+ address: https://oauth.example.com/
247+ trustForwardHeader: true
248+ authResponseHeaders:
249+ - X-Auth-Request-Access-Token
250+ - Authorization
251+ oauth-auth-wo-redirect:
252+ forwardAuth:
253+ address: https://oauth.example.com/oauth2/auth
254+ trustForwardHeader: true
255+ authResponseHeaders:
256+ - X-Auth-Request-Access-Token
257+ - Authorization
258+```
259+
260+## Configuring for use with the Caddy (v2) `forward_auth` directive
261+
262+The [Caddy `forward_auth` directive](https://caddyserver.com/docs/caddyfile/directives/forward_auth) allows Caddy to authenticate requests via the `oauth2-proxy`'s `/auth`.
263+
264+This example is for a simple reverse proxy setup where the `/oauth2/` path is kept under the same domain and failed auth requests (401 status returned) will be caught and redirected to the `sign_in` endpoint.
265+
266+**Following options need to be set on `oauth2-proxy`:**
267+- `--reverse-proxy=true`: Enables the use of `X-Forwarded-*` headers to determine redirects correctly
268+
269+```nginx title="Caddyfile"
270+example.com {
271+ # Requests to /oauth2/* are proxied to oauth2-proxy without authentication.
272+ # You can't use `reverse_proxy /oauth2/* oauth2-proxy.internal:4180` here because the reverse_proxy directive has lower precedence than the handle directive.
273+ handle /oauth2/* {
274+ reverse_proxy oauth2-proxy.internal:4180 {
275+ # oauth2-proxy requires the X-Real-IP and X-Forwarded-{Proto,Host,Uri} headers.
276+ # The reverse_proxy directive automatically sets X-Forwarded-{For,Proto,Host} headers.
277+ header_up X-Real-IP {remote_host}
278+ header_up X-Forwarded-Uri {uri}
279+ }
280+ }
281+
282+ # Requests to other paths are first processed by oauth2-proxy for authentication.
283+ handle {
284+ forward_auth oauth2-proxy.internal:4180 {
285+ uri /oauth2/auth
286+
287+ # oauth2-proxy requires the X-Real-IP and X-Forwarded-{Proto,Host,Uri} headers.
288+ # The forward_auth directive automatically sets the X-Forwarded-{For,Proto,Host,Method,Uri} headers.
289+ header_up X-Real-IP {remote_host}
290+
291+ # If needed, you can copy headers from the oauth2-proxy response to the request sent to the upstream.
292+ # Make sure to configure the --set-xauthrequest flag to enable this feature.
293+ #copy_headers X-Auth-Request-User X-Auth-Request-Email
294+
295+ # If oauth2-proxy returns a 401 status, redirect the client to the sign-in page.
296+ @error status 401
297+ handle_response @error {
298+ redir * /oauth2/sign_in?rd={scheme}://{host}{uri}
299+ }
300+ }
301+
302+ # If oauth2-proxy returns a 2xx status, the request is then proxied to the upstream.
303+ reverse_proxy upstream.internal:3000
304+ }
305+}
306+```
307+
308+:::note
309+If you set up your OAuth2 provider to rotate your client secret, you can use the `client-secret-file` option to reload the secret when it is updated.
310+:::
docs/docs/configuration/integrations/caddy.mddeleted−63
@@ -1,63 +0,0 @@
1−---
2−id: caddy
3−title: Caddy
4−---
5−
6−Integrate OAuth2 Proxy with Caddy v2 using the `forward_auth` directive.
7−
8−**Key features:**
9−- Simple forward_auth setup
10−- Automatic header handling
11−- Custom error handling and redirects
12−
13−## Configuring for use with the Caddy (v2) `forward_auth` directive
14−
15−The [Caddy `forward_auth` directive](https://caddyserver.com/docs/caddyfile/directives/forward_auth) allows Caddy to authenticate requests via the `oauth2-proxy`'s `/auth`.
16−
17−This example is for a simple reverse proxy setup where the `/oauth2/` path is kept under the same domain and failed auth requests (401 status returned) will be caught and redirected to the `sign_in` endpoint.
18−
19−**Following options need to be set on `oauth2-proxy`:**
20−- `--reverse-proxy=true`: Enables the use of `X-Forwarded-*` headers to determine redirects correctly
21−
22−```nginx title="Caddyfile"
23−example.com {
24− # Requests to /oauth2/* are proxied to oauth2-proxy without authentication.
25− # You can't use `reverse_proxy /oauth2/* oauth2-proxy.internal:4180` here because the reverse_proxy directive has lower precedence than the handle directive.
26− handle /oauth2/* {
27− reverse_proxy oauth2-proxy.internal:4180 {
28− # oauth2-proxy requires the X-Real-IP and X-Forwarded-{Proto,Host,Uri} headers.
29− # The reverse_proxy directive automatically sets X-Forwarded-{For,Proto,Host} headers.
30− header_up X-Real-IP {remote_host}
31− header_up X-Forwarded-Uri {uri}
32− }
33− }
34−
35− # Requests to other paths are first processed by oauth2-proxy for authentication.
36− handle {
37− forward_auth oauth2-proxy.internal:4180 {
38− uri /oauth2/auth
39−
40− # oauth2-proxy requires the X-Real-IP and X-Forwarded-{Proto,Host,Uri} headers.
41− # The forward_auth directive automatically sets the X-Forwarded-{For,Proto,Host,Method,Uri} headers.
42− header_up X-Real-IP {remote_host}
43−
44− # If needed, you can copy headers from the oauth2-proxy response to the request sent to the upstream.
45− # Make sure to configure the --set-xauthrequest flag to enable this feature.
46− #copy_headers X-Auth-Request-User X-Auth-Request-Email
47−
48− # If oauth2-proxy returns a 401 status, redirect the client to the sign-in page.
49− @error status 401
50− handle_response @error {
51− redir * /oauth2/sign_in?rd={scheme}://{host}{uri}
52− }
53− }
54−
55− # If oauth2-proxy returns a 2xx status, the request is then proxied to the upstream.
56− reverse_proxy upstream.internal:3000
57− }
58−}
59−```
60−
61−:::note
62−If you set up your OAuth2 provider to rotate your client secret, you can use the `client-secret-file` option to reload the secret when it is updated.
63−:::
docs/docs/configuration/integrations/headlamp.mddeleted−105
@@ -1,105 +0,0 @@
1−---
2−id: headlamp
3−title: Headlamp
4−---
5−
6−Modern, actively maintained Kubernetes web UI with OAuth2 Proxy integration examples.
7−
8−**Key features:**
9−- Active development and maintenance
10−- Modern, intuitive interface
11−- Multi-cluster support
12−- Plugin system
13−- Works with all OAuth2 providers
14−
15−## Configuring for use with Headlamp
16−
17−[Headlamp](https://headlamp.dev/) is a modern, user-friendly Kubernetes web UI that can be integrated with OAuth2 Proxy for authentication. This is a recommended alternative to the deprecated Kubernetes Dashboard.
18−
19−### Architecture
20−
21−```
22−User → Ingress → OAuth2 Proxy → Authentication Provider (e.g., Azure Entra ID)
23− ↓
24− Headlamp
25−```
26−
27−### Prerequisites
28−
29−- Kubernetes cluster (e.g., AKS, EKS, GKE, or self-hosted)
30−- Headlamp installed in the cluster
31−- OAuth2 provider configured (Azure Entra ID, Google, GitHub, etc.)
32−- Ingress controller (Nginx, Traefik, etc.)
33−
34−### Configuration Overview
35−
36−When integrating Headlamp with OAuth2 Proxy, the OAuth2 Proxy acts as a reverse proxy in front of Headlamp:
37−
38−1. User requests access to Headlamp
39−2. Ingress forwards to OAuth2 Proxy
40−3. OAuth2 Proxy authenticates the user via the OAuth2 provider
41−4. After successful authentication, OAuth2 Proxy proxies requests to Headlamp
42−5. Headlamp receives the authenticated user information via headers
43−
44−### OAuth2 Proxy Configuration
45−
46−Configure OAuth2 Proxy to proxy to the Headlamp service:
47−
48−```yaml
49−upstreamConfig:
50− upstreams:
51− - id: headlamp
52− path: /
53− uri: http://headlamp-service.headlamp-namespace.svc.cluster.local:4466
54−```
55−
56−Enable the necessary headers:
57−
58−```yaml
59−extraArgs:
60− reverse-proxy: true
61− pass-authorization-header: true
62− set-xauthrequest: true
63− email-domain: "*" # Or restrict to your organization
64−```
65−
66−### Example with Azure Entra ID on AKS
67−
68−For detailed instructions on deploying Headlamp with OAuth2 Proxy on Azure Kubernetes Service using Azure Entra ID, see the official Headlamp documentation:
69−
70−https://headlamp.dev/docs/latest/installation/in-cluster/aks-cluster-oauth/
71−
72−Key steps include:
73−
74−1. **Set up AKS with OIDC**: Enable Microsoft Entra ID authentication with Kubernetes RBAC
75−2. **Create Azure App Registration**: Configure redirect URI and create client secret
76−3. **Deploy Headlamp**: Install Headlamp via Helm in your cluster
77−4. **Deploy OAuth2 Proxy**: Configure OAuth2 Proxy with Entra ID provider settings and upstream pointing to Headlamp
78−5. **Configure Ingress**: Set up Ingress to route traffic through OAuth2 Proxy to Headlamp
79−6. **Set RBAC Policies**: Apply Kubernetes RBAC bindings based on users or groups
80−
81−### Integration with Other Providers
82−
83−The same integration pattern works with other OAuth2 providers supported by OAuth2 Proxy:
84−
85−- **Google**: Use the Google provider configuration
86−- **GitHub**: Use the GitHub provider configuration
87−- **GitLab**: Use the GitLab provider configuration
88−- **Keycloak**: Use the Keycloak OIDC provider configuration
89−- **Any OIDC Provider**: Use the generic OIDC provider configuration
90−
91−For provider-specific configuration examples, see the [OAuth Provider Configuration](../providers/index.md) documentation.
92−
93−### Benefits Over Kubernetes Dashboard
94−
95−Headlamp offers several advantages:
96−
97−- **Active Development**: Headlamp is actively maintained and developed
98−- **Modern UI**: Clean, intuitive interface with better UX
99−- **Plugin System**: Extensible with custom plugins
100−- **Multi-cluster Support**: Built-in support for managing multiple clusters
101−- **Desktop App**: Available as both web UI and desktop application
102−
103−:::note
104−If you set up your OAuth2 provider to rotate your client secret, you can use the `client-secret-file` option to reload the secret when it is updated.
105−:::
docs/docs/configuration/integrations/index.mddeleted−41
@@ -1,41 +0,0 @@
1−---
2−id: index
3−title: Integrations
4−---
5−
6−This section provides configuration examples for integrating OAuth2 Proxy with various reverse proxies, ingress controllers, and Kubernetes web UIs.
7−
8−## Reverse Proxies and Ingress Controllers
9−
10−OAuth2 Proxy can be integrated with popular reverse proxies and ingress controllers to add authentication to your applications:
11−
12−- [Nginx](nginx.md)
13−- [Traefik](traefik.md)
14−- [caddy](caddy.md)
15−
16−## Kubernetes Web UIs
17−
18−OAuth2 Proxy can also be used to add authentication to Kubernetes web user interfaces:
19−
20−- [Headlamp](headlamp.md) ✨ *Recommended*
21−- [Kubernetes Dashboard](kubernetes-dashboard.md) ⚠️ *Deprecated*
22−
23−:::tip
24−When integrating with Kubernetes web UIs, make sure to:
25−1. Configure the Ingress to pass the Authorization header with the bearer token
26−2. Increase buffer sizes for large OIDC tokens (especially with Azure Entra ID)
27−3. Set up appropriate Kubernetes RBAC permissions for your users or groups
28−:::
29−
30−## General Requirements
31−
32−Most integrations require the following OAuth2 Proxy configuration:
33−
34−- `--reverse-proxy=true`: Required to correctly handle `X-Forwarded-*` headers
35−- **Session storage**: For production deployments with large tokens due to a lot of claims like AD groups, use `--session-store-type=redis`
36−
37−For provider-specific configuration, see the [OAuth Provider Configuration](../providers/index.md) documentation.
38−
39−:::note
40−If you set up your OAuth2 provider to rotate your client secret, you can use the `client-secret-file` option to reload the secret when it is updated.
41−:::
docs/docs/configuration/integrations/kubernetes-dashboard.mddeleted−289
@@ -1,289 +0,0 @@
1−---
2−id: kubernetes-dashboard
3−title: Kubernetes Dashboard
4−---
5−
6−:::warning Deprecated Project
7−Kubernetes Dashboard has been deprecated and discontinued as of January 2025. See the [official announcement](https://github.com/kubernetes/dashboard/commit/0ba796dce6916bb6ca5da5ca0b3ab22cecfd1e18) for more information.
8−
9−You may want to consider alternative solutions such as [Headlamp](./headlamp.md).
10−:::
11−
12−## Kubernetes Dashboard on AKS with Azure Entra ID
13−
14−Integration guide for the deprecated Kubernetes Dashboard, including comprehensive Azure Entra ID configuration on AKS with detailed troubleshooting and RBAC setup.
15−
16−### Architecture
17−
18−```
19−User → Nginx Ingress → OAuth2 Proxy → Entra ID
20− ↓
21− Kubernetes Dashboard
22−```
23−
24−The integration flow:
25−1. Unauthenticated requests to Dashboard are intercepted by Nginx Ingress
26−2. Nginx redirects to OAuth2 Proxy for authentication
27−3. OAuth2 Proxy redirects to Entra ID login
28−4. After successful authentication, OAuth2 Proxy receives ID token from Entra ID
29−5. OAuth2 Proxy sets Authorization header with the bearer token
30−6. Nginx forwards the request with token to Kubernetes Dashboard
31−7. Dashboard validates the token and grants access based on AKS RBAC configuration
32−
33−### Prerequisites
34−
35−- AKS cluster with Entra ID integration enabled
36−- Kubernetes Dashboard installed (version 7.x or later)
37−- NGINX Ingress Controller installed
38−- Entra ID App Registration configured with:
39− - Redirect URI: `https://your-oauth2-domain.com/oauth2/callback`
40− - API Permissions: `openid`, `email`, `profile`
41− - Groups claim enabled (if using group-based RBAC)
42−- Users or groups assigned appropriate Kubernetes RBAC permissions
43−
44−### Alpha Configuration Example
45−
46−Using [Alpha Configuration](../alpha_config.md) with the OAuth2 Proxy Helm chart:
47−
48−```yaml
49−alphaConfig:
50− enabled: true
51− configData:
52− providers:
53− - id: azure-entra
54− provider: entra-id
55− clientID: YOUR_CLIENT_ID
56− clientSecret: YOUR_CLIENT_SECRET
57− oidcConfig:
58− issuerURL: https://login.microsoftonline.com/YOUR_TENANT_ID/v2.0
59− audienceClaims:
60− - aud
61− emailClaim: email
62− groupsClaim: groups
63− userIDClaim: oid
64− scope: openid email profile
65−
66− upstreamConfig:
67− upstreams:
68− - id: static
69− path: /
70− static: true
71− staticCode: 200
72−
73− # Response headers passed to Dashboard via Nginx
74− injectResponseHeaders:
75− - name: Authorization
76− values:
77− - claim: id_token
78− prefix: "Bearer "
79− - name: X-Auth-Request-User
80− values:
81− - claim: email
82− - name: X-Auth-Request-Email
83− values:
84− - claim: email
85− - name: X-Auth-Request-Groups
86− values:
87− - claim: groups
88−
89− server:
90− BindAddress: "0.0.0.0:4180"
91−
92−extraArgs:
93− cookie-domain: ".your-domain.com"
94− whitelist-domain: ".your-domain.com"
95− email-domain: "*" # Or restrict to your organization
96− skip-provider-button: true
97− reverse-proxy: true
98− pass-authorization-header: true
99− set-xauthrequest: true
100−
101−sessionStorage:
102− type: redis
103−
104−redis:
105− enabled: true
106− auth:
107− enabled: true
108−
109−ingress:
110− enabled: true
111− className: nginx
112− hosts:
113− - OAuth2 Proxy.your-domain.com
114− path: /oauth2
115− pathType: Prefix
116−```
117−
118−### Kubernetes Dashboard Ingress
119−
120−**Critical**: The Ingress must include `Authorization` in the `auth-response-headers` annotation:
121−
122−```yaml
123−apiVersion: networking.k8s.io/v1
124−kind: Ingress
125−metadata:
126− name: kubernetes-dashboard
127− namespace: kubernetes-dashboard
128− annotations:
129− nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
130− nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
131−
132− # OAuth2 Proxy authentication
133− nginx.ingress.kubernetes.io/auth-url: "https://OAuth2 Proxy.your-domain.com/oauth2/auth"
134− nginx.ingress.kubernetes.io/auth-signin: "https://OAuth2 Proxy.your-domain.com/oauth2/start?rd=$scheme://$best_http_host$request_uri"
135−
136− # Include Authorization header with bearer token
137− nginx.ingress.kubernetes.io/auth-response-headers: "Authorization, X-Auth-Request-User, X-Auth-Request-Email"
138−
139− # Buffer sizes for large tokens (Entra tokens can exceed 4KB)
140− nginx.ingress.kubernetes.io/proxy-buffer-size: "256k"
141− nginx.ingress.kubernetes.io/proxy-buffers-number: "4"
142− nginx.ingress.kubernetes.io/proxy-busy-buffers-size: "256k"
143−spec:
144− ingressClassName: nginx
145− tls:
146− - hosts:
147− - dashboard.your-domain.com
148− secretName: dashboard-tls
149− rules:
150− - host: dashboard.your-domain.com
151− http:
152− paths:
153− - path: /
154− pathType: Prefix
155− backend:
156− service:
157− name: kubernetes-dashboard-kong-proxy
158− port:
159− number: 443
160−```
161−
162−### RBAC Configuration
163−
164−Assign Kubernetes permissions to Entra ID users or groups.
165−
166−**User-based:**
167−```yaml
168−apiVersion: rbac.authorization.k8s.io/v1
169−kind: ClusterRoleBinding
170−metadata:
171− name: dashboard-user-admin
172−roleRef:
173− apiGroup: rbac.authorization.k8s.io
174− kind: ClusterRole
175− name: cluster-admin
176−subjects:
177− - kind: User
178− name: "user@your-domain.com" # Email from Entra ID token
179− apiGroup: rbac.authorization.k8s.io
180−```
181−
182−**Group-based (recommended):**
183−```yaml
184−apiVersion: rbac.authorization.k8s.io/v1
185−kind: ClusterRoleBinding
186−metadata:
187− name: dashboard-admins-group
188−roleRef:
189− apiGroup: rbac.authorization.k8s.io
190− kind: ClusterRole
191− name: cluster-admin
192−subjects:
193− - kind: Group
194− name: "YOUR_ENTRA_GROUP_OBJECT_ID" # Entra ID Group Object ID
195− apiGroup: rbac.authorization.k8s.io
196−```
197−
198−For production, create custom roles with limited permissions instead of using `cluster-admin`.
199−
200−### Troubleshooting
201−
202−**Dashboard still asks for token after authentication**
203−
204−Verify that:
205−1. `injectResponseHeaders` in alphaConfig includes Authorization header with id_token claim
206−2. Dashboard Ingress includes `Authorization` in `auth-response-headers` annotation
207−3. Buffer sizes are sufficient for large tokens (set to 256k as shown above)
208−4. Check OAuth2 Proxy logs for successful token generation: `kubectl logs -n OAuth2 Proxy <pod-name>`
209−
210−**"Unauthorized" or "Invalid token" errors**
211−
212−Common causes:
213−1. User/group not configured in Kubernetes RBAC
214− - Check: `kubectl get clusterrolebindings | grep <user-email>`
215−2. Token validation failed
216− - Verify AKS Entra ID integration is enabled
217− - Check Dashboard logs: `kubectl logs -n kubernetes-dashboard <pod-name>`
218−3. Incorrect OAuth2 Proxy configuration
219− - Ensure `reverse-proxy: true` is set
220− - Verify issuer URL matches your tenant
221−
222−**Groups not included in token**
223−
224−To include groups in the token:
225−1. In Entra ID App Registration, go to **Token configuration**
226−2. Add **groups claim** and select security groups
227−3. Or edit the manifest and add: `"groupMembershipClaims": "SecurityGroup"`
228−4. For 200+ groups, ensure scope includes `User.Read` for group overage handling
229−5. Verify groups appear in token: check OAuth2 Proxy logs
230−
231−**Session expires too quickly**
232−
233−Configure cookie expiration:
234−```yaml
235−extraArgs:
236− cookie-expire: "24h"
237− cookie-refresh: "1h"
238−```
239−
240−### Using Workload Identity (Passwordless)
241−
242−For production environments, use Workload Identity instead of client secrets:
243−
244−```yaml
245−config:
246− clientID: "YOUR_CLIENT_ID"
247− secretKeys: # Exclude client-secret
248− - client-id
249− - cookie-secret
250− cookieSecret: "YOUR_COOKIE_SECRET"
251−
252−serviceAccount:
253− annotations:
254− azure.workload.identity/client-id: YOUR_CLIENT_ID
255− azure.workload.identity/tenant-id: YOUR_TENANT_ID
256−
257−podLabels:
258− azure.workload.identity/use: "true"
259−
260−alphaConfig:
261− enabled: true
262− configData:
263− providers:
264− - id: azure-entra
265− provider: entra-id
266− clientID: YOUR_CLIENT_ID
267− oidcConfig:
268− issuerURL: https://login.microsoftonline.com/YOUR_TENANT_ID/v2.0
269− # ... other config
270− entraIdConfig:
271− federatedTokenAuth: true
272−```
273−
274−This requires:
275−- AKS with OIDC issuer and Workload Identity enabled
276−- Federated identity credential configured in Entra ID App Registration
277−- Service account annotated with `azure.workload.identity/client-id`
278−
279−For detailed Workload Identity setup instructions, see the [Workload Identity section](../providers/ms_entra_id.md#workload-identity) in the Microsoft Entra ID provider documentation.
280−
281−## Integration with Other Providers
282−
283−While this guide focuses on Azure Entra ID, Kubernetes Dashboard can be integrated with other OAuth2 providers supported by OAuth2 Proxy. The key requirements remain the same:
284−
285−1. **Authorization Header**: Pass the bearer token via the `Authorization` header
286−2. **RBAC Configuration**: Configure Kubernetes RBAC for your authentication provider's users/groups
287−3. **Buffer Sizes**: Ensure adequate buffer sizes for tokens (especially important for OIDC providers)
288−
289−For provider-specific configuration examples, see the [OAuth Provider Configuration](../providers/index.md) documentation.
docs/docs/configuration/integrations/nginx.mddeleted−190
@@ -1,190 +0,0 @@
1−---
2−id: nginx
3−title: Nginx
4−---
5−
6−Configure OAuth2 Proxy with Nginx using the `auth_request` directive. Includes examples for both standalone Nginx configurations and Kubernetes ingress-nginx with annotations.
7−
8−**Key features:**
9−- Support for `auth_request` directive
10−- Kubernetes Ingress annotations
11−- Multi-part cookie handling for large tokens
12−- Session refresh support
13−
14−## Configuring for use with the Nginx `auth_request` directive
15−
16−**This option requires `--reverse-proxy` option to be set.**
17−
18−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:
19−
20−```nginx
21−server {
22− listen 443 ssl;
23− server_name ...;
24− include ssl/ssl.conf;
25−
26− location /oauth2/ {
27− proxy_pass http://127.0.0.1:4180;
28− proxy_set_header Host $host;
29− proxy_set_header X-Real-IP $remote_addr;
30− proxy_set_header X-Auth-Request-Redirect $request_uri;
31− # or, if you are handling multiple domains:
32− # proxy_set_header X-Auth-Request-Redirect $scheme://$host$request_uri;
33− }
34− location = /oauth2/auth {
35− proxy_pass http://127.0.0.1:4180;
36− proxy_set_header Host $host;
37− proxy_set_header X-Real-IP $remote_addr;
38− proxy_set_header X-Forwarded-Uri $request_uri;
39− # nginx auth_request includes headers but not body
40− proxy_set_header Content-Length "";
41− proxy_pass_request_body off;
42− }
43−
44− location / {
45− auth_request /oauth2/auth;
46− error_page 401 = @oauth2_signin;
47−
48− # pass information via X-User and X-Email headers to backend,
49− # requires running with --set-xauthrequest flag
50− auth_request_set $user $upstream_http_x_auth_request_user;
51− auth_request_set $email $upstream_http_x_auth_request_email;
52− proxy_set_header X-User $user;
53− proxy_set_header X-Email $email;
54−
55− # if you enabled --pass-access-token, this will pass the token to the backend
56− auth_request_set $token $upstream_http_x_auth_request_access_token;
57− proxy_set_header X-Access-Token $token;
58−
59− # if you enabled --cookie-refresh, this is needed for it to work with auth_request
60− auth_request_set $auth_cookie $upstream_http_set_cookie;
61− add_header Set-Cookie $auth_cookie;
62−
63− # Large OIDC tokens can make the session cookie exceed the 4KB limit,
64− # causing OAuth2 Proxy to split the cookie into multiple parts.
65− # Nginx normally only copies the first `Set-Cookie` header from the auth_request to the response,
66− # so extract the second part when using the default cookie name, `_oauth2_proxy`.
67− auth_request_set $auth_cookie_upstream_1 $upstream_cookie__oauth2_proxy_1;
68−
69− # Extract the Cookie attributes from the first Set-Cookie header and append them
70− # to the second part ($upstream_cookie_* variables only contain the raw cookie content)
71− if ($auth_cookie ~* "(; .*)") {
72− set $auth_cookie_0 $auth_cookie;
73− set $auth_cookie_1 "_oauth2_proxy_1=$auth_cookie_upstream_1$1";
74− }
75−
76− # Send both Set-Cookie headers now if there was a second part
77− if ($auth_cookie_upstream_1) {
78− add_header Set-Cookie $auth_cookie_0;
79− add_header Set-Cookie $auth_cookie_1;
80− }
81−
82− proxy_pass http://backend/;
83− # or "root /path/to/site;" or "fastcgi_pass ..." etc
84− }
85−
86− # Named location for handling OAuth2 sign-in redirects
87− # This ensures the browser receives a proper 302 redirect that it will follow
88− location @oauth2_signin {
89− return 302 /oauth2/sign_in?rd=$scheme://$host$request_uri;
90− }
91−}
92−```
93−
94−### Multi-part session cookies
95−
96−The example above is ready to use with the default `--cookie-name=_oauth2_proxy` setting and handles a session split into two cookies. If you configure a custom cookie name, update both references to the second cookie part:
97−
98−| Cookie configuration | Nginx upstream cookie variable | `Set-Cookie` name |
99−| --- | --- | --- |
100−| Default (`_oauth2_proxy`) | `$upstream_cookie__oauth2_proxy_1` | `_oauth2_proxy_1=` |
101−| `--cookie-name=my_cookie` | `$upstream_cookie_my_cookie_1` | `my_cookie_1=` |
102−
103−For example, with `--cookie-name=my_cookie`, change the relevant lines to:
104−
105−```nginx
106−auth_request_set $auth_cookie_upstream_1 $upstream_cookie_my_cookie_1;
107−set $auth_cookie_1 "my_cookie_1=$auth_cookie_upstream_1$1";
108−```
109−
110−If a session is split into more than two cookies, repeat the extraction for each additional numeric suffix. For consistently large sessions, prefer `--session-store-type=redis` so only a small session ticket is stored in the browser cookie.
111−
112−### Understanding the `error_page` redirect pattern
113−
114−The `auth_request` directive expects the authentication endpoint (`/oauth2/auth`) to return:
115−- **2xx**: Request is authenticated, allow access
116−- **401 or 403**: Request is not authenticated, deny access
117−
118−When a 401 is returned, nginx triggers the `error_page` directive. The recommended pattern uses a **named location** (`@oauth2_signin`) that returns a proper **302 redirect**:
119−
120−```nginx
121−error_page 401 = @oauth2_signin;
122−
123−location @oauth2_signin {
124− return 302 /oauth2/sign_in?rd=$scheme://$host$request_uri;
125−}
126−```
127−
128−:::warning Avoid `error_page 401 =403` with sign_in
129−Some older configurations use `error_page 401 =403 /oauth2/sign_in`. While this works for displaying the sign-in page, it returns a **403 status code** with a `Location` header. Browsers do not automatically follow redirects on 403 responses, which can cause issues when using `--skip-provider-button=true` (users see a "Found." link instead of being automatically redirected).
130−
131−The named location pattern above ensures the browser receives a standard **302 redirect** that works correctly with all oauth2-proxy configurations.
132−:::
133−
134−### Browser vs API Routes
135−
136−:::important When to use redirects
137−Redirecting authentication failures (302 to `/oauth2/sign_in`) should **only be used for browser-facing routes**. API or machine clients should receive a plain 401/403 response without redirect.
138−:::
139−
140−#### Browser-facing routes (HTML, UI)
141−
142−For interactive browser routes where users should be redirected to sign in:
143−
144−```nginx
145−location / {
146− auth_request /oauth2/auth;
147− error_page 401 = @oauth2_signin;
148− proxy_pass http://backend/;
149−}
150−
151−location @oauth2_signin {
152− return 302 /oauth2/sign_in?rd=$scheme://$host$request_uri;
153−}
154−```
155−
156−#### API / Machine routes (no redirect)
157−
158−For API endpoints where clients expect a 401/403 status code (not a redirect):
159−
160−```nginx
161−location /api/ {
162− auth_request /oauth2/auth;
163− error_page 401 =401; # Pass through the 401 status
164− proxy_pass http://backend/;
165−}
166−```
167−
168−This ensures:
169−- ✅ Browsers get a redirect and smooth login flow
170−- ✅ API clients fail fast with appropriate HTTP status codes
171−- ✅ `/oauth2/auth` remains a pure boolean oracle (2xx/401)
172−
173−When you use ingress-nginx in Kubernetes, you can configure the same behavior with the following annotations on your Ingress resource:
174−
175−```yaml
176−nginx.ingress.kubernetes.io/auth-url: "https://<oauth2-proxy-fqdn>/oauth2/auth"
177−nginx.ingress.kubernetes.io/auth-signin: "https://<oauth2-proxy-fqdn>/oauth2/start?rd=$escaped_request_uri"
178−```
179−
180−This minimal configuration works for standard authentication flows. Lua/cookie handling is only needed for advanced scenarios (e.g., multi-part cookies, custom session logic). See the official ingress-nginx example: https://kubernetes.github.io/ingress-nginx/examples/auth/oauth-external-auth/.
181−
182−It is recommended to use `--session-store-type=redis` when expecting large sessions/OIDC tokens (_e.g._ with MS Azure).
183−
184−:::tip Kubernetes Dashboard with Azure Entra ID
185−For a complete example of integrating oauth2-proxy with Kubernetes Dashboard on AKS using Azure Entra ID, including RBAC configuration and troubleshooting, see the [Kubernetes Dashboard on AKS](../providers/ms_entra_id.md#kubernetes-dashboard-on-aks) section in the Microsoft Entra ID provider documentation.
186−:::
187−
188−:::note
189−If you set up your OAuth2 provider to rotate your client secret, you can use the `client-secret-file` option to reload the secret when it is updated.
190−:::
docs/docs/configuration/integrations/traefik.mddeleted−192
@@ -1,192 +0,0 @@
1−---
2−id: traefik
3−title: Traefik
4−---
5−
6−Set up OAuth2 Proxy with Traefik v2 using the `ForwardAuth` middleware. Includes examples for both error-based redirects and static upstream configurations.
7−
8−**Key features:**
9−- ForwardAuth middleware integration
10−- Error middleware for 401 redirects
11−- Static upstream configuration (202 responses)
12−- Dynamic file configuration examples
13−
14−
15−## Configuring for use with the Traefik (v2) `ForwardAuth` middleware
16−
17−**This option requires `--reverse-proxy` option to be set.**
18−
19−### ForwardAuth with 401 errors middleware
20−
21−The [Traefik v2 `ForwardAuth` middleware](https://doc.traefik.io/traefik/middlewares/http/forwardauth/) allows Traefik to authenticate requests via the oauth2-proxy's `/oauth2/auth` endpoint on every request, which only returns a 202 Accepted response or a 401 Unauthorized response without proxying the whole request through. For example, on Dynamic File (YAML) Configuration:
22−
23−```yaml
24−http:
25− routers:
26− a-service:
27− rule: "Host(`a-service.example.com`)"
28− service: a-service-backend
29− middlewares:
30− - oauth-errors
31− - oauth-auth
32− tls:
33− certResolver: default
34− domains:
35− - main: "example.com"
36− sans:
37− - "*.example.com"
38− oauth:
39− rule: "Host(`a-service.example.com`, `oauth.example.com`) && PathPrefix(`/oauth2/`)"
40− middlewares:
41− - auth-headers
42− service: oauth-backend
43− tls:
44− certResolver: default
45− domains:
46− - main: "example.com"
47− sans:
48− - "*.example.com"
49−
50− services:
51− a-service-backend:
52− loadBalancer:
53− servers:
54− - url: http://172.16.0.2:7555
55− oauth-backend:
56− loadBalancer:
57− servers:
58− - url: http://172.16.0.1:4180
59−
60− middlewares:
61− auth-headers:
62− headers:
63− sslRedirect: true
64− stsSeconds: 315360000
65− browserXssFilter: true
66− contentTypeNosniff: true
67− forceSTSHeader: true
68− sslHost: example.com
69− stsIncludeSubdomains: true
70− stsPreload: true
71− frameDeny: true
72− oauth-auth:
73− forwardAuth:
74− address: https://oauth.example.com/oauth2/auth
75− trustForwardHeader: true
76− oauth-errors:
77− errors:
78− status:
79− - "401-403"
80− service: oauth-backend
81− query: "/oauth2/sign_in?rd={url}"
82− statusRewrites:
83− "401": 302
84−```
85−
86−:::caution Troubleshooting: Browser shows "Found." instead of redirecting
87−When using the Errors middleware without `statusRewrites`, the redirect response from oauth2-proxy can be served within the original 401/403 status context. This causes some browsers to display a "Found." link instead of automatically following the redirect to the identity provider.
88−
89−Adding `statusRewrites` to rewrite `401 -> 302` ensures the browser treats the response as a proper redirect and follows it automatically.
90−:::
91−
92−### ForwardAuth with static upstreams configuration
93−
94−Redirect to sign_in functionality provided without the use of `errors` middleware with [Traefik v2 `ForwardAuth` middleware](https://doc.traefik.io/traefik/middlewares/http/forwardauth/) pointing to oauth2-proxy service's `/` endpoint
95−
96−**Following options need to be set on `oauth2-proxy`:**
97−- `--upstream=static://202`: Configures a static response for authenticated sessions
98−- `--reverse-proxy=true`: Enables the use of `X-Forwarded-*` headers to determine redirects correctly
99−
100−```yaml
101−http:
102− routers:
103− a-service-route-1:
104− rule: "Host(`a-service.example.com`, `b-service.example.com`) && PathPrefix(`/`)"
105− service: a-service-backend
106− middlewares:
107− - oauth-auth-redirect # redirects all unauthenticated to oauth2 signin
108− tls:
109− certResolver: default
110− domains:
111− - main: "example.com"
112− sans:
113− - "*.example.com"
114− a-service-route-2:
115− rule: "Host(`a-service.example.com`) && PathPrefix(`/no-auto-redirect`)"
116− service: a-service-backend
117− middlewares:
118− - oauth-auth-wo-redirect # unauthenticated session will return a 401
119− tls:
120− certResolver: default
121− domains:
122− - main: "example.com"
123− sans:
124− - "*.example.com"
125− services-oauth2-route:
126− rule: "Host(`a-service.example.com`, `b-service.example.com`) && PathPrefix(`/oauth2/`)"
127− middlewares:
128− - auth-headers
129− service: oauth-backend
130− tls:
131− certResolver: default
132− domains:
133− - main: "example.com"
134− sans:
135− - "*.example.com"
136− oauth2-proxy-route:
137− rule: "Host(`oauth.example.com`) && PathPrefix(`/`)"
138− middlewares:
139− - auth-headers
140− service: oauth-backend
141− tls:
142− certResolver: default
143− domains:
144− - main: "example.com"
145− sans:
146− - "*.example.com"
147−
148− services:
149− a-service-backend:
150− loadBalancer:
151− servers:
152− - url: http://172.16.0.2:7555
153− b-service-backend:
154− loadBalancer:
155− servers:
156− - url: http://172.16.0.3:7555
157− oauth-backend:
158− loadBalancer:
159− servers:
160− - url: http://172.16.0.1:4180
161−
162− middlewares:
163− auth-headers:
164− headers:
165− sslRedirect: true
166− stsSeconds: 315360000
167− browserXssFilter: true
168− contentTypeNosniff: true
169− forceSTSHeader: true
170− sslHost: example.com
171− stsIncludeSubdomains: true
172− stsPreload: true
173− frameDeny: true
174− oauth-auth-redirect:
175− forwardAuth:
176− address: https://oauth.example.com/
177− trustForwardHeader: true
178− authResponseHeaders:
179− - X-Auth-Request-Access-Token
180− - Authorization
181− oauth-auth-wo-redirect:
182− forwardAuth:
183− address: https://oauth.example.com/oauth2/auth
184− trustForwardHeader: true
185− authResponseHeaders:
186− - X-Auth-Request-Access-Token
187− - Authorization
188−```
189−
190−:::note
191−If you set up your OAuth2 provider to rotate your client secret, you can use the `client-secret-file` option to reload the secret when it is updated.
192−:::
docs/docs/configuration/overview.md+13−58
@@ -66,11 +66,11 @@ An example [oauth2-proxy.cfg](https://github.com/oauth2-proxy/oauth2-proxy/blob/
6666
6767### Command Line Options
6868
69−| Flag | Description |
70−| ---------------- | ------------------------------------------------------- |
71−| `--config` | path to config file |
72−| `--config-test` | test configuration and exit (for CI/CD validation) |
73−| `--version` | print version string |
69+| Flag | Description |
70+| ----------- | -------------------- |
71+| `--config` | path to config file |
72+| `--version` | print version string |
73+
7474
7575### General Provider Options
7676
@@ -83,7 +83,7 @@ Provider specific options can be found on their respective subpages.
8383| flag: `--approval-prompt`<br/>toml: `approval_prompt` | string | OAuth approval_prompt | `"force"` |
8484| flag: `--backend-logout-url`<br/>toml: `backend_logout_url` | string | URL to perform backend logout, if you use `{id_token}` in the url it will be replaced by the actual `id_token` of the user session | |
8585| flag: `--client-id`<br/>toml: `client_id` | string | the OAuth Client ID, e.g. `"123456.apps.googleusercontent.com"` | |
86−| flag: `--client-secret-file`<br/>toml: `client_secret_file` | string | the file with OAuth Client Secret. The file must contain the secret only, with no trailing newline | |
86+| flag: `--client-secret-file`<br/>toml: `client_secret_file` | string | the file with OAuth Client Secret | |
8787| flag: `--client-secret`<br/>toml: `client_secret` | string | the OAuth Client Secret | |
8888| flag: `--code-challenge-method`<br/>toml: `code_challenge_method` | string | use PKCE code challenges with the specified method. Either 'plain' or 'S256' (recommended) | |
8989| flag: `--insecure-oidc-allow-unverified-email`<br/>toml: `insecure_oidc_allow_unverified_email` | bool | don't fail if an email address in an id_token is not verified | false |
@@ -99,11 +99,10 @@ Provider specific options can be found on their respective subpages.
9999| flag: `--oidc-groups-claim`<br/>toml: `oidc_groups_claim` | string | which OIDC claim contains the user groups | `"groups"` |
100100| flag: `--oidc-issuer-url`<br/>toml: `oidc_issuer_url` | string | the OpenID Connect issuer URL, e.g. `"https://accounts.google.com"` | |
101101| flag: `--oidc-jwks-url`<br/>toml: `oidc_jwks_url` | string | OIDC JWKS URI for token verification; required if OIDC discovery is disabled and public key files are not provided | |
102−| flag: `--oidc-public-key-file`<br/>toml: `oidc_public_key_files` | string | Path to public key file in PEM format to use for verifying JWT tokens (may be given multiple times). Required if OIDC discovery is disabled na JWKS URL isn't provided | |
103−| flag: `--oidc-enabled-signing-alg`<br/>toml: `oidc_enabled_signing_algs` | string \| list | List of allowed JWT signing algorithms. When oidc discovery is enabled, the effective set is the intersection between this list and the provider's discovered supported algorithms. | |
102+| flag: `--oidc-public-key-file`<br/>toml: `oidc_public_key_files` | string | Path to public key file in PEM format to use for verifying JWT tokens (may be given multiple times). Required if OIDC discovery is disabled na JWKS URL isn't provided | string \| list |
104103| flag: `--profile-url`<br/>toml: `profile_url` | string | Profile access endpoint | |
105104| flag: `--prompt`<br/>toml: `prompt` | string | [OIDC prompt](https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest); if present, `approval-prompt` is ignored | `""` |
106−| flag: `--provider-ca-file`<br/>toml: `provider_ca_files` | string \| list | Paths to CA certificates that should be used when connecting to the provider. If not specified, the default Go trust sources are used instead. | |
105+| flag: `--provider-ca-file`<br/>toml: `provider_ca_files` | string \| list | Paths to CA certificates that should be used when connecting to the provider. If not specified, the default Go trust sources are used instead. |
107106| flag: `--provider-display-name`<br/>toml: `provider_display_name` | string | Override the provider's name with the given string; used for the sign-in page | (depends on provider) |
108107| flag: `--provider`<br/>toml: `provider` | string | OAuth provider | google |
109108| flag: `--pubjwk-url`<br/>toml: `pubjwk_url` | string | JWK pubkey access endpoint: required by login.gov | |
@@ -121,7 +120,6 @@ Provider specific options can be found on their respective subpages.
121120| flag: `--cookie-csrf-expire`<br/>toml: `cookie_csrf_expire` | duration | expire timeframe for CSRF cookie | 15m |
122121| flag: `--cookie-csrf-per-request`<br/>toml:`cookie_csrf_per_request` | bool | Enable having different CSRF cookies per request, making it possible to have parallel requests. | false |
123122| flag: `--cookie-csrf-per-request-limit`<br/>toml: `cookie_csrf_per_request_limit` | int | Sets a limit on the number of CSRF requests cookies that oauth2-proxy will create. The oldest cookie will be removed. Useful if users end up with 431 Request headers too large status codes. Only effective if --cookie-csrf-per-request is true | "infinite" |
124−| flag: `--cookie-csrf-samesite`<br/>toml: `cookie_csrf_samesite` | string | set SameSite CSRF cookie attribute (`"lax"`, `"strict"`, `"none"`, or `""`). When using the default setting, the CSRF cookie samesite value is taken from the session cookie configuration. | `""` |
125123| flag: `--cookie-domain`<br/>toml: `cookie_domains` | string \| list | Optional cookie domains to force cookies to (e.g. `.yourcompany.com`). The longest domain matching the request's host will be used (or the shortest cookie domain if there is no match). | |
126124| flag: `--cookie-expire`<br/>toml: `cookie_expire` | duration | expire timeframe for cookie. If set to 0, cookie becomes a session-cookie which will expire when the browser is closed. | 168h0m0s |
127125| flag: `--cookie-httponly`<br/>toml: `cookie_httponly` | bool | set HttpOnly cookie flag | true |
@@ -130,7 +128,7 @@ Provider specific options can be found on their respective subpages.
130128| flag: `--cookie-refresh`<br/>toml: `cookie_refresh` | duration | refresh the cookie after this duration; `0` to disable; not supported by all providers&nbsp;[^1] | |
131129| flag: `--cookie-samesite`<br/>toml: `cookie_samesite` | string | set SameSite cookie attribute (`"lax"`, `"strict"`, `"none"`, or `""`). | `""` |
132130| flag: `--cookie-secret`<br/>toml: `cookie_secret` | string | the seed string for secure cookies (optionally base64 encoded) | |
133−| flag: `--cookie-secret-file`<br/>toml: `cookie_secret_file` | string | File containing the cookie secret (must be raw binary, exactly 16, 24, or 32 bytes). Use dd if=/dev/urandom bs=32 count=1 > cookie.secret to generate | |
131+| flag: `--cookie-secret-file`<br/>toml: `cookie_secret_file` | string | For defining a separate cookie secret file to read the encryption key from | |
134132| flag: `--cookie-secure`<br/>toml: `cookie_secure` | bool | set [secure (HTTPS only) cookie flag](https://owasp.org/www-community/controls/SecureFlag) | true |
135133
136134[^1]: The following providers support `--cookie-refresh`: ADFS, Azure, GitLab, Google, Keycloak and all other Identity Providers which support the full [OIDC specification](https://openid.net/specs/openid-connect-core-1_0.html#RefreshTokens)
@@ -176,7 +174,7 @@ Provider specific options can be found on their respective subpages.
176174| Flag / Config Field | Type | Description | Default |
177175| ----------------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------- | ------- |
178176| flag: `--banner`<br/>toml: `banner` | string | custom (html) banner string. Use `"-"` to disable default banner. | |
179−| flag: `--custom-sign-in-logo`<br/>toml: `custom_sign_in_logo` | string | path or a URL to an custom image for the sign_in page logo. Use `"-"` to disable default logo. | |
177+| flag: `--custom-sign-in-logo`<br/>toml: `custom_sign_in_logo` | string | path or a URL to an custom image for the sign_in page logo. Use `"-"` to disable default logo. |
180178| flag: `--custom-templates-dir`<br/>toml: `custom_templates_dir` | string | path to custom html templates | |
181179| flag: `--display-htpasswd-form`<br/>toml: `display_htpasswd_form` | bool | display username / password login form if an htpasswd file is provided | true |
182180| flag: `--footer`<br/>toml: `footer` | string | custom (html) footer string. Use `"-"` to disable default footer. (Can be used to obfuscate the version) | |
@@ -193,10 +191,6 @@ Provider specific options can be found on their respective subpages.
193191
194192### Proxy Options
195193
196−:::warning
197−When `--reverse-proxy` is enabled, configure `--trusted-proxy-ip` to the IPs or CIDR ranges of the reverse proxies that are allowed to send `X-Forwarded-*` headers. If you leave it unset, OAuth2 Proxy currently trusts all source IPs for backwards compatibility, which means a client that can reach OAuth2 Proxy directly may be able to spoof forwarded headers.
198−:::
199−
200194| Flag / Config Field | Type | Description | Default |
201195| ----------------------------------------------------------------------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
202196| flag: `--allow-query-semicolons`<br/>toml: `allow_query_semicolons` | bool | allow the use of semicolons in query args ([required for some legacy applications](https://github.com/golang/go/issues/25192)) | `false` |
@@ -215,11 +209,10 @@ When `--reverse-proxy` is enabled, configure `--trusted-proxy-ip` to the IPs or
215209| flag: `--redirect-url`<br/>toml: `redirect_url` | string | the OAuth Redirect URL, e.g. `"https://internalapp.yourcompany.com/oauth2/callback"` | |
216210| flag: `--relative-redirect-url`<br/>toml: `relative_redirect_url` | bool | allow relative OAuth Redirect URL.` | false |
217211| flag: `--reverse-proxy`<br/>toml: `reverse_proxy` | bool | are we running behind a reverse proxy, controls whether headers like X-Real-IP are accepted and allows X-Forwarded-\{Proto,Host,Uri\} headers to be used on redirect selection | false |
218−| flag: `--trusted-proxy-ip`<br/>toml: `trusted_proxy_ips` | string \| list | list of IPs or CIDR ranges allowed to supply `X-Forwarded-*` headers when `--reverse-proxy` is enabled. If not set, OAuth2 Proxy preserves backwards compatibility by trusting all source IPs (`0.0.0.0/0`, `::/0`) and logs a warning at startup. Configure this to your reverse proxy addresses to prevent forwarded header spoofing. | `"0.0.0.0/0", "::/0"` |
219212| flag: `--signature-key`<br/>toml: `signature_key` | string | GAP-Signature request signature key (algorithm:secretkey) | |
220213| flag: `--skip-auth-preflight`<br/>toml: `skip_auth_preflight` | bool | will skip authentication for OPTIONS requests | false |
221−| flag: `--skip-auth-regex`<br/>toml: `skip_auth_regex` | string \| list | (DEPRECATED for `--skip-auth-route`) bypass authentication for requests paths that match (may be given multiple times). Path matching is performed against the normalized path only; fragment identifiers (`#`) and their URL-encoded form (`%23`) are stripped before evaluation. | |
222−| flag: `--skip-auth-route`<br/>toml: `skip_auth_routes` | string \| list | bypass authentication for requests that match the method & path. Format: method=path_regex OR method!=path_regex. For all methods: path_regex OR !=path_regex. Path matching is performed against the normalized path only; fragment identifiers (`#`) and their URL-encoded form (`%23`) are stripped before evaluation. | |
214+| flag: `--skip-auth-regex`<br/>toml: `skip_auth_regex` | string \| list | (DEPRECATED for `--skip-auth-route`) bypass authentication for requests paths that match (may be given multiple times) | |
215+| flag: `--skip-auth-route`<br/>toml: `skip_auth_routes` | string \| list | bypass authentication for requests that match the method & path. Format: method=path_regex OR method!=path_regex. For all methods: path_regex OR !=path_regex | |
223216| flag: `--skip-jwt-bearer-tokens`<br/>toml: `skip_jwt_bearer_tokens` | bool | will skip requests that have verified JWT bearer tokens (the token must have [`aud`](https://en.wikipedia.org/wiki/JSON_Web_Token#Standard_fields) that matches this client id or one of the extras from `extra-jwt-issuers`) | false |
224217| flag: `--skip-provider-button`<br/>toml: `skip_provider_button` | bool | will skip sign-in-page to directly reach the next step: oauth/start | false |
225218| flag: `--ssl-insecure-skip-verify`<br/>toml: `ssl_insecure_skip_verify` | bool | skip validation of certificates presented when using HTTPS providers | false |
@@ -232,7 +225,7 @@ When `--reverse-proxy` is enabled, configure `--trusted-proxy-ip` to the IPs or
232225
233226| Flag / Config Field | Type | Description | Default |
234227| ------------------------------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
235−| flag: `--http-address`<br/>toml: `http_address` | string | `[http://]<addr>:<port>` or `unix://<path>` or `fd:<int>` (case insensitive) to listen on for HTTP clients. Unix sockets are created with default system umask mode, which can be overridden, e.g. `unix://my-socket,mode=0777`. Square brackets are required for ipv6 address, e.g. `http://[::1]:4180` | `"127.0.0.1:4180"` |
228+| flag: `--http-address`<br/>toml: `http_address` | string | `[http://]<addr>:<port>` or `unix://<path>` or `fd:<int>` (case insensitive) to listen on for HTTP clients. Square brackets are required for ipv6 address, e.g. `http://[::1]:4180` | `"127.0.0.1:4180"` |
236229| flag: `--https-address`<br/>toml: `https_address` | string | `[https://]<addr>:<port>` to listen on for HTTPS clients. Square brackets are required for ipv6 address, e.g. `https://[::1]:443` | `":443"` |
237230| flag: `--metrics-address`<br/>toml: `metrics_address` | string | the address prometheus metrics will be scraped from | `""` |
238231| flag: `--metrics-secure-address`<br/>toml: `metrics_secure_address` | string | the address prometheus metrics will be scraped from if using HTTPS | `""` |
@@ -251,7 +244,6 @@ When `--reverse-proxy` is enabled, configure `--trusted-proxy-ip` to the IPs or
251244| flag: `--session-store-type`<br/>toml: `session_store_type` | string | [Session data storage backend](sessions.md); redis or cookie | cookie |
252245| flag: `--redis-cluster-connection-urls`<br/>toml: `redis_cluster_connection_urls` | string \| list | List of Redis cluster connection URLs (e.g. `redis://HOST[:PORT]`). Used in conjunction with `--redis-use-cluster` | |
253246| flag: `--redis-connection-url`<br/>toml: `redis_connection_url` | string | URL of redis server for redis session storage (e.g. `redis://HOST[:PORT]`) | |
254−| flag: `--redis-ca-path`<br/>toml: `redis_ca_path` | string | Path to a CA certificates file that should be used when connecting to redis. If not specified, the system cert pool is used instead. | |
255247| flag: `--redis-insecure-skip-tls-verify`<br/>toml: `redis_insecure_skip_tls_verify` | bool | skip TLS verification when connecting to Redis | false |
256248| flag: `--redis-password`<br/>toml: `redis_password` | string | Redis password. Applicable for all Redis configurations. Will override any password set in `--redis-connection-url` | |
257249| flag: `--redis-sentinel-password`<br/>toml: `redis_sentinel_password` | string | Redis sentinel password. Used only for sentinel connection; any redis node passwords need to use `--redis-password` | |
@@ -273,43 +265,6 @@ When `--reverse-proxy` is enabled, configure `--trusted-proxy-ip` to the IPs or
273265| flag: `--upstream-timeout`<br/>toml: `upstream_timeout` | duration | maximum amount of time the server will wait for a response from the upstream | 30s |
274266| flag: `--upstream`<br/>toml: `upstreams` | string \| list | the http url(s) of the upstream endpoint, file:// paths for static files or `static://<status_code>` for static response. Routing is based on the path | |
275267
276−## Configuration Validation
277−
278−The `--config-test` flag validates your configuration file without starting the proxy server. This is useful for:
279−- **CI/CD pipelines**: Pre-deployment validation
280−- **Configuration management**: Testing before applying changes
281−- **Debugging**: Verifying syntax and required fields
282−
283−### Usage
284−
285−```bash
286−# Test legacy config
287−oauth2-proxy --config /etc/oauth2-proxy.cfg --config-test
288−
289−# Test alpha config
290−oauth2-proxy --config /etc/core.cfg --alpha-config /etc/alpha.yaml --config-test
291−
292−# CI/CD pre-deployment check
293−# Returns with exit code 1 if any validation errors occur
294−oauth2-proxy --config new-config.cfg --config-test
295−```
296−
297−### Exit Codes
298−
299−- **0**: Configuration is valid ✅
300−- **1**: Configuration is invalid (errors printed to stderr) ❌
301−
302−### Validation Coverage
303−
304−The `--config-test` flag performs the **same comprehensive validation** as normal startup, including:
305−- Required fields (client ID, client secret, cookie secret, etc.)
306−- Syntax validation (TOML/YAML parsing)
307−- Provider configuration
308−- Upstream server definitions
309−- Session store connectivity (e.g., Redis network checks if configured)
310−
311−**Note**: Cannot be combined with `--convert-config-to-alpha`.
312−
313268## Upstreams Configuration
314269
315270`oauth2-proxy` supports having multiple upstreams, and has the option to pass requests on to HTTP(S) servers, unix socket or serve static files from the file system.
docs/docs/configuration/providers/atlassian.mddeleted−26
@@ -1,26 +0,0 @@
1−---
2−id: atlassian
3−title: Atlassian Cloud
4−---
5−
6−1. Create an OAuth 2.0 integration in the [Atlassian developer console](https://developer.atlassian.com/console/myapps/).
7−2. Under **Permissions**, add the User identity API with the `read:me` scope.
8−3. Under **Authorization**, set the callback URL to `https://<proxy_host>/oauth2/callback`.
9−4. Copy the client ID and secret from **Settings**.
10−5. Run the proxy with:
11−
12−```shell
13− --provider=atlassian
14− --client-id=<client ID>
15− --client-secret=<secret>
16− --redirect-url=https://<proxy_host>/oauth2/callback
17− --cookie-secret=<cookie secret>
18−```
19−
20−A new app works only for the account that created it. Enable sharing under **Distribution** to let other users sign in.
21−Atlassian then admits only accounts with access to the Atlassian site the app is installed on; others are refused at
22−the consent screen.
23−
24−The proxy reads the user's email from `https://api.atlassian.com/me`. Restricting access further is supported by
25−[email](index.md#email-authentication). With `--cookie-refresh` set, the proxy re-validates the token against `/me` on
26−that interval.
docs/docs/configuration/providers/cisco_duo.mddeleted−44
@@ -1,44 +0,0 @@
1−---
2−id: cisco_duo
3−title: Cisco Duo
4−---
5−
6−Cisco Duo SSO can be configured with OAuth2 Proxy using the OIDC provider.
7−
8−1. Create a new **Generic OIDC Relying Party - Single Sign-On** application in the Duo Admin Portal
9−2. Configure OAuth2 Proxy with the following options:
10−
11−```
12−provider = "oidc"
13−provider_display_name = "Duo SSO"
14−scope = "openid email profile"
15−pass_access_token = true
16−code_challenge_method = "S256"
17−```
18−
19−3. Configure Provider endpoints. Copy the following values from the corresponding fields in the Duo Admin Portal:
20−
21−```
22−# Copy from "Client ID" field
23−client_id = "XXXXXXXX"
24−
25−# Copy from "Client Secret" field
26−client_secret = "XXXXXXXX"
27−
28−# Copy from "Issuer" field
29−oidc_issuer_url = "https://sso-xxxxxxxx.sso.duosecurity.com/oidc/xxxxxxxx"
30−
31−# Copy from "JWKS URL" field
32−oidc_jwks_url = "https://sso-xxxxxxxx.sso.duosecurity.com/oidc/xxxxxxxx/jwks"
33−
34−# Copy from "Token Introspection URL" field
35−validate_url = "https://sso-xxxxxxxx.sso.duosecurity.com/oidc/xxxxxxxx/token_introspection"
36−
37−# Copy from "UserInfo" field
38−profile_url = "https://sso-xxxxxxxx.sso.duosecurity.com/oidc/xxxxxxxx/userinfo"
39−
40−# Copy from "Token URL" field
41−redeem_url = "https://sso-xxxxxxxx.sso.duosecurity.com/oidc/xxxxxxxx/token"
42−```
43−
44−4. Complete Configuration by filling in any remaining required fields and save your configuration.
docs/docs/configuration/providers/dtt_sso.mddeleted−45
@@ -1,45 +0,0 @@
1−---
2−id: dtt_sso
3−title: DTT SSO
4−---
5−
6−Signs users in with the DTT SSO (auth-server) using the authorization code flow and its HS256 id_token.
7−
8−1. Register a client in the auth-server config, one per protected service, with the proxy's callback as its
9− only redirect URI:
10−
11− ```yaml
12− clients:
13− redash-gate:
14− secret: <random secret>
15− redirect_uri: https://redash.example.com/oauth2/callback
16− display_name: Redash
17− ```
18−
19−2. Run the proxy with:
20−
21− ```shell
22− --provider=dtt-sso
23− --client-id=redash-gate
24− --client-secret-file=/run/secrets/client_secret
25− --redirect-url=https://redash.example.com/oauth2/callback
26− --cookie-secret-file=/run/secrets/cookie_secret
27− --cookie-name=_dtt_sso_redash
28− --cookie-refresh=5m
29− ```
30−
31− Give each instance its own `--cookie-name`: another oauth2-proxy setting its cookie on a parent domain
32− (the Atlassian proxy uses `_oauth2_proxy` on `.thebestagent.pro`) would otherwise shadow this one.
33−
34−The endpoints default to `https://auth.thebestagent.pro`. For another SSO host set `--login-url`, `--redeem-url`
35−and `--validate-url` to its `/oauth/authorize`, `/oauth/token` and `/oauth/check_token`; the id_token issuer must
36−equal the login URL's origin (the SSO's `site_host`).
37−
38−The scope must stay `openid`, the only scope the SSO accepts.
39−
40−The session carries the SSO `email`, the user UUID as the user, and the SSO `role` as the only group, so
41−`--allowed-group=dtt_admin` restricts access by role. `--authenticated-emails-file` and `--email-domain` restrict
42−by email as usual.
43−
44−With `--cookie-refresh` set, the proxy refreshes the tokens on that interval and re-reads the email and role; a user
45−deleted or signed out in the SSO loses access at the next refresh.
docs/docs/configuration/providers/gitlab.md+1−1
@@ -8,7 +8,7 @@ title: GitLab
88| Flag | Toml Field | Type | Description | Default |
99| ------------------- | ----------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
1010| `--gitlab-group` | `gitlab_groups` | string \| list | restrict logins to members of any of these groups (slug), separated by a comma | |
11−| `--gitlab-project` | `gitlab_projects` | string \| list | restrict logins to members of any of these projects (may be given multiple times) formatted as `orgname/repo=accesslevel`. Access level should be a value matching [Gitlab access levels](https://docs.gitlab.com/ee/api/members.html#valid-access-levels), defaulted to 20 if absent | |
11+| `--gitlab-projects` | `gitlab_projects` | string \| list | restrict logins to members of any of these projects (may be given multiple times) formatted as `orgname/repo=accesslevel`. Access level should be a value matching [Gitlab access levels](https://docs.gitlab.com/ee/api/members.html#valid-access-levels), defaulted to 20 if absent | |
1212
1313## Usage
1414
docs/docs/configuration/providers/index.md−3
@@ -9,12 +9,9 @@ with Redirect URI(s) for the domain you intend to run `oauth2-proxy` on.
99Valid providers are :
1010
1111- [ADFS](adfs.md)
12−- [Atlassian Cloud](atlassian.md)
1312- [Bitbucket](bitbucket.md)
1413- [Cidaas](cidaas.md)
15−- [CiscoDuo](cisco_duo.md)
1614- [DigitalOcean](digitalocean.md)
17−- [DTT SSO](dtt_sso.md)
1815- [Facebook](facebook.md)
1916- [Gitea](gitea.md)
2017- [GitHub](github.md)
docs/docs/configuration/providers/ms_entra_id.md−4
@@ -195,7 +195,3 @@ scope="openid profile email User.Read"
195195entra_id_allowed_tenants=["9188040d-6c67-4c5b-b112-36a304b66dad","<my-tenant-id>"] # Allow only <my-tenant-id> and Personal MS Accounts tenant
196196email_domains="*"
197197```
198−
199−## Kubernetes Dashboard Integration
200−
201−For a complete guide on integrating oauth2-proxy with Kubernetes Dashboard on AKS using Azure Entra ID authentication, including detailed configuration examples, RBAC setup, troubleshooting, and Workload Identity setup, see the [Kubernetes Dashboard integration guide](../integrations/kubernetes-dashboard.md).
docs/docs/configuration/sessions.md+2−2
@@ -64,9 +64,9 @@ the refresh flow to get a new Access-Token. If it is longer, it might be that th
6464expired.
6565
6666The "cookie-refresh" value controls when OAuth2 Proxy tries to refresh an Access-Token. If it is set to "0", the
67−Access-Token will never be refreshed, even if it is already expired and a valid Refresh-Token is available. If set, OAuth2 Proxy will
67+Access-Token will never be refreshed, even if it is already expired and a valid Refresh-Token is available. If set, OAuth2-Proxy will
6868refresh the Access-Token after this many seconds whether it is still valid or not. According to the official OAuth2.0 specification
69−Access-Tokens are not required to follow a specific format. Therefore OAuth2 Proxy cannot check for any expiry date without an
69+Access-Tokens are not required to follow a specific format. Therefore OAuth2-Proxy cannot check for any expiry date without an
7070introspection endpoint. If an Access-Token expires and you have not set a corresponding "cookie-refresh" value, you will likely
7171encounter expiry issues.
7272
docs/docs/configuration/systemd_socket.md−8
@@ -40,12 +40,4 @@ the listener it created onto the process, starting with file descriptor 3.
4040 --client-secret=...
4141```
4242
43−## Trusted IPs
44−
45−When listening on a Unix socket, Go sets `http.Request.RemoteAddr` to `"@"` instead of the usual `"host:port"` format. This means there is no client IP available from the connection itself.
46−
47−As a result, `--trusted-ip` entries cannot match against the direct connection address for Unix socket listeners. Requests arriving over a Unix socket will never be considered "trusted" based on their `RemoteAddr`. IP-based trust decisions will still work if a trusted reverse proxy sets `X-Forwarded-For` or `X-Real-IP` headers and `--reverse-proxy=true` is configured.
48−
49−## TLS
50−
5143Currently TLS is not supported (but it's doable).
docs/docs/features/endpoints.md+1−15
@@ -15,7 +15,7 @@ OAuth2 Proxy responds directly to the following endpoints. All other endpoints w
1515- /oauth2/start - a URL that will redirect to start the OAuth cycle
1616- /oauth2/callback - the URL used at the end of the OAuth cycle. The oauth app will be configured with this as the callback url.
1717- /oauth2/userinfo - the URL is used to return user's email from the session in JSON format.
18−- /oauth2/auth - only returns a 202 Accepted response or a 401 Unauthorized response; for use with the [Nginx `auth_request` directive](../configuration/integrations/nginx)
18+- /oauth2/auth - only returns a 202 Accepted response or a 401 Unauthorized response; for use with the [Nginx `auth_request` directive](../configuration/integration#configuring-for-use-with-the-nginx-auth_request-directive)
1919- /oauth2/static/\* - stylesheets and other dependencies used in the sign_in and error pages
2020
2121### Sign out
@@ -38,20 +38,6 @@ X-Auth-Request-Redirect: https://my-oidc-provider/sign_out_page
3838
3939BEWARE that the domain you want to redirect to (`my-oidc-provider.example.com` in the example) must be added to the [`--whitelist-domain`](../configuration/overview) configuration option otherwise the redirect will be ignored. Make sure to include the actual domain and port (if needed) and not the URL (e.g "localhost:8081" instead of "http://localhost:8081").
4040
41−ID Token can be injected in the redirect url by using `{id_token}` placeholder. For example to redirect to `https://my-oidc-provider.example.com/sign_out_page?id_token_hint={id_token}&post_logout_redirect_uri=https://my-app.example.com`;
42−
43−```
44−/oauth2/sign_out?rd=https%3A%2F%2Fmy-oidc-provider.example.com%2Fsign_out_page%3Fid_token_hint%3D%7Bid_token%7D%26post_logout_redirect_uri%3Dhttps%3A%2F%2Fmy-app.example.com
45−```
46−
47−or alternatively in the header:
48−
49−```
50−GET /oauth2/sign_out HTTP/1.1
51−X-Auth-Request-Redirect: https://my-oidc-provider.example.com/sign_out_page?id_token_hint={id_token}&post_logout_redirect_uri=https://my-app.example.com
52−...
53−```
54−
5541### Auth
5642
5743This endpoint returns 202 Accepted response or a 401 Unauthorized response.
docs/docs/installation.md+1−1
@@ -5,7 +5,7 @@ title: Installation
55
661. Choose how to deploy:
77
8− a. Using a [Prebuilt Binary](https://github.com/oauth2-proxy/oauth2-proxy/releases) (current release is `v7.15.4`)
8+ a. Using a [Prebuilt Binary](https://github.com/oauth2-proxy/oauth2-proxy/releases) (current release is `v7.13.0`)
99
1010 b. Using Go to install the latest release
1111 ```bash
docs/docs/welcome.md−10
@@ -21,13 +21,3 @@ A list of changes can be seen in the [CHANGELOG](https://github.com/oauth2-proxy
2121## Architecture
2222
2323![OAuth2 Proxy Architecture](/img/simplified-architecture.svg)
24−
25−
26−## Cloud Native Computing Foundation
27−
28−OAuth2 Proxy is a [Cloud Native Computing Foundation](https://cncf.io) Sandbox project.
29−
30−![CNCF](https://www.cncf.io/wp-content/uploads/2023/04/cncf-main-site-logo.svg)
31−
32−The Linux Foundation® (TLF) has registered trademarks and uses trademarks. For a list of TLF trademarks, see [Trademark Usage](https://www.linuxfoundation.org/legal/trademark-usage).
33−
docs/docusaurus.config.js+2−2
@@ -105,7 +105,7 @@ const config = {
105105 dropdownActiveClassDisabled: true,
106106 },
107107 {
108− href: 'https://cloud-native.slack.com/archives/C098Y5URZ2N',
108+ href: 'https://gophers.slack.com/messages/CM2RSS25N',
109109 label: 'Slack',
110110 position: 'right',
111111 },
@@ -118,7 +118,7 @@ const config = {
118118 },
119119 footer: {
120120 style: 'dark',
121− copyright: `Copyright © ${new Date().getFullYear()} OAuth2 Proxy a Series of LF Projects, LLC.<br>For website terms of use, trademark policy and other project policies please see lfprojects.org/policies/`,
121+ copyright: `Copyright © ${new Date().getFullYear()} OAuth2 Proxy.`,
122122 },
123123 prism: {
124124 theme: prismThemes.github,
docs/package.json+1−4
@@ -17,7 +17,7 @@
1717 "@docusaurus/core": "^3.3.2",
1818 "@docusaurus/preset-classic": "^3.3.2",
1919 "@docusaurus/theme-mermaid": "^3.3.2",
20− "@easyops-cn/docusaurus-search-local": "^0.55.0",
20+ "@easyops-cn/docusaurus-search-local": "^0.52.0",
2121 "@mdx-js/react": "^3.0.0",
2222 "clsx": "^2.0.0",
2323 "prism-react-renderer": "^2.3.0",
@@ -42,8 +42,5 @@
4242 },
4343 "engines": {
4444 "node": ">=18.0"
45− },
46− "overrides" : {
47− "webpackbar" : "^7.0.0"
4845 }
4946}
docs/sidebars.js+1−19
@@ -22,21 +22,7 @@ const sidebars = {
2222 collapsed: false,
2323 items: [
2424 'configuration/overview',
25− {
26− type: 'category',
27− label: 'Integration Guides',
28− link: {
29− type: 'doc',
30− id: 'configuration/integrations/index',
31− },
32− items: [
33− "configuration/integrations/nginx",
34− "configuration/integrations/traefik",
35− "configuration/integrations/caddy",
36− "configuration/integrations/headlamp",
37− "configuration/integrations/kubernetes-dashboard"
38− ],
39− },
25+ 'configuration/integration',
4026 {
4127 type: 'category',
4228 label: 'OAuth Provider Configuration',
@@ -46,13 +32,9 @@ const sidebars = {
4632 },
4733 items: [
4834 "configuration/providers/adfs",
49− "configuration/providers/atlassian",
5035 "configuration/providers/azure",
5136 "configuration/providers/bitbucket",
52− "configuration/providers/cidaas",
53− "configuration/providers/cisco_duo",
5437 "configuration/providers/digitalocean",
55− "configuration/providers/dtt_sso",
5638 "configuration/providers/facebook",
5739 "configuration/providers/gitea",
5840 "configuration/providers/github",
docs/versioned_docs/version-7.0.x/behaviour.md+1−1
@@ -3,7 +3,7 @@ id: behaviour
33title: Behaviour
44---
55
6−1. Any request passing through the proxy (and not matched by `--skip-auth-route`) is checked for the proxy's session cookie (`--cookie-name`) (or, if allowed, a JWT token - see `--skip-jwt-bearer-tokens`).
6+1. Any request passing through the proxy (and not matched by `--skip-auth-regex`) is checked for the proxy's session cookie (`--cookie-name`) (or, if allowed, a JWT token - see `--skip-jwt-bearer-tokens`).
772. If authentication is required but missing then the user is asked to log in and redirected to the authentication provider (unless it is an Ajax request, i.e. one with `Accept: application/json`, in which case 401 Unauthorized is returned)
883. After returning from the authentication provider, the oauth tokens are stored in the configured session store (cookie, redis, ...) and a cookie is set
994. The request is forwarded to the upstream server with added user info and authentication headers (depending on the configuration)
docs/versioned_docs/version-7.1.x/behaviour.md+1−1
@@ -3,7 +3,7 @@ id: behaviour
33title: Behaviour
44---
55
6−1. Any request passing through the proxy (and not matched by `--skip-auth-route`) is checked for the proxy's session cookie (`--cookie-name`) (or, if allowed, a JWT token - see `--skip-jwt-bearer-tokens`).
6+1. Any request passing through the proxy (and not matched by `--skip-auth-regex`) is checked for the proxy's session cookie (`--cookie-name`) (or, if allowed, a JWT token - see `--skip-jwt-bearer-tokens`).
772. If authentication is required but missing then the user is asked to log in and redirected to the authentication provider (unless it is an Ajax request, i.e. one with `Accept: application/json`, in which case 401 Unauthorized is returned)
883. After returning from the authentication provider, the oauth tokens are stored in the configured session store (cookie, redis, ...) and a cookie is set
994. The request is forwarded to the upstream server with added user info and authentication headers (depending on the configuration)
docs/versioned_docs/version-7.10.x/behaviour.md+5−20
@@ -3,24 +3,9 @@ id: behaviour
33title: Behaviour
44---
55
6−1. Authentication Requirement: All requests passing through the proxy to upstream applications require authentication, excluding default proxy endpoints.
7− - Exception: If the request matches a skipped route (configured via `--skip-auth-route`):
8− - Authentication is not enforced, but the proxy will opportunistically attempt to validate a session cookie (`--cookie-name`) or JWT (`--skip-jwt-bearer-tokens`) if present in the request.
9− - Configured user info and authentication headers (e.g., `--pass-access-token`) are injected to upstream routes when validation succeeds.
6+1. Any request passing through the proxy (and not matched by `--skip-auth-regex`) is checked for the proxy's session cookie (`--cookie-name`) (or, if allowed, a JWT token - see `--skip-jwt-bearer-tokens`).
7+2. If authentication is required but missing then the user is asked to log in and redirected to the authentication provider (unless it is an Ajax request, i.e. one with `Accept: application/json`, in which case 401 Unauthorized is returned)
8+3. After returning from the authentication provider, the oauth tokens are stored in the configured session store (cookie, redis, ...) and a cookie is set
9+4. The request is forwarded to the upstream server with added user info and authentication headers (depending on the configuration)
1010
11−2. Unauthenticated Requests: When authentication is missing but required, the user is redirected to the configured Identity Provider (IdP) login page by default.
12− - Ajax Requests: If the request has `Accept: application/json` header:
13− - Returns `401 Unauthorized`.
14− - Invalid JWT Tokens: If `--skip-jwt-bearer-tokens` is set and the request includes an invalid JWT:
15− - Redirects to the login page by default.
16− - Returns `403 Forbidden` if `--bearer-token-login-fallback` is set to `false`.
17−
18−3. Post-Authentication: After successful authentication with the IdP, OAuth tokens are stored in the configured session store (cookie or Redis), and a cookie is set.
19−
20−4. Request Forwarding: The authenticated request is processed based on configuration:
21− - Forwarded to the configured upstream application with added user info and authentication headers, or
22− - Returns a valid status code for downstream processing by another proxy or load balancer (e.g., Nginx or Traefik).
23−
24−---
25−
26−Note: The proxy also provides a number of useful [endpoints](features/endpoints.md) for monitoring and management.
11+Notice that the proxy also provides a number of useful [endpoints](features/endpoints.md).
docs/versioned_docs/version-7.10.x/configuration/integration.md+1−77
@@ -33,15 +33,9 @@ server {
3333 proxy_pass_request_body off;
3434 }
3535
36− # Named location for handling OAuth2 sign-in redirects
37− # This ensures the browser receives a proper 302 redirect that it will follow
38− location @oauth2_signin {
39− return 302 /oauth2/sign_in?rd=$scheme://$host$request_uri;
40− }
41−
4236 location / {
4337 auth_request /oauth2/auth;
44− error_page 401 = @oauth2_signin;
38+ error_page 401 =403 /oauth2/sign_in;
4539
4640 # pass information via X-User and X-Email headers to backend,
4741 # requires running with --set-xauthrequest flag
@@ -83,68 +77,6 @@ server {
8377}
8478```
8579
86−### Understanding the `error_page` redirect pattern
87−
88−The `auth_request` directive expects the authentication endpoint (`/oauth2/auth`) to return:
89−- **2xx**: Request is authenticated, allow access
90−- **401 or 403**: Request is not authenticated, deny access
91−
92−When a 401 is returned, nginx triggers the `error_page` directive. The recommended pattern uses a **named location** (`@oauth2_signin`) that returns a proper **302 redirect**:
93−
94−
95−```nginx
96−error_page 401 = @oauth2_signin;
97−
98−location @oauth2_signin {
99− return 302 /oauth2/sign_in?rd=$scheme://$host$request_uri;
100−}
101−```
102−
103−:::warning Avoid `error_page 401 =403` with sign_in
104−Some older configurations use `error_page 401 =403 /oauth2/sign_in`. While this works for displaying the sign-in page, it returns a **403 status code** with a `Location` header. Browsers do not automatically follow redirects on 403 responses, which can cause issues when using `--skip-provider-button=true` (users see a "Found." link instead of being automatically redirected).
105−
106−The named location pattern above ensures the browser receives a standard **302 redirect** that works correctly with all oauth2-proxy configurations.
107−:::
108−
109−### Browser vs API Routes
110−
111−:::important When to use redirects
112−Redirecting authentication failures (302 to `/oauth2/sign_in`) should **only be used for browser-facing routes**. API or machine clients should receive a plain 401/403 response without redirect.
113−:::
114−
115−#### Browser-facing routes (HTML, UI)
116−
117−For interactive browser routes where users should be redirected to sign in:
118−
119−```nginx
120−location / {
121− auth_request /oauth2/auth;
122− error_page 401 = @oauth2_signin;
123− proxy_pass http://backend/;
124−}
125−
126−location @oauth2_signin {
127− return 302 /oauth2/sign_in?rd=$scheme://$host$request_uri;
128−}
129−```
130−
131−#### API / Machine routes (no redirect)
132−
133−For API endpoints where clients expect a 401/403 status code (not a redirect):
134−
135−```nginx
136−location /api/ {
137− auth_request /oauth2/auth;
138− error_page 401 =401; # Pass through the 401 status
139− proxy_pass http://backend/;
140−}
141−```
142−
143−This ensures:
144−- ✅ Browsers get a redirect and smooth login flow
145−- ✅ API clients fail fast with appropriate HTTP status codes
146−- ✅ `/oauth2/auth` remains a pure boolean oracle (2xx/401)
147−
14880When you use ingress-nginx in Kubernetes, you can configure the same behavior with the following annotations on your Ingress resource:
14981
15082```yaml
@@ -225,16 +157,8 @@ http:
225157 - "401-403"
226158 service: oauth-backend
227159 query: "/oauth2/sign_in?rd={url}"
228− statusRewrites:
229− "401": 302
230160```
231161
232−:::info Troubleshooting: Browser shows "Found." instead of redirecting
233−When using the Errors middleware without `statusRewrites`, the redirect response from oauth2-proxy can be served within the original 401/403 status context. This causes some browsers to display a "Found." link instead of automatically following the redirect to the identity provider.
234−
235−Adding `statusRewrites` to rewrite `401 -> 302` ensures the browser treats the response as a proper redirect and follows it automatically.
236−:::
237−
238162### ForwardAuth with static upstreams configuration
239163
240164Redirect to sign_in functionality provided without the use of `errors` middleware with [Traefik v2 `ForwardAuth` middleware](https://doc.traefik.io/traefik/middlewares/http/forwardauth/) pointing to oauth2-proxy service's `/` endpoint
docs/versioned_docs/version-7.10.x/configuration/overview.md−1
@@ -241,7 +241,6 @@ Provider specific options can be found on their respective subpages.
241241| flag: `--session-store-type`<br/>toml: `session_store_type` | string | [Session data storage backend](sessions.md); redis or cookie | cookie |
242242| flag: `--redis-cluster-connection-urls`<br/>toml: `redis_cluster_connection_urls` | string \| list | List of Redis cluster connection URLs (e.g. `redis://HOST[:PORT]`). Used in conjunction with `--redis-use-cluster` | |
243243| flag: `--redis-connection-url`<br/>toml: `redis_connection_url` | string | URL of redis server for redis session storage (e.g. `redis://HOST[:PORT]`) | |
244−| flag: `--redis-ca-path`<br/>toml: `redis_ca_path` | string | Path to a CA certificates file that should be used when connecting to redis. If not specified, the system cert pool is used instead. |
245244| flag: `--redis-insecure-skip-tls-verify`<br/>toml: `redis_insecure_skip_tls_verify` | bool | skip TLS verification when connecting to Redis | false |
246245| flag: `--redis-password`<br/>toml: `redis_password` | string | Redis password. Applicable for all Redis configurations. Will override any password set in `--redis-connection-url` | |
247246| flag: `--redis-sentinel-password`<br/>toml: `redis_sentinel_password` | string | Redis sentinel password. Used only for sentinel connection; any redis node passwords need to use `--redis-password` | |
docs/versioned_docs/version-7.10.x/configuration/providers/gitlab.md+1−1
@@ -8,7 +8,7 @@ title: GitLab
88| Flag | Toml Field | Type | Description | Default |
99| ------------------- | ----------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
1010| `--gitlab-group` | `gitlab_groups` | string \| list | restrict logins to members of any of these groups (slug), separated by a comma | |
11−| `--gitlab-project` | `gitlab_projects` | string \| list | restrict logins to members of any of these projects (may be given multiple times) formatted as `orgname/repo=accesslevel`. Access level should be a value matching [Gitlab access levels](https://docs.gitlab.com/ee/api/members.html#valid-access-levels), defaulted to 20 if absent | |
11+| `--gitlab-projects` | `gitlab_projects` | string \| list | restrict logins to members of any of these projects (may be given multiple times) formatted as `orgname/repo=accesslevel`. Access level should be a value matching [Gitlab access levels](https://docs.gitlab.com/ee/api/members.html#valid-access-levels), defaulted to 20 if absent | |
1212
1313## Usage
1414
docs/versioned_docs/version-7.11.x/behaviour.md+5−20
@@ -3,24 +3,9 @@ id: behaviour
33title: Behaviour
44---
55
6−1. Authentication Requirement: All requests passing through the proxy to upstream applications require authentication, excluding default proxy endpoints.
7− - Exception: If the request matches a skipped route (configured via `--skip-auth-route`):
8− - Authentication is not enforced, but the proxy will opportunistically attempt to validate a session cookie (`--cookie-name`) or JWT (`--skip-jwt-bearer-tokens`) if present in the request.
9− - Configured user info and authentication headers (e.g., `--pass-access-token`) are injected to upstream routes when validation succeeds.
6+1. Any request passing through the proxy (and not matched by `--skip-auth-regex`) is checked for the proxy's session cookie (`--cookie-name`) (or, if allowed, a JWT token - see `--skip-jwt-bearer-tokens`).
7+2. If authentication is required but missing then the user is asked to log in and redirected to the authentication provider (unless it is an Ajax request, i.e. one with `Accept: application/json`, in which case 401 Unauthorized is returned)
8+3. After returning from the authentication provider, the oauth tokens are stored in the configured session store (cookie, redis, ...) and a cookie is set
9+4. The request is forwarded to the upstream server with added user info and authentication headers (depending on the configuration)
1010
11−2. Unauthenticated Requests: When authentication is missing but required, the user is redirected to the configured Identity Provider (IdP) login page by default.
12− - Ajax Requests: If the request has `Accept: application/json` header:
13− - Returns `401 Unauthorized`.
14− - Invalid JWT Tokens: If `--skip-jwt-bearer-tokens` is set and the request includes an invalid JWT:
15− - Redirects to the login page by default.
16− - Returns `403 Forbidden` if `--bearer-token-login-fallback` is set to `false`.
17−
18−3. Post-Authentication: After successful authentication with the IdP, OAuth tokens are stored in the configured session store (cookie or Redis), and a cookie is set.
19−
20−4. Request Forwarding: The authenticated request is processed based on configuration:
21− - Forwarded to the configured upstream application with added user info and authentication headers, or
22− - Returns a valid status code for downstream processing by another proxy or load balancer (e.g., Nginx or Traefik).
23−
24−---
25−
26−Note: The proxy also provides a number of useful [endpoints](features/endpoints.md) for monitoring and management.
11+Notice that the proxy also provides a number of useful [endpoints](features/endpoints.md).
docs/versioned_docs/version-7.11.x/configuration/integration.md+1−77
@@ -33,15 +33,9 @@ server {
3333 proxy_pass_request_body off;
3434 }
3535
36− # Named location for handling OAuth2 sign-in redirects
37− # This ensures the browser receives a proper 302 redirect that it will follow
38− location @oauth2_signin {
39− return 302 /oauth2/sign_in?rd=$scheme://$host$request_uri;
40− }
41−
4236 location / {
4337 auth_request /oauth2/auth;
44− error_page 401 = @oauth2_signin;
38+ error_page 401 =403 /oauth2/sign_in;
4539
4640 # pass information via X-User and X-Email headers to backend,
4741 # requires running with --set-xauthrequest flag
@@ -83,68 +77,6 @@ server {
8377}
8478```
8579
86−### Understanding the `error_page` redirect pattern
87−
88−The `auth_request` directive expects the authentication endpoint (`/oauth2/auth`) to return:
89−- **2xx**: Request is authenticated, allow access
90−- **401 or 403**: Request is not authenticated, deny access
91−
92−When a 401 is returned, nginx triggers the `error_page` directive. The recommended pattern uses a **named location** (`@oauth2_signin`) that returns a proper **302 redirect**:
93−
94−
95−```nginx
96−error_page 401 = @oauth2_signin;
97−
98−location @oauth2_signin {
99− return 302 /oauth2/sign_in?rd=$scheme://$host$request_uri;
100−}
101−```
102−
103−:::warning Avoid `error_page 401 =403` with sign_in
104−Some older configurations use `error_page 401 =403 /oauth2/sign_in`. While this works for displaying the sign-in page, it returns a **403 status code** with a `Location` header. Browsers do not automatically follow redirects on 403 responses, which can cause issues when using `--skip-provider-button=true` (users see a "Found." link instead of being automatically redirected).
105−
106−The named location pattern above ensures the browser receives a standard **302 redirect** that works correctly with all oauth2-proxy configurations.
107−:::
108−
109−### Browser vs API Routes
110−
111−:::important When to use redirects
112−Redirecting authentication failures (302 to `/oauth2/sign_in`) should **only be used for browser-facing routes**. API or machine clients should receive a plain 401/403 response without redirect.
113−:::
114−
115−#### Browser-facing routes (HTML, UI)
116−
117−For interactive browser routes where users should be redirected to sign in:
118−
119−```nginx
120−location / {
121− auth_request /oauth2/auth;
122− error_page 401 = @oauth2_signin;
123− proxy_pass http://backend/;
124−}
125−
126−location @oauth2_signin {
127− return 302 /oauth2/sign_in?rd=$scheme://$host$request_uri;
128−}
129−```
130−
131−#### API / Machine routes (no redirect)
132−
133−For API endpoints where clients expect a 401/403 status code (not a redirect):
134−
135−```nginx
136−location /api/ {
137− auth_request /oauth2/auth;
138− error_page 401 =401; # Pass through the 401 status
139− proxy_pass http://backend/;
140−}
141−```
142−
143−This ensures:
144−- ✅ Browsers get a redirect and smooth login flow
145−- ✅ API clients fail fast with appropriate HTTP status codes
146−- ✅ `/oauth2/auth` remains a pure boolean oracle (2xx/401)
147−
14880When you use ingress-nginx in Kubernetes, you can configure the same behavior with the following annotations on your Ingress resource:
14981
15082```yaml
@@ -225,16 +157,8 @@ http:
225157 - "401-403"
226158 service: oauth-backend
227159 query: "/oauth2/sign_in?rd={url}"
228− statusRewrites:
229− "401": 302
230160```
231161
232−:::info Troubleshooting: Browser shows "Found." instead of redirecting
233−When using the Errors middleware without `statusRewrites`, the redirect response from oauth2-proxy can be served within the original 401/403 status context. This causes some browsers to display a "Found." link instead of automatically following the redirect to the identity provider.
234−
235−Adding `statusRewrites` to rewrite `401 -> 302` ensures the browser treats the response as a proper redirect and follows it automatically.
236−:::
237−
238162### ForwardAuth with static upstreams configuration
239163
240164Redirect to sign_in functionality provided without the use of `errors` middleware with [Traefik v2 `ForwardAuth` middleware](https://doc.traefik.io/traefik/middlewares/http/forwardauth/) pointing to oauth2-proxy service's `/` endpoint
docs/versioned_docs/version-7.11.x/configuration/overview.md−1
@@ -244,7 +244,6 @@ Provider specific options can be found on their respective subpages.
244244| flag: `--session-store-type`<br/>toml: `session_store_type` | string | [Session data storage backend](sessions.md); redis or cookie | cookie |
245245| flag: `--redis-cluster-connection-urls`<br/>toml: `redis_cluster_connection_urls` | string \| list | List of Redis cluster connection URLs (e.g. `redis://HOST[:PORT]`). Used in conjunction with `--redis-use-cluster` | |
246246| flag: `--redis-connection-url`<br/>toml: `redis_connection_url` | string | URL of redis server for redis session storage (e.g. `redis://HOST[:PORT]`) | |
247−| flag: `--redis-ca-path`<br/>toml: `redis_ca_path` | string | Path to a CA certificates file that should be used when connecting to redis. If not specified, the system cert pool is used instead. |
248247| flag: `--redis-insecure-skip-tls-verify`<br/>toml: `redis_insecure_skip_tls_verify` | bool | skip TLS verification when connecting to Redis | false |
249248| flag: `--redis-password`<br/>toml: `redis_password` | string | Redis password. Applicable for all Redis configurations. Will override any password set in `--redis-connection-url` | |
250249| flag: `--redis-sentinel-password`<br/>toml: `redis_sentinel_password` | string | Redis sentinel password. Used only for sentinel connection; any redis node passwords need to use `--redis-password` | |
docs/versioned_docs/version-7.11.x/configuration/providers/gitlab.md+1−1
@@ -8,7 +8,7 @@ title: GitLab
88| Flag | Toml Field | Type | Description | Default |
99| ------------------- | ----------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
1010| `--gitlab-group` | `gitlab_groups` | string \| list | restrict logins to members of any of these groups (slug), separated by a comma | |
11−| `--gitlab-project` | `gitlab_projects` | string \| list | restrict logins to members of any of these projects (may be given multiple times) formatted as `orgname/repo=accesslevel`. Access level should be a value matching [Gitlab access levels](https://docs.gitlab.com/ee/api/members.html#valid-access-levels), defaulted to 20 if absent | |
11+| `--gitlab-projects` | `gitlab_projects` | string \| list | restrict logins to members of any of these projects (may be given multiple times) formatted as `orgname/repo=accesslevel`. Access level should be a value matching [Gitlab access levels](https://docs.gitlab.com/ee/api/members.html#valid-access-levels), defaulted to 20 if absent | |
1212
1313## Usage
1414
docs/versioned_docs/version-7.12.x/behaviour.md+5−20
@@ -3,24 +3,9 @@ id: behaviour
33title: Behaviour
44---
55
6−1. Authentication Requirement: All requests passing through the proxy to upstream applications require authentication, excluding default proxy endpoints.
7− - Exception: If the request matches a skipped route (configured via `--skip-auth-route`):
8− - Authentication is not enforced, but the proxy will opportunistically attempt to validate a session cookie (`--cookie-name`) or JWT (`--skip-jwt-bearer-tokens`) if present in the request.
9− - Configured user info and authentication headers (e.g., `--pass-access-token`) are injected to upstream routes when validation succeeds.
6+1. Any request passing through the proxy (and not matched by `--skip-auth-regex`) is checked for the proxy's session cookie (`--cookie-name`) (or, if allowed, a JWT token - see `--skip-jwt-bearer-tokens`).
7+2. If authentication is required but missing then the user is asked to log in and redirected to the authentication provider (unless it is an Ajax request, i.e. one with `Accept: application/json`, in which case 401 Unauthorized is returned)
8+3. After returning from the authentication provider, the oauth tokens are stored in the configured session store (cookie, redis, ...) and a cookie is set
9+4. The request is forwarded to the upstream server with added user info and authentication headers (depending on the configuration)
1010
11−2. Unauthenticated Requests: When authentication is missing but required, the user is redirected to the configured Identity Provider (IdP) login page by default.
12− - Ajax Requests: If the request has `Accept: application/json` header:
13− - Returns `401 Unauthorized`.
14− - Invalid JWT Tokens: If `--skip-jwt-bearer-tokens` is set and the request includes an invalid JWT:
15− - Redirects to the login page by default.
16− - Returns `403 Forbidden` if `--bearer-token-login-fallback` is set to `false`.
17−
18−3. Post-Authentication: After successful authentication with the IdP, OAuth tokens are stored in the configured session store (cookie or Redis), and a cookie is set.
19−
20−4. Request Forwarding: The authenticated request is processed based on configuration:
21− - Forwarded to the configured upstream application with added user info and authentication headers, or
22− - Returns a valid status code for downstream processing by another proxy or load balancer (e.g., Nginx or Traefik).
23−
24−---
25−
26−Note: The proxy also provides a number of useful [endpoints](features/endpoints.md) for monitoring and management.
11+Notice that the proxy also provides a number of useful [endpoints](features/endpoints.md).
docs/versioned_docs/version-7.12.x/configuration/integration.md+1−77
@@ -33,15 +33,9 @@ server {
3333 proxy_pass_request_body off;
3434 }
3535
36− # Named location for handling OAuth2 sign-in redirects
37− # This ensures the browser receives a proper 302 redirect that it will follow
38− location @oauth2_signin {
39− return 302 /oauth2/sign_in?rd=$scheme://$host$request_uri;
40− }
41−
4236 location / {
4337 auth_request /oauth2/auth;
44− error_page 401 = @oauth2_signin;
38+ error_page 401 =403 /oauth2/sign_in;
4539
4640 # pass information via X-User and X-Email headers to backend,
4741 # requires running with --set-xauthrequest flag
@@ -83,68 +77,6 @@ server {
8377}
8478```
8579
86−### Understanding the `error_page` redirect pattern
87−
88−The `auth_request` directive expects the authentication endpoint (`/oauth2/auth`) to return:
89−- **2xx**: Request is authenticated, allow access
90−- **401 or 403**: Request is not authenticated, deny access
91−
92−When a 401 is returned, nginx triggers the `error_page` directive. The recommended pattern uses a **named location** (`@oauth2_signin`) that returns a proper **302 redirect**:
93−
94−
95−```nginx
96−error_page 401 = @oauth2_signin;
97−
98−location @oauth2_signin {
99− return 302 /oauth2/sign_in?rd=$scheme://$host$request_uri;
100−}
101−```
102−
103−:::warning Avoid `error_page 401 =403` with sign_in
104−Some older configurations use `error_page 401 =403 /oauth2/sign_in`. While this works for displaying the sign-in page, it returns a **403 status code** with a `Location` header. Browsers do not automatically follow redirects on 403 responses, which can cause issues when using `--skip-provider-button=true` (users see a "Found." link instead of being automatically redirected).
105−
106−The named location pattern above ensures the browser receives a standard **302 redirect** that works correctly with all oauth2-proxy configurations.
107−:::
108−
109−### Browser vs API Routes
110−
111−:::important When to use redirects
112−Redirecting authentication failures (302 to `/oauth2/sign_in`) should **only be used for browser-facing routes**. API or machine clients should receive a plain 401/403 response without redirect.
113−:::
114−
115−#### Browser-facing routes (HTML, UI)
116−
117−For interactive browser routes where users should be redirected to sign in:
118−
119−```nginx
120−location / {
121− auth_request /oauth2/auth;
122− error_page 401 = @oauth2_signin;
123− proxy_pass http://backend/;
124−}
125−
126−location @oauth2_signin {
127− return 302 /oauth2/sign_in?rd=$scheme://$host$request_uri;
128−}
129−```
130−
131−#### API / Machine routes (no redirect)
132−
133−For API endpoints where clients expect a 401/403 status code (not a redirect):
134−
135−```nginx
136−location /api/ {
137− auth_request /oauth2/auth;
138− error_page 401 =401; # Pass through the 401 status
139− proxy_pass http://backend/;
140−}
141−```
142−
143−This ensures:
144−- ✅ Browsers get a redirect and smooth login flow
145−- ✅ API clients fail fast with appropriate HTTP status codes
146−- ✅ `/oauth2/auth` remains a pure boolean oracle (2xx/401)
147−
14880When you use ingress-nginx in Kubernetes, you can configure the same behavior with the following annotations on your Ingress resource:
14981
15082```yaml
@@ -225,16 +157,8 @@ http:
225157 - "401-403"
226158 service: oauth-backend
227159 query: "/oauth2/sign_in?rd={url}"
228− statusRewrites:
229− "401": 302
230160```
231161
232−:::info Troubleshooting: Browser shows "Found." instead of redirecting
233−When using the Errors middleware without `statusRewrites`, the redirect response from oauth2-proxy can be served within the original 401/403 status context. This causes some browsers to display a "Found." link instead of automatically following the redirect to the identity provider.
234−
235−Adding `statusRewrites` to rewrite `401 -> 302` ensures the browser treats the response as a proper redirect and follows it automatically.
236−:::
237−
238162### ForwardAuth with static upstreams configuration
239163
240164Redirect to sign_in functionality provided without the use of `errors` middleware with [Traefik v2 `ForwardAuth` middleware](https://doc.traefik.io/traefik/middlewares/http/forwardauth/) pointing to oauth2-proxy service's `/` endpoint
docs/versioned_docs/version-7.12.x/configuration/overview.md+2−3
@@ -83,7 +83,7 @@ Provider specific options can be found on their respective subpages.
8383| flag: `--approval-prompt`<br/>toml: `approval_prompt` | string | OAuth approval_prompt | `"force"` |
8484| flag: `--backend-logout-url`<br/>toml: `backend_logout_url` | string | URL to perform backend logout, if you use `{id_token}` in the url it will be replaced by the actual `id_token` of the user session | |
8585| flag: `--client-id`<br/>toml: `client_id` | string | the OAuth Client ID, e.g. `"123456.apps.googleusercontent.com"` | |
86−| flag: `--client-secret-file`<br/>toml: `client_secret_file` | string | the file with OAuth Client Secret. The file must contain the secret only, with no trailing newline | |
86+| flag: `--client-secret-file`<br/>toml: `client_secret_file` | string | the file with OAuth Client Secret | |
8787| flag: `--client-secret`<br/>toml: `client_secret` | string | the OAuth Client Secret | |
8888| flag: `--code-challenge-method`<br/>toml: `code_challenge_method` | string | use PKCE code challenges with the specified method. Either 'plain' or 'S256' (recommended) | |
8989| flag: `--insecure-oidc-allow-unverified-email`<br/>toml: `insecure_oidc_allow_unverified_email` | bool | don't fail if an email address in an id_token is not verified | false |
@@ -128,7 +128,7 @@ Provider specific options can be found on their respective subpages.
128128| flag: `--cookie-refresh`<br/>toml: `cookie_refresh` | duration | refresh the cookie after this duration; `0` to disable; not supported by all providers&nbsp;[^1] | |
129129| flag: `--cookie-samesite`<br/>toml: `cookie_samesite` | string | set SameSite cookie attribute (`"lax"`, `"strict"`, `"none"`, or `""`). | `""` |
130130| flag: `--cookie-secret`<br/>toml: `cookie_secret` | string | the seed string for secure cookies (optionally base64 encoded) | |
131−| flag: `--cookie-secret-file`<br/>toml: `cookie_secret_file` | string | File containing the cookie secret (must be raw binary, exactly 16, 24, or 32 bytes). Use dd if=/dev/urandom bs=32 count=1 > cookie.secret to generate | |
131+| flag: `--cookie-secret-file`<br/>toml: `cookie_secret_file` | string | For defining a separate cookie secret file to read the encryption key from | |
132132| flag: `--cookie-secure`<br/>toml: `cookie_secure` | bool | set [secure (HTTPS only) cookie flag](https://owasp.org/www-community/controls/SecureFlag) | true |
133133
134134[^1]: The following providers support `--cookie-refresh`: ADFS, Azure, GitLab, Google, Keycloak and all other Identity Providers which support the full [OIDC specification](https://openid.net/specs/openid-connect-core-1_0.html#RefreshTokens)
@@ -244,7 +244,6 @@ Provider specific options can be found on their respective subpages.
244244| flag: `--session-store-type`<br/>toml: `session_store_type` | string | [Session data storage backend](sessions.md); redis or cookie | cookie |
245245| flag: `--redis-cluster-connection-urls`<br/>toml: `redis_cluster_connection_urls` | string \| list | List of Redis cluster connection URLs (e.g. `redis://HOST[:PORT]`). Used in conjunction with `--redis-use-cluster` | |
246246| flag: `--redis-connection-url`<br/>toml: `redis_connection_url` | string | URL of redis server for redis session storage (e.g. `redis://HOST[:PORT]`) | |
247−| flag: `--redis-ca-path`<br/>toml: `redis_ca_path` | string | Path to a CA certificates file that should be used when connecting to redis. If not specified, the system cert pool is used instead. |
248247| flag: `--redis-insecure-skip-tls-verify`<br/>toml: `redis_insecure_skip_tls_verify` | bool | skip TLS verification when connecting to Redis | false |
249248| flag: `--redis-password`<br/>toml: `redis_password` | string | Redis password. Applicable for all Redis configurations. Will override any password set in `--redis-connection-url` | |
250249| flag: `--redis-sentinel-password`<br/>toml: `redis_sentinel_password` | string | Redis sentinel password. Used only for sentinel connection; any redis node passwords need to use `--redis-password` | |
docs/versioned_docs/version-7.12.x/configuration/providers/gitlab.md+1−1
@@ -8,7 +8,7 @@ title: GitLab
88| Flag | Toml Field | Type | Description | Default |
99| ------------------- | ----------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
1010| `--gitlab-group` | `gitlab_groups` | string \| list | restrict logins to members of any of these groups (slug), separated by a comma | |
11−| `--gitlab-project` | `gitlab_projects` | string \| list | restrict logins to members of any of these projects (may be given multiple times) formatted as `orgname/repo=accesslevel`. Access level should be a value matching [Gitlab access levels](https://docs.gitlab.com/ee/api/members.html#valid-access-levels), defaulted to 20 if absent | |
11+| `--gitlab-projects` | `gitlab_projects` | string \| list | restrict logins to members of any of these projects (may be given multiple times) formatted as `orgname/repo=accesslevel`. Access level should be a value matching [Gitlab access levels](https://docs.gitlab.com/ee/api/members.html#valid-access-levels), defaulted to 20 if absent | |
1212
1313## Usage
1414
docs/versioned_docs/version-7.13.x/behaviour.md+5−20
@@ -3,24 +3,9 @@ id: behaviour
33title: Behaviour
44---
55
6−1. Authentication Requirement: All requests passing through the proxy to upstream applications require authentication, excluding default proxy endpoints.
7− - Exception: If the request matches a skipped route (configured via `--skip-auth-route`):
8− - Authentication is not enforced, but the proxy will opportunistically attempt to validate a session cookie (`--cookie-name`) or JWT (`--skip-jwt-bearer-tokens`) if present in the request.
9− - Configured user info and authentication headers (e.g., `--pass-access-token`) are injected to upstream routes when validation succeeds.
6+1. Any request passing through the proxy (and not matched by `--skip-auth-regex`) is checked for the proxy's session cookie (`--cookie-name`) (or, if allowed, a JWT token - see `--skip-jwt-bearer-tokens`).
7+2. If authentication is required but missing then the user is asked to log in and redirected to the authentication provider (unless it is an Ajax request, i.e. one with `Accept: application/json`, in which case 401 Unauthorized is returned)
8+3. After returning from the authentication provider, the oauth tokens are stored in the configured session store (cookie, redis, ...) and a cookie is set
9+4. The request is forwarded to the upstream server with added user info and authentication headers (depending on the configuration)
1010
11−2. Unauthenticated Requests: When authentication is missing but required, the user is redirected to the configured Identity Provider (IdP) login page by default.
12− - Ajax Requests: If the request has `Accept: application/json` header:
13− - Returns `401 Unauthorized`.
14− - Invalid JWT Tokens: If `--skip-jwt-bearer-tokens` is set and the request includes an invalid JWT:
15− - Redirects to the login page by default.
16− - Returns `403 Forbidden` if `--bearer-token-login-fallback` is set to `false`.
17−
18−3. Post-Authentication: After successful authentication with the IdP, OAuth tokens are stored in the configured session store (cookie or Redis), and a cookie is set.
19−
20−4. Request Forwarding: The authenticated request is processed based on configuration:
21− - Forwarded to the configured upstream application with added user info and authentication headers, or
22− - Returns a valid status code for downstream processing by another proxy or load balancer (e.g., Nginx or Traefik).
23−
24−---
25−
26−Note: The proxy also provides a number of useful [endpoints](features/endpoints.md) for monitoring and management.
11+Notice that the proxy also provides a number of useful [endpoints](features/endpoints.md).
docs/versioned_docs/version-7.13.x/configuration/integration.mdnew file+310
@@ -0,0 +1,310 @@
1+---
2+id: integration
3+title: Integration
4+---
5+
6+## Configuring for use with the Nginx `auth_request` directive
7+
8+**This option requires `--reverse-proxy` option to be set.**
9+
10+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:
11+
12+```nginx
13+server {
14+ listen 443 ssl;
15+ server_name ...;
16+ include ssl/ssl.conf;
17+
18+ location /oauth2/ {
19+ proxy_pass http://127.0.0.1:4180;
20+ proxy_set_header Host $host;
21+ proxy_set_header X-Real-IP $remote_addr;
22+ proxy_set_header X-Auth-Request-Redirect $request_uri;
23+ # or, if you are handling multiple domains:
24+ # proxy_set_header X-Auth-Request-Redirect $scheme://$host$request_uri;
25+ }
26+ location = /oauth2/auth {
27+ proxy_pass http://127.0.0.1:4180;
28+ proxy_set_header Host $host;
29+ proxy_set_header X-Real-IP $remote_addr;
30+ proxy_set_header X-Forwarded-Uri $request_uri;
31+ # nginx auth_request includes headers but not body
32+ proxy_set_header Content-Length "";
33+ proxy_pass_request_body off;
34+ }
35+
36+ location / {
37+ auth_request /oauth2/auth;
38+ error_page 401 =403 /oauth2/sign_in;
39+
40+ # pass information via X-User and X-Email headers to backend,
41+ # requires running with --set-xauthrequest flag
42+ auth_request_set $user $upstream_http_x_auth_request_user;
43+ auth_request_set $email $upstream_http_x_auth_request_email;
44+ proxy_set_header X-User $user;
45+ proxy_set_header X-Email $email;
46+
47+ # if you enabled --pass-access-token, this will pass the token to the backend
48+ auth_request_set $token $upstream_http_x_auth_request_access_token;
49+ proxy_set_header X-Access-Token $token;
50+
51+ # if you enabled --cookie-refresh, this is needed for it to work with auth_request
52+ auth_request_set $auth_cookie $upstream_http_set_cookie;
53+ add_header Set-Cookie $auth_cookie;
54+
55+ # When using the --set-authorization-header flag, some provider's cookies can exceed the 4kb
56+ # limit and so the OAuth2 Proxy splits these into multiple parts.
57+ # Nginx normally only copies the first `Set-Cookie` header from the auth_request to the response,
58+ # so if your cookies are larger than 4kb, you will need to extract additional cookies manually.
59+ auth_request_set $auth_cookie_name_upstream_1 $upstream_cookie_auth_cookie_name_1;
60+
61+ # Extract the Cookie attributes from the first Set-Cookie header and append them
62+ # to the second part ($upstream_cookie_* variables only contain the raw cookie content)
63+ if ($auth_cookie ~* "(; .*)") {
64+ set $auth_cookie_name_0 $auth_cookie;
65+ set $auth_cookie_name_1 "auth_cookie_name_1=$auth_cookie_name_upstream_1$1";
66+ }
67+
68+ # Send both Set-Cookie headers now if there was a second part
69+ if ($auth_cookie_name_upstream_1) {
70+ add_header Set-Cookie $auth_cookie_name_0;
71+ add_header Set-Cookie $auth_cookie_name_1;
72+ }
73+
74+ proxy_pass http://backend/;
75+ # or "root /path/to/site;" or "fastcgi_pass ..." etc
76+ }
77+}
78+```
79+
80+When you use ingress-nginx in Kubernetes, you can configure the same behavior with the following annotations on your Ingress resource:
81+
82+```yaml
83+nginx.ingress.kubernetes.io/auth-url: "https://<oauth2-proxy-fqdn>/oauth2/auth"
84+nginx.ingress.kubernetes.io/auth-signin: "https://<oauth2-proxy-fqdn>/oauth2/start?rd=$escaped_request_uri"
85+```
86+
87+This minimal configuration works for standard authentication flows. Lua/cookie handling is only needed for advanced scenarios (e.g., multi-part cookies, custom session logic). See the official ingress-nginx example: https://kubernetes.github.io/ingress-nginx/examples/auth/oauth-external-auth/.
88+
89+It is recommended to use `--session-store-type=redis` when expecting large sessions/OIDC tokens (_e.g._ with MS Azure).
90+
91+You have to substitute *name* with the actual cookie name you configured via --cookie-name parameter. If you don't set a custom cookie name the variable should be "$upstream_cookie__oauth2_proxy_1" instead of "$upstream_cookie_name_1" and the new cookie-name should be "_oauth2_proxy_1=" instead of "name_1=".
92+
93+## Configuring for use with the Traefik (v2) `ForwardAuth` middleware
94+
95+**This option requires `--reverse-proxy` option to be set.**
96+
97+### ForwardAuth with 401 errors middleware
98+
99+The [Traefik v2 `ForwardAuth` middleware](https://doc.traefik.io/traefik/middlewares/http/forwardauth/) allows Traefik to authenticate requests via the oauth2-proxy's `/oauth2/auth` endpoint on every request, which only returns a 202 Accepted response or a 401 Unauthorized response without proxying the whole request through. For example, on Dynamic File (YAML) Configuration:
100+
101+```yaml
102+http:
103+ routers:
104+ a-service:
105+ rule: "Host(`a-service.example.com`)"
106+ service: a-service-backend
107+ middlewares:
108+ - oauth-errors
109+ - oauth-auth
110+ tls:
111+ certResolver: default
112+ domains:
113+ - main: "example.com"
114+ sans:
115+ - "*.example.com"
116+ oauth:
117+ rule: "Host(`a-service.example.com`, `oauth.example.com`) && PathPrefix(`/oauth2/`)"
118+ middlewares:
119+ - auth-headers
120+ service: oauth-backend
121+ tls:
122+ certResolver: default
123+ domains:
124+ - main: "example.com"
125+ sans:
126+ - "*.example.com"
127+
128+ services:
129+ a-service-backend:
130+ loadBalancer:
131+ servers:
132+ - url: http://172.16.0.2:7555
133+ oauth-backend:
134+ loadBalancer:
135+ servers:
136+ - url: http://172.16.0.1:4180
137+
138+ middlewares:
139+ auth-headers:
140+ headers:
141+ sslRedirect: true
142+ stsSeconds: 315360000
143+ browserXssFilter: true
144+ contentTypeNosniff: true
145+ forceSTSHeader: true
146+ sslHost: example.com
147+ stsIncludeSubdomains: true
148+ stsPreload: true
149+ frameDeny: true
150+ oauth-auth:
151+ forwardAuth:
152+ address: https://oauth.example.com/oauth2/auth
153+ trustForwardHeader: true
154+ oauth-errors:
155+ errors:
156+ status:
157+ - "401-403"
158+ service: oauth-backend
159+ query: "/oauth2/sign_in?rd={url}"
160+```
161+
162+### ForwardAuth with static upstreams configuration
163+
164+Redirect to sign_in functionality provided without the use of `errors` middleware with [Traefik v2 `ForwardAuth` middleware](https://doc.traefik.io/traefik/middlewares/http/forwardauth/) pointing to oauth2-proxy service's `/` endpoint
165+
166+**Following options need to be set on `oauth2-proxy`:**
167+- `--upstream=static://202`: Configures a static response for authenticated sessions
168+- `--reverse-proxy=true`: Enables the use of `X-Forwarded-*` headers to determine redirects correctly
169+
170+```yaml
171+http:
172+ routers:
173+ a-service-route-1:
174+ rule: "Host(`a-service.example.com`, `b-service.example.com`) && PathPrefix(`/`)"
175+ service: a-service-backend
176+ middlewares:
177+ - oauth-auth-redirect # redirects all unauthenticated to oauth2 signin
178+ tls:
179+ certResolver: default
180+ domains:
181+ - main: "example.com"
182+ sans:
183+ - "*.example.com"
184+ a-service-route-2:
185+ rule: "Host(`a-service.example.com`) && PathPrefix(`/no-auto-redirect`)"
186+ service: a-service-backend
187+ middlewares:
188+ - oauth-auth-wo-redirect # unauthenticated session will return a 401
189+ tls:
190+ certResolver: default
191+ domains:
192+ - main: "example.com"
193+ sans:
194+ - "*.example.com"
195+ services-oauth2-route:
196+ rule: "Host(`a-service.example.com`, `b-service.example.com`) && PathPrefix(`/oauth2/`)"
197+ middlewares:
198+ - auth-headers
199+ service: oauth-backend
200+ tls:
201+ certResolver: default
202+ domains:
203+ - main: "example.com"
204+ sans:
205+ - "*.example.com"
206+ oauth2-proxy-route:
207+ rule: "Host(`oauth.example.com`) && PathPrefix(`/`)"
208+ middlewares:
209+ - auth-headers
210+ service: oauth-backend
211+ tls:
212+ certResolver: default
213+ domains:
214+ - main: "example.com"
215+ sans:
216+ - "*.example.com"
217+
218+ services:
219+ a-service-backend:
220+ loadBalancer:
221+ servers:
222+ - url: http://172.16.0.2:7555
223+ b-service-backend:
224+ loadBalancer:
225+ servers:
226+ - url: http://172.16.0.3:7555
227+ oauth-backend:
228+ loadBalancer:
229+ servers:
230+ - url: http://172.16.0.1:4180
231+
232+ middlewares:
233+ auth-headers:
234+ headers:
235+ sslRedirect: true
236+ stsSeconds: 315360000
237+ browserXssFilter: true
238+ contentTypeNosniff: true
239+ forceSTSHeader: true
240+ sslHost: example.com
241+ stsIncludeSubdomains: true
242+ stsPreload: true
243+ frameDeny: true
244+ oauth-auth-redirect:
245+ forwardAuth:
246+ address: https://oauth.example.com/
247+ trustForwardHeader: true
248+ authResponseHeaders:
249+ - X-Auth-Request-Access-Token
250+ - Authorization
251+ oauth-auth-wo-redirect:
252+ forwardAuth:
253+ address: https://oauth.example.com/oauth2/auth
254+ trustForwardHeader: true
255+ authResponseHeaders:
256+ - X-Auth-Request-Access-Token
257+ - Authorization
258+```
259+
260+## Configuring for use with the Caddy (v2) `forward_auth` directive
261+
262+The [Caddy `forward_auth` directive](https://caddyserver.com/docs/caddyfile/directives/forward_auth) allows Caddy to authenticate requests via the `oauth2-proxy`'s `/auth`.
263+
264+This example is for a simple reverse proxy setup where the `/oauth2/` path is kept under the same domain and failed auth requests (401 status returned) will be caught and redirected to the `sign_in` endpoint.
265+
266+**Following options need to be set on `oauth2-proxy`:**
267+- `--reverse-proxy=true`: Enables the use of `X-Forwarded-*` headers to determine redirects correctly
268+
269+```nginx title="Caddyfile"
270+example.com {
271+ # Requests to /oauth2/* are proxied to oauth2-proxy without authentication.
272+ # You can't use `reverse_proxy /oauth2/* oauth2-proxy.internal:4180` here because the reverse_proxy directive has lower precedence than the handle directive.
273+ handle /oauth2/* {
274+ reverse_proxy oauth2-proxy.internal:4180 {
275+ # oauth2-proxy requires the X-Real-IP and X-Forwarded-{Proto,Host,Uri} headers.
276+ # The reverse_proxy directive automatically sets X-Forwarded-{For,Proto,Host} headers.
277+ header_up X-Real-IP {remote_host}
278+ header_up X-Forwarded-Uri {uri}
279+ }
280+ }
281+
282+ # Requests to other paths are first processed by oauth2-proxy for authentication.
283+ handle {
284+ forward_auth oauth2-proxy.internal:4180 {
285+ uri /oauth2/auth
286+
287+ # oauth2-proxy requires the X-Real-IP and X-Forwarded-{Proto,Host,Uri} headers.
288+ # The forward_auth directive automatically sets the X-Forwarded-{For,Proto,Host,Method,Uri} headers.
289+ header_up X-Real-IP {remote_host}
290+
291+ # If needed, you can copy headers from the oauth2-proxy response to the request sent to the upstream.
292+ # Make sure to configure the --set-xauthrequest flag to enable this feature.
293+ #copy_headers X-Auth-Request-User X-Auth-Request-Email
294+
295+ # If oauth2-proxy returns a 401 status, redirect the client to the sign-in page.
296+ @error status 401
297+ handle_response @error {
298+ redir * /oauth2/sign_in?rd={scheme}://{host}{uri}
299+ }
300+ }
301+
302+ # If oauth2-proxy returns a 2xx status, the request is then proxied to the upstream.
303+ reverse_proxy upstream.internal:3000
304+ }
305+}
306+```
307+
308+:::note
309+If you set up your OAuth2 provider to rotate your client secret, you can use the `client-secret-file` option to reload the secret when it is updated.
310+:::
docs/versioned_docs/version-7.13.x/configuration/integrations/caddy.mddeleted−63
@@ -1,63 +0,0 @@
1−---
2−id: caddy
3−title: Caddy
4−---
5−
6−Integrate OAuth2 Proxy with Caddy v2 using the `forward_auth` directive.
7−
8−**Key features:**
9−- Simple forward_auth setup
10−- Automatic header handling
11−- Custom error handling and redirects
12−
13−## Configuring for use with the Caddy (v2) `forward_auth` directive
14−
15−The [Caddy `forward_auth` directive](https://caddyserver.com/docs/caddyfile/directives/forward_auth) allows Caddy to authenticate requests via the `oauth2-proxy`'s `/auth`.
16−
17−This example is for a simple reverse proxy setup where the `/oauth2/` path is kept under the same domain and failed auth requests (401 status returned) will be caught and redirected to the `sign_in` endpoint.
18−
19−**Following options need to be set on `oauth2-proxy`:**
20−- `--reverse-proxy=true`: Enables the use of `X-Forwarded-*` headers to determine redirects correctly
21−
22−```nginx title="Caddyfile"
23−example.com {
24− # Requests to /oauth2/* are proxied to oauth2-proxy without authentication.
25− # You can't use `reverse_proxy /oauth2/* oauth2-proxy.internal:4180` here because the reverse_proxy directive has lower precedence than the handle directive.
26− handle /oauth2/* {
27− reverse_proxy oauth2-proxy.internal:4180 {
28− # oauth2-proxy requires the X-Real-IP and X-Forwarded-{Proto,Host,Uri} headers.
29− # The reverse_proxy directive automatically sets X-Forwarded-{For,Proto,Host} headers.
30− header_up X-Real-IP {remote_host}
31− header_up X-Forwarded-Uri {uri}
32− }
33− }
34−
35− # Requests to other paths are first processed by oauth2-proxy for authentication.
36− handle {
37− forward_auth oauth2-proxy.internal:4180 {
38− uri /oauth2/auth
39−
40− # oauth2-proxy requires the X-Real-IP and X-Forwarded-{Proto,Host,Uri} headers.
41− # The forward_auth directive automatically sets the X-Forwarded-{For,Proto,Host,Method,Uri} headers.
42− header_up X-Real-IP {remote_host}
43−
44− # If needed, you can copy headers from the oauth2-proxy response to the request sent to the upstream.
45− # Make sure to configure the --set-xauthrequest flag to enable this feature.
46− #copy_headers X-Auth-Request-User X-Auth-Request-Email
47−
48− # If oauth2-proxy returns a 401 status, redirect the client to the sign-in page.
49− @error status 401
50− handle_response @error {
51− redir * /oauth2/sign_in?rd={scheme}://{host}{uri}
52− }
53− }
54−
55− # If oauth2-proxy returns a 2xx status, the request is then proxied to the upstream.
56− reverse_proxy upstream.internal:3000
57− }
58−}
59−```
60−
61−:::note
62−If you set up your OAuth2 provider to rotate your client secret, you can use the `client-secret-file` option to reload the secret when it is updated.
63−:::
docs/versioned_docs/version-7.13.x/configuration/integrations/headlamp.mddeleted−105
@@ -1,105 +0,0 @@
1−---
2−id: headlamp
3−title: Headlamp
4−---
5−
6−Modern, actively maintained Kubernetes web UI with OAuth2 Proxy integration examples.
7−
8−**Key features:**
9−- Active development and maintenance
10−- Modern, intuitive interface
11−- Multi-cluster support
12−- Plugin system
13−- Works with all OAuth2 providers
14−
15−## Configuring for use with Headlamp
16−
17−[Headlamp](https://headlamp.dev/) is a modern, user-friendly Kubernetes web UI that can be integrated with OAuth2 Proxy for authentication. This is a recommended alternative to the deprecated Kubernetes Dashboard.
18−
19−### Architecture
20−
21−```
22−User → Ingress → OAuth2 Proxy → Authentication Provider (e.g., Azure Entra ID)
23− ↓
24− Headlamp
25−```
26−
27−### Prerequisites
28−
29−- Kubernetes cluster (e.g., AKS, EKS, GKE, or self-hosted)
30−- Headlamp installed in the cluster
31−- OAuth2 provider configured (Azure Entra ID, Google, GitHub, etc.)
32−- Ingress controller (Nginx, Traefik, etc.)
33−
34−### Configuration Overview
35−
36−When integrating Headlamp with OAuth2 Proxy, the OAuth2 Proxy acts as a reverse proxy in front of Headlamp:
37−
38−1. User requests access to Headlamp
39−2. Ingress forwards to OAuth2 Proxy
40−3. OAuth2 Proxy authenticates the user via the OAuth2 provider
41−4. After successful authentication, OAuth2 Proxy proxies requests to Headlamp
42−5. Headlamp receives the authenticated user information via headers
43−
44−### OAuth2 Proxy Configuration
45−
46−Configure OAuth2 Proxy to proxy to the Headlamp service:
47−
48−```yaml
49−upstreamConfig:
50− upstreams:
51− - id: headlamp
52− path: /
53− uri: http://headlamp-service.headlamp-namespace.svc.cluster.local:4466
54−```
55−
56−Enable the necessary headers:
57−
58−```yaml
59−extraArgs:
60− reverse-proxy: true
61− pass-authorization-header: true
62− set-xauthrequest: true
63− email-domain: "*" # Or restrict to your organization
64−```
65−
66−### Example with Azure Entra ID on AKS
67−
68−For detailed instructions on deploying Headlamp with OAuth2 Proxy on Azure Kubernetes Service using Azure Entra ID, see the official Headlamp documentation:
69−
70−https://headlamp.dev/docs/latest/installation/in-cluster/aks-cluster-oauth/
71−
72−Key steps include:
73−
74−1. **Set up AKS with OIDC**: Enable Microsoft Entra ID authentication with Kubernetes RBAC
75−2. **Create Azure App Registration**: Configure redirect URI and create client secret
76−3. **Deploy Headlamp**: Install Headlamp via Helm in your cluster
77−4. **Deploy OAuth2 Proxy**: Configure OAuth2 Proxy with Entra ID provider settings and upstream pointing to Headlamp
78−5. **Configure Ingress**: Set up Ingress to route traffic through OAuth2 Proxy to Headlamp
79−6. **Set RBAC Policies**: Apply Kubernetes RBAC bindings based on users or groups
80−
81−### Integration with Other Providers
82−
83−The same integration pattern works with other OAuth2 providers supported by OAuth2 Proxy:
84−
85−- **Google**: Use the Google provider configuration
86−- **GitHub**: Use the GitHub provider configuration
87−- **GitLab**: Use the GitLab provider configuration
88−- **Keycloak**: Use the Keycloak OIDC provider configuration
89−- **Any OIDC Provider**: Use the generic OIDC provider configuration
90−
91−For provider-specific configuration examples, see the [OAuth Provider Configuration](../providers/index.md) documentation.
92−
93−### Benefits Over Kubernetes Dashboard
94−
95−Headlamp offers several advantages:
96−
97−- **Active Development**: Headlamp is actively maintained and developed
98−- **Modern UI**: Clean, intuitive interface with better UX
99−- **Plugin System**: Extensible with custom plugins
100−- **Multi-cluster Support**: Built-in support for managing multiple clusters
101−- **Desktop App**: Available as both web UI and desktop application
102−
103−:::note
104−If you set up your OAuth2 provider to rotate your client secret, you can use the `client-secret-file` option to reload the secret when it is updated.
105−:::
docs/versioned_docs/version-7.13.x/configuration/integrations/index.mddeleted−41
@@ -1,41 +0,0 @@
1−---
2−id: index
3−title: Integrations
4−---
5−
6−This section provides configuration examples for integrating OAuth2 Proxy with various reverse proxies, ingress controllers, and Kubernetes web UIs.
7−
8−## Reverse Proxies and Ingress Controllers
9−
10−OAuth2 Proxy can be integrated with popular reverse proxies and ingress controllers to add authentication to your applications:
11−
12−- [Nginx](nginx.md)
13−- [Traefik](traefik.md)
14−- [caddy](caddy.md)
15−
16−## Kubernetes Web UIs
17−
18−OAuth2 Proxy can also be used to add authentication to Kubernetes web user interfaces:
19−
20−- [Headlamp](headlamp.md) ✨ *Recommended*
21−- [Kubernetes Dashboard](kubernetes-dashboard.md) ⚠️ *Deprecated*
22−
23−:::tip
24−When integrating with Kubernetes web UIs, make sure to:
25−1. Configure the Ingress to pass the Authorization header with the bearer token
26−2. Increase buffer sizes for large OIDC tokens (especially with Azure Entra ID)
27−3. Set up appropriate Kubernetes RBAC permissions for your users or groups
28−:::
29−
30−## General Requirements
31−
32−Most integrations require the following OAuth2 Proxy configuration:
33−
34−- `--reverse-proxy=true`: Required to correctly handle `X-Forwarded-*` headers
35−- **Session storage**: For production deployments with large tokens due to a lot of claims like AD groups, use `--session-store-type=redis`
36−
37−For provider-specific configuration, see the [OAuth Provider Configuration](../providers/index.md) documentation.
38−
39−:::note
40−If you set up your OAuth2 provider to rotate your client secret, you can use the `client-secret-file` option to reload the secret when it is updated.
41−:::
docs/versioned_docs/version-7.13.x/configuration/integrations/kubernetes-dashboard.mddeleted−289
@@ -1,289 +0,0 @@
1−---
2−id: kubernetes-dashboard
3−title: Kubernetes Dashboard
4−---
5−
6−:::warning Deprecated Project
7−Kubernetes Dashboard has been deprecated and discontinued as of January 2025. See the [official announcement](https://github.com/kubernetes/dashboard/commit/0ba796dce6916bb6ca5da5ca0b3ab22cecfd1e18) for more information.
8−
9−You may want to consider alternative solutions such as [Headlamp](./headlamp.md).
10−:::
11−
12−## Kubernetes Dashboard on AKS with Azure Entra ID
13−
14−Integration guide for the deprecated Kubernetes Dashboard, including comprehensive Azure Entra ID configuration on AKS with detailed troubleshooting and RBAC setup.
15−
16−### Architecture
17−
18−```
19−User → Nginx Ingress → OAuth2 Proxy → Entra ID
20− ↓
21− Kubernetes Dashboard
22−```
23−
24−The integration flow:
25−1. Unauthenticated requests to Dashboard are intercepted by Nginx Ingress
26−2. Nginx redirects to OAuth2 Proxy for authentication
27−3. OAuth2 Proxy redirects to Entra ID login
28−4. After successful authentication, OAuth2 Proxy receives ID token from Entra ID
29−5. OAuth2 Proxy sets Authorization header with the bearer token
30−6. Nginx forwards the request with token to Kubernetes Dashboard
31−7. Dashboard validates the token and grants access based on AKS RBAC configuration
32−
33−### Prerequisites
34−
35−- AKS cluster with Entra ID integration enabled
36−- Kubernetes Dashboard installed (version 7.x or later)
37−- NGINX Ingress Controller installed
38−- Entra ID App Registration configured with:
39− - Redirect URI: `https://your-oauth2-domain.com/oauth2/callback`
40− - API Permissions: `openid`, `email`, `profile`
41− - Groups claim enabled (if using group-based RBAC)
42−- Users or groups assigned appropriate Kubernetes RBAC permissions
43−
44−### Alpha Configuration Example
45−
46−Using [Alpha Configuration](../alpha_config.md) with the OAuth2 Proxy Helm chart:
47−
48−```yaml
49−alphaConfig:
50− enabled: true
51− configData:
52− providers:
53− - id: azure-entra
54− provider: entra-id
55− clientID: YOUR_CLIENT_ID
56− clientSecret: YOUR_CLIENT_SECRET
57− oidcConfig:
58− issuerURL: https://login.microsoftonline.com/YOUR_TENANT_ID/v2.0
59− audienceClaims:
60− - aud
61− emailClaim: email
62− groupsClaim: groups
63− userIDClaim: oid
64− scope: openid email profile
65−
66− upstreamConfig:
67− upstreams:
68− - id: static
69− path: /
70− static: true
71− staticCode: 200
72−
73− # Response headers passed to Dashboard via Nginx
74− injectResponseHeaders:
75− - name: Authorization
76− values:
77− - claim: id_token
78− prefix: "Bearer "
79− - name: X-Auth-Request-User
80− values:
81− - claim: email
82− - name: X-Auth-Request-Email
83− values:
84− - claim: email
85− - name: X-Auth-Request-Groups
86− values:
87− - claim: groups
88−
89− server:
90− BindAddress: "0.0.0.0:4180"
91−
92−extraArgs:
93− cookie-domain: ".your-domain.com"
94− whitelist-domain: ".your-domain.com"
95− email-domain: "*" # Or restrict to your organization
96− skip-provider-button: true
97− reverse-proxy: true
98− pass-authorization-header: true
99− set-xauthrequest: true
100−
101−sessionStorage:
102− type: redis
103−
104−redis:
105− enabled: true
106− auth:
107− enabled: true
108−
109−ingress:
110− enabled: true
111− className: nginx
112− hosts:
113− - OAuth2 Proxy.your-domain.com
114− path: /oauth2
115− pathType: Prefix
116−```
117−
118−### Kubernetes Dashboard Ingress
119−
120−**Critical**: The Ingress must include `Authorization` in the `auth-response-headers` annotation:
121−
122−```yaml
123−apiVersion: networking.k8s.io/v1
124−kind: Ingress
125−metadata:
126− name: kubernetes-dashboard
127− namespace: kubernetes-dashboard
128− annotations:
129− nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
130− nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
131−
132− # OAuth2 Proxy authentication
133− nginx.ingress.kubernetes.io/auth-url: "https://OAuth2 Proxy.your-domain.com/oauth2/auth"
134− nginx.ingress.kubernetes.io/auth-signin: "https://OAuth2 Proxy.your-domain.com/oauth2/start?rd=$scheme://$best_http_host$request_uri"
135−
136− # Include Authorization header with bearer token
137− nginx.ingress.kubernetes.io/auth-response-headers: "Authorization, X-Auth-Request-User, X-Auth-Request-Email"
138−
139− # Buffer sizes for large tokens (Entra tokens can exceed 4KB)
140− nginx.ingress.kubernetes.io/proxy-buffer-size: "256k"
141− nginx.ingress.kubernetes.io/proxy-buffers-number: "4"
142− nginx.ingress.kubernetes.io/proxy-busy-buffers-size: "256k"
143−spec:
144− ingressClassName: nginx
145− tls:
146− - hosts:
147− - dashboard.your-domain.com
148− secretName: dashboard-tls
149− rules:
150− - host: dashboard.your-domain.com
151− http:
152− paths:
153− - path: /
154− pathType: Prefix
155− backend:
156− service:
157− name: kubernetes-dashboard-kong-proxy
158− port:
159− number: 443
160−```
161−
162−### RBAC Configuration
163−
164−Assign Kubernetes permissions to Entra ID users or groups.
165−
166−**User-based:**
167−```yaml
168−apiVersion: rbac.authorization.k8s.io/v1
169−kind: ClusterRoleBinding
170−metadata:
171− name: dashboard-user-admin
172−roleRef:
173− apiGroup: rbac.authorization.k8s.io
174− kind: ClusterRole
175− name: cluster-admin
176−subjects:
177− - kind: User
178− name: "user@your-domain.com" # Email from Entra ID token
179− apiGroup: rbac.authorization.k8s.io
180−```
181−
182−**Group-based (recommended):**
183−```yaml
184−apiVersion: rbac.authorization.k8s.io/v1
185−kind: ClusterRoleBinding
186−metadata:
187− name: dashboard-admins-group
188−roleRef:
189− apiGroup: rbac.authorization.k8s.io
190− kind: ClusterRole
191− name: cluster-admin
192−subjects:
193− - kind: Group
194− name: "YOUR_ENTRA_GROUP_OBJECT_ID" # Entra ID Group Object ID
195− apiGroup: rbac.authorization.k8s.io
196−```
197−
198−For production, create custom roles with limited permissions instead of using `cluster-admin`.
199−
200−### Troubleshooting
201−
202−**Dashboard still asks for token after authentication**
203−
204−Verify that:
205−1. `injectResponseHeaders` in alphaConfig includes Authorization header with id_token claim
206−2. Dashboard Ingress includes `Authorization` in `auth-response-headers` annotation
207−3. Buffer sizes are sufficient for large tokens (set to 256k as shown above)
208−4. Check OAuth2 Proxy logs for successful token generation: `kubectl logs -n OAuth2 Proxy <pod-name>`
209−
210−**"Unauthorized" or "Invalid token" errors**
211−
212−Common causes:
213−1. User/group not configured in Kubernetes RBAC
214− - Check: `kubectl get clusterrolebindings | grep <user-email>`
215−2. Token validation failed
216− - Verify AKS Entra ID integration is enabled
217− - Check Dashboard logs: `kubectl logs -n kubernetes-dashboard <pod-name>`
218−3. Incorrect OAuth2 Proxy configuration
219− - Ensure `reverse-proxy: true` is set
220− - Verify issuer URL matches your tenant
221−
222−**Groups not included in token**
223−
224−To include groups in the token:
225−1. In Entra ID App Registration, go to **Token configuration**
226−2. Add **groups claim** and select security groups
227−3. Or edit the manifest and add: `"groupMembershipClaims": "SecurityGroup"`
228−4. For 200+ groups, ensure scope includes `User.Read` for group overage handling
229−5. Verify groups appear in token: check OAuth2 Proxy logs
230−
231−**Session expires too quickly**
232−
233−Configure cookie expiration:
234−```yaml
235−extraArgs:
236− cookie-expire: "24h"
237− cookie-refresh: "1h"
238−```
239−
240−### Using Workload Identity (Passwordless)
241−
242−For production environments, use Workload Identity instead of client secrets:
243−
244−```yaml
245−config:
246− clientID: "YOUR_CLIENT_ID"
247− secretKeys: # Exclude client-secret
248− - client-id
249− - cookie-secret
250− cookieSecret: "YOUR_COOKIE_SECRET"
251−
252−serviceAccount:
253− annotations:
254− azure.workload.identity/client-id: YOUR_CLIENT_ID
255− azure.workload.identity/tenant-id: YOUR_TENANT_ID
256−
257−podLabels:
258− azure.workload.identity/use: "true"
259−
260−alphaConfig:
261− enabled: true
262− configData:
263− providers:
264− - id: azure-entra
265− provider: entra-id
266− clientID: YOUR_CLIENT_ID
267− oidcConfig:
268− issuerURL: https://login.microsoftonline.com/YOUR_TENANT_ID/v2.0
269− # ... other config
270− entraIdConfig:
271− federatedTokenAuth: true
272−```
273−
274−This requires:
275−- AKS with OIDC issuer and Workload Identity enabled
276−- Federated identity credential configured in Entra ID App Registration
277−- Service account annotated with `azure.workload.identity/client-id`
278−
279−For detailed Workload Identity setup instructions, see the [Workload Identity section](../providers/ms_entra_id.md#workload-identity) in the Microsoft Entra ID provider documentation.
280−
281−## Integration with Other Providers
282−
283−While this guide focuses on Azure Entra ID, Kubernetes Dashboard can be integrated with other OAuth2 providers supported by OAuth2 Proxy. The key requirements remain the same:
284−
285−1. **Authorization Header**: Pass the bearer token via the `Authorization` header
286−2. **RBAC Configuration**: Configure Kubernetes RBAC for your authentication provider's users/groups
287−3. **Buffer Sizes**: Ensure adequate buffer sizes for tokens (especially important for OIDC providers)
288−
289−For provider-specific configuration examples, see the [OAuth Provider Configuration](../providers/index.md) documentation.
docs/versioned_docs/version-7.13.x/configuration/integrations/nginx.mddeleted−174
@@ -1,174 +0,0 @@
1−---
2−id: nginx
3−title: Nginx
4−---
5−
6−Configure OAuth2 Proxy with Nginx using the `auth_request` directive. Includes examples for both standalone Nginx configurations and Kubernetes ingress-nginx with annotations.
7−
8−**Key features:**
9−- Support for `auth_request` directive
10−- Kubernetes Ingress annotations
11−- Multi-part cookie handling for large tokens
12−- Session refresh support
13−
14−## Configuring for use with the Nginx `auth_request` directive
15−
16−**This option requires `--reverse-proxy` option to be set.**
17−
18−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:
19−
20−```nginx
21−server {
22− listen 443 ssl;
23− server_name ...;
24− include ssl/ssl.conf;
25−
26− location /oauth2/ {
27− proxy_pass http://127.0.0.1:4180;
28− proxy_set_header Host $host;
29− proxy_set_header X-Real-IP $remote_addr;
30− proxy_set_header X-Auth-Request-Redirect $request_uri;
31− # or, if you are handling multiple domains:
32− # proxy_set_header X-Auth-Request-Redirect $scheme://$host$request_uri;
33− }
34− location = /oauth2/auth {
35− proxy_pass http://127.0.0.1:4180;
36− proxy_set_header Host $host;
37− proxy_set_header X-Real-IP $remote_addr;
38− proxy_set_header X-Forwarded-Uri $request_uri;
39− # nginx auth_request includes headers but not body
40− proxy_set_header Content-Length "";
41− proxy_pass_request_body off;
42− }
43−
44− location / {
45− auth_request /oauth2/auth;
46− error_page 401 = @oauth2_signin;
47−
48− # pass information via X-User and X-Email headers to backend,
49− # requires running with --set-xauthrequest flag
50− auth_request_set $user $upstream_http_x_auth_request_user;
51− auth_request_set $email $upstream_http_x_auth_request_email;
52− proxy_set_header X-User $user;
53− proxy_set_header X-Email $email;
54−
55− # if you enabled --pass-access-token, this will pass the token to the backend
56− auth_request_set $token $upstream_http_x_auth_request_access_token;
57− proxy_set_header X-Access-Token $token;
58−
59− # if you enabled --cookie-refresh, this is needed for it to work with auth_request
60− auth_request_set $auth_cookie $upstream_http_set_cookie;
61− add_header Set-Cookie $auth_cookie;
62−
63− # When using the --set-authorization-header flag, some provider's cookies can exceed the 4kb
64− # limit and so the OAuth2 Proxy splits these into multiple parts.
65− # Nginx normally only copies the first `Set-Cookie` header from the auth_request to the response,
66− # so if your cookies are larger than 4kb, you will need to extract additional cookies manually.
67− auth_request_set $auth_cookie_name_upstream_1 $upstream_cookie_auth_cookie_name_1;
68−
69− # Extract the Cookie attributes from the first Set-Cookie header and append them
70− # to the second part ($upstream_cookie_* variables only contain the raw cookie content)
71− if ($auth_cookie ~* "(; .*)") {
72− set $auth_cookie_name_0 $auth_cookie;
73− set $auth_cookie_name_1 "auth_cookie_name_1=$auth_cookie_name_upstream_1$1";
74− }
75−
76− # Send both Set-Cookie headers now if there was a second part
77− if ($auth_cookie_name_upstream_1) {
78− add_header Set-Cookie $auth_cookie_name_0;
79− add_header Set-Cookie $auth_cookie_name_1;
80− }
81−
82− proxy_pass http://backend/;
83− # or "root /path/to/site;" or "fastcgi_pass ..." etc
84− }
85−
86− # Named location for handling OAuth2 sign-in redirects
87− # This ensures the browser receives a proper 302 redirect that it will follow
88− location @oauth2_signin {
89− return 302 /oauth2/sign_in?rd=$scheme://$host$request_uri;
90− }
91−}
92−```
93−
94−### Understanding the `error_page` redirect pattern
95−
96−The `auth_request` directive expects the authentication endpoint (`/oauth2/auth`) to return:
97−- **2xx**: Request is authenticated, allow access
98−- **401 or 403**: Request is not authenticated, deny access
99−
100−When a 401 is returned, nginx triggers the `error_page` directive. The recommended pattern uses a **named location** (`@oauth2_signin`) that returns a proper **302 redirect**:
101−
102−```nginx
103−error_page 401 = @oauth2_signin;
104−
105−location @oauth2_signin {
106− return 302 /oauth2/sign_in?rd=$scheme://$host$request_uri;
107−}
108−```
109−
110−:::warning Avoid `error_page 401 =403` with sign_in
111−Some older configurations use `error_page 401 =403 /oauth2/sign_in`. While this works for displaying the sign-in page, it returns a **403 status code** with a `Location` header. Browsers do not automatically follow redirects on 403 responses, which can cause issues when using `--skip-provider-button=true` (users see a "Found." link instead of being automatically redirected).
112−
113−The named location pattern above ensures the browser receives a standard **302 redirect** that works correctly with all oauth2-proxy configurations.
114−:::
115−
116−### Browser vs API Routes
117−
118−:::important When to use redirects
119−Redirecting authentication failures (302 to `/oauth2/sign_in`) should **only be used for browser-facing routes**. API or machine clients should receive a plain 401/403 response without redirect.
120−:::
121−
122−#### Browser-facing routes (HTML, UI)
123−
124−For interactive browser routes where users should be redirected to sign in:
125−
126−```nginx
127−location / {
128− auth_request /oauth2/auth;
129− error_page 401 = @oauth2_signin;
130− proxy_pass http://backend/;
131−}
132−
133−location @oauth2_signin {
134− return 302 /oauth2/sign_in?rd=$scheme://$host$request_uri;
135−}
136−```
137−
138−#### API / Machine routes (no redirect)
139−
140−For API endpoints where clients expect a 401/403 status code (not a redirect):
141−
142−```nginx
143−location /api/ {
144− auth_request /oauth2/auth;
145− error_page 401 =401; # Pass through the 401 status
146− proxy_pass http://backend/;
147−}
148−```
149−
150−This ensures:
151−- ✅ Browsers get a redirect and smooth login flow
152−- ✅ API clients fail fast with appropriate HTTP status codes
153−- ✅ `/oauth2/auth` remains a pure boolean oracle (2xx/401)
154−
155−When you use ingress-nginx in Kubernetes, you can configure the same behavior with the following annotations on your Ingress resource:
156−
157−```yaml
158−nginx.ingress.kubernetes.io/auth-url: "https://<oauth2-proxy-fqdn>/oauth2/auth"
159−nginx.ingress.kubernetes.io/auth-signin: "https://<oauth2-proxy-fqdn>/oauth2/start?rd=$escaped_request_uri"
160−```
161−
162−This minimal configuration works for standard authentication flows. Lua/cookie handling is only needed for advanced scenarios (e.g., multi-part cookies, custom session logic). See the official ingress-nginx example: https://kubernetes.github.io/ingress-nginx/examples/auth/oauth-external-auth/.
163−
164−It is recommended to use `--session-store-type=redis` when expecting large sessions/OIDC tokens (_e.g._ with MS Azure).
165−
166−:::tip Kubernetes Dashboard with Azure Entra ID
167−For a complete example of integrating oauth2-proxy with Kubernetes Dashboard on AKS using Azure Entra ID, including RBAC configuration and troubleshooting, see the [Kubernetes Dashboard on AKS](../providers/ms_entra_id.md#kubernetes-dashboard-on-aks) section in the Microsoft Entra ID provider documentation.
168−:::
169−
170−You have to substitute *name* with the actual cookie name you configured via --cookie-name parameter. If you don't set a custom cookie name the variable should be "$upstream_cookie__oauth2_proxy_1" instead of "$upstream_cookie_name_1" and the new cookie-name should be "_oauth2_proxy_1=" instead of "name_1=".
171−
172−:::note
173−If you set up your OAuth2 provider to rotate your client secret, you can use the `client-secret-file` option to reload the secret when it is updated.
174−:::
docs/versioned_docs/version-7.13.x/configuration/integrations/traefik.mddeleted−192
@@ -1,192 +0,0 @@
1−---
2−id: traefik
3−title: Traefik
4−---
5−
6−Set up OAuth2 Proxy with Traefik v2 using the `ForwardAuth` middleware. Includes examples for both error-based redirects and static upstream configurations.
7−
8−**Key features:**
9−- ForwardAuth middleware integration
10−- Error middleware for 401 redirects
11−- Static upstream configuration (202 responses)
12−- Dynamic file configuration examples
13−
14−
15−## Configuring for use with the Traefik (v2) `ForwardAuth` middleware
16−
17−**This option requires `--reverse-proxy` option to be set.**
18−
19−### ForwardAuth with 401 errors middleware
20−
21−The [Traefik v2 `ForwardAuth` middleware](https://doc.traefik.io/traefik/middlewares/http/forwardauth/) allows Traefik to authenticate requests via the oauth2-proxy's `/oauth2/auth` endpoint on every request, which only returns a 202 Accepted response or a 401 Unauthorized response without proxying the whole request through. For example, on Dynamic File (YAML) Configuration:
22−
23−```yaml
24−http:
25− routers:
26− a-service:
27− rule: "Host(`a-service.example.com`)"
28− service: a-service-backend
29− middlewares:
30− - oauth-errors
31− - oauth-auth
32− tls:
33− certResolver: default
34− domains:
35− - main: "example.com"
36− sans:
37− - "*.example.com"
38− oauth:
39− rule: "Host(`a-service.example.com`, `oauth.example.com`) && PathPrefix(`/oauth2/`)"
40− middlewares:
41− - auth-headers
42− service: oauth-backend
43− tls:
44− certResolver: default
45− domains:
46− - main: "example.com"
47− sans:
48− - "*.example.com"
49−
50− services:
51− a-service-backend:
52− loadBalancer:
53− servers:
54− - url: http://172.16.0.2:7555
55− oauth-backend:
56− loadBalancer:
57− servers:
58− - url: http://172.16.0.1:4180
59−
60− middlewares:
61− auth-headers:
62− headers:
63− sslRedirect: true
64− stsSeconds: 315360000
65− browserXssFilter: true
66− contentTypeNosniff: true
67− forceSTSHeader: true
68− sslHost: example.com
69− stsIncludeSubdomains: true
70− stsPreload: true
71− frameDeny: true
72− oauth-auth:
73− forwardAuth:
74− address: https://oauth.example.com/oauth2/auth
75− trustForwardHeader: true
76− oauth-errors:
77− errors:
78− status:
79− - "401-403"
80− service: oauth-backend
81− query: "/oauth2/sign_in?rd={url}"
82− statusRewrites:
83− "401": 302
84−```
85−
86−:::info Troubleshooting: Browser shows "Found." instead of redirecting
87−When using the Errors middleware without `statusRewrites`, the redirect response from oauth2-proxy can be served within the original 401/403 status context. This causes some browsers to display a "Found." link instead of automatically following the redirect to the identity provider.
88−
89−Adding `statusRewrites` to rewrite `401 -> 302` ensures the browser treats the response as a proper redirect and follows it automatically.
90−:::
91−
92−### ForwardAuth with static upstreams configuration
93−
94−Redirect to sign_in functionality provided without the use of `errors` middleware with [Traefik v2 `ForwardAuth` middleware](https://doc.traefik.io/traefik/middlewares/http/forwardauth/) pointing to oauth2-proxy service's `/` endpoint
95−
96−**Following options need to be set on `oauth2-proxy`:**
97−- `--upstream=static://202`: Configures a static response for authenticated sessions
98−- `--reverse-proxy=true`: Enables the use of `X-Forwarded-*` headers to determine redirects correctly
99−
100−```yaml
101−http:
102− routers:
103− a-service-route-1:
104− rule: "Host(`a-service.example.com`, `b-service.example.com`) && PathPrefix(`/`)"
105− service: a-service-backend
106− middlewares:
107− - oauth-auth-redirect # redirects all unauthenticated to oauth2 signin
108− tls:
109− certResolver: default
110− domains:
111− - main: "example.com"
112− sans:
113− - "*.example.com"
114− a-service-route-2:
115− rule: "Host(`a-service.example.com`) && PathPrefix(`/no-auto-redirect`)"
116− service: a-service-backend
117− middlewares:
118− - oauth-auth-wo-redirect # unauthenticated session will return a 401
119− tls:
120− certResolver: default
121− domains:
122− - main: "example.com"
123− sans:
124− - "*.example.com"
125− services-oauth2-route:
126− rule: "Host(`a-service.example.com`, `b-service.example.com`) && PathPrefix(`/oauth2/`)"
127− middlewares:
128− - auth-headers
129− service: oauth-backend
130− tls:
131− certResolver: default
132− domains:
133− - main: "example.com"
134− sans:
135− - "*.example.com"
136− oauth2-proxy-route:
137− rule: "Host(`oauth.example.com`) && PathPrefix(`/`)"
138− middlewares:
139− - auth-headers
140− service: oauth-backend
141− tls:
142− certResolver: default
143− domains:
144− - main: "example.com"
145− sans:
146− - "*.example.com"
147−
148− services:
149− a-service-backend:
150− loadBalancer:
151− servers:
152− - url: http://172.16.0.2:7555
153− b-service-backend:
154− loadBalancer:
155− servers:
156− - url: http://172.16.0.3:7555
157− oauth-backend:
158− loadBalancer:
159− servers:
160− - url: http://172.16.0.1:4180
161−
162− middlewares:
163− auth-headers:
164− headers:
165− sslRedirect: true
166− stsSeconds: 315360000
167− browserXssFilter: true
168− contentTypeNosniff: true
169− forceSTSHeader: true
170− sslHost: example.com
171− stsIncludeSubdomains: true
172− stsPreload: true
173− frameDeny: true
174− oauth-auth-redirect:
175− forwardAuth:
176− address: https://oauth.example.com/
177− trustForwardHeader: true
178− authResponseHeaders:
179− - X-Auth-Request-Access-Token
180− - Authorization
181− oauth-auth-wo-redirect:
182− forwardAuth:
183− address: https://oauth.example.com/oauth2/auth
184− trustForwardHeader: true
185− authResponseHeaders:
186− - X-Auth-Request-Access-Token
187− - Authorization
188−```
189−
190−:::note
191−If you set up your OAuth2 provider to rotate your client secret, you can use the `client-secret-file` option to reload the secret when it is updated.
192−:::
docs/versioned_docs/version-7.13.x/configuration/overview.md+2−3
@@ -83,7 +83,7 @@ Provider specific options can be found on their respective subpages.
8383| flag: `--approval-prompt`<br/>toml: `approval_prompt` | string | OAuth approval_prompt | `"force"` |
8484| flag: `--backend-logout-url`<br/>toml: `backend_logout_url` | string | URL to perform backend logout, if you use `{id_token}` in the url it will be replaced by the actual `id_token` of the user session | |
8585| flag: `--client-id`<br/>toml: `client_id` | string | the OAuth Client ID, e.g. `"123456.apps.googleusercontent.com"` | |
86−| flag: `--client-secret-file`<br/>toml: `client_secret_file` | string | the file with OAuth Client Secret. The file must contain the secret only, with no trailing newline | |
86+| flag: `--client-secret-file`<br/>toml: `client_secret_file` | string | the file with OAuth Client Secret | |
8787| flag: `--client-secret`<br/>toml: `client_secret` | string | the OAuth Client Secret | |
8888| flag: `--code-challenge-method`<br/>toml: `code_challenge_method` | string | use PKCE code challenges with the specified method. Either 'plain' or 'S256' (recommended) | |
8989| flag: `--insecure-oidc-allow-unverified-email`<br/>toml: `insecure_oidc_allow_unverified_email` | bool | don't fail if an email address in an id_token is not verified | false |
@@ -128,7 +128,7 @@ Provider specific options can be found on their respective subpages.
128128| flag: `--cookie-refresh`<br/>toml: `cookie_refresh` | duration | refresh the cookie after this duration; `0` to disable; not supported by all providers&nbsp;[^1] | |
129129| flag: `--cookie-samesite`<br/>toml: `cookie_samesite` | string | set SameSite cookie attribute (`"lax"`, `"strict"`, `"none"`, or `""`). | `""` |
130130| flag: `--cookie-secret`<br/>toml: `cookie_secret` | string | the seed string for secure cookies (optionally base64 encoded) | |
131−| flag: `--cookie-secret-file`<br/>toml: `cookie_secret_file` | string | File containing the cookie secret (must be raw binary, exactly 16, 24, or 32 bytes). Use dd if=/dev/urandom bs=32 count=1 > cookie.secret to generate | |
131+| flag: `--cookie-secret-file`<br/>toml: `cookie_secret_file` | string | For defining a separate cookie secret file to read the encryption key from | |
132132| flag: `--cookie-secure`<br/>toml: `cookie_secure` | bool | set [secure (HTTPS only) cookie flag](https://owasp.org/www-community/controls/SecureFlag) | true |
133133
134134[^1]: The following providers support `--cookie-refresh`: ADFS, Azure, GitLab, Google, Keycloak and all other Identity Providers which support the full [OIDC specification](https://openid.net/specs/openid-connect-core-1_0.html#RefreshTokens)
@@ -244,7 +244,6 @@ Provider specific options can be found on their respective subpages.
244244| flag: `--session-store-type`<br/>toml: `session_store_type` | string | [Session data storage backend](sessions.md); redis or cookie | cookie |
245245| flag: `--redis-cluster-connection-urls`<br/>toml: `redis_cluster_connection_urls` | string \| list | List of Redis cluster connection URLs (e.g. `redis://HOST[:PORT]`). Used in conjunction with `--redis-use-cluster` | |
246246| flag: `--redis-connection-url`<br/>toml: `redis_connection_url` | string | URL of redis server for redis session storage (e.g. `redis://HOST[:PORT]`) | |
247−| flag: `--redis-ca-path`<br/>toml: `redis_ca_path` | string | Path to a CA certificates file that should be used when connecting to redis. If not specified, the system cert pool is used instead. |
248247| flag: `--redis-insecure-skip-tls-verify`<br/>toml: `redis_insecure_skip_tls_verify` | bool | skip TLS verification when connecting to Redis | false |
249248| flag: `--redis-password`<br/>toml: `redis_password` | string | Redis password. Applicable for all Redis configurations. Will override any password set in `--redis-connection-url` | |
250249| flag: `--redis-sentinel-password`<br/>toml: `redis_sentinel_password` | string | Redis sentinel password. Used only for sentinel connection; any redis node passwords need to use `--redis-password` | |
docs/versioned_docs/version-7.13.x/configuration/providers/cisco_duo.mddeleted−44
@@ -1,44 +0,0 @@
1−---
2−id: cisco_duo
3−title: Cisco Duo
4−---
5−
6−Cisco Duo SSO can be configured with OAuth2 Proxy using the OIDC provider.
7−
8−1. Create a new **Generic OIDC Relying Party - Single Sign-On** application in the Duo Admin Portal
9−2. Configure OAuth2 Proxy with the following options:
10−
11−```
12−provider = "oidc"
13−provider_display_name = "Duo SSO"
14−scope = "openid email profile"
15−pass_access_token = true
16−code_challenge_method = "S256"
17−```
18−
19−3. Configure Provider endpoints. Copy the following values from the corresponding fields in the Duo Admin Portal:
20−
21−```
22−# Copy from "Client ID" field
23−client_id = "XXXXXXXX"
24−
25−# Copy from "Client Secret" field
26−client_secret = "XXXXXXXX"
27−
28−# Copy from "Issuer" field
29−oidc_issuer_url = "https://sso-xxxxxxxx.sso.duosecurity.com/oidc/xxxxxxxx"
30−
31−# Copy from "JWKS URL" field
32−oidc_jwks_url = "https://sso-xxxxxxxx.sso.duosecurity.com/oidc/xxxxxxxx/jwks"
33−
34−# Copy from "Token Introspection URL" field
35−validate_url = "https://sso-xxxxxxxx.sso.duosecurity.com/oidc/xxxxxxxx/token_introspection"
36−
37−# Copy from "UserInfo" field
38−profile_url = "https://sso-xxxxxxxx.sso.duosecurity.com/oidc/xxxxxxxx/userinfo"
39−
40−# Copy from "Token URL" field
41−redeem_url = "https://sso-xxxxxxxx.sso.duosecurity.com/oidc/xxxxxxxx/token"
42−```
43−
44−4. Complete Configuration by filling in any remaining required fields and save your configuration.
docs/versioned_docs/version-7.13.x/configuration/providers/gitlab.md+1−1
@@ -8,7 +8,7 @@ title: GitLab
88| Flag | Toml Field | Type | Description | Default |
99| ------------------- | ----------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
1010| `--gitlab-group` | `gitlab_groups` | string \| list | restrict logins to members of any of these groups (slug), separated by a comma | |
11−| `--gitlab-project` | `gitlab_projects` | string \| list | restrict logins to members of any of these projects (may be given multiple times) formatted as `orgname/repo=accesslevel`. Access level should be a value matching [Gitlab access levels](https://docs.gitlab.com/ee/api/members.html#valid-access-levels), defaulted to 20 if absent | |
11+| `--gitlab-projects` | `gitlab_projects` | string \| list | restrict logins to members of any of these projects (may be given multiple times) formatted as `orgname/repo=accesslevel`. Access level should be a value matching [Gitlab access levels](https://docs.gitlab.com/ee/api/members.html#valid-access-levels), defaulted to 20 if absent | |
1212
1313## Usage
1414
docs/versioned_docs/version-7.13.x/configuration/providers/index.md−1
@@ -11,7 +11,6 @@ Valid providers are :
1111- [ADFS](adfs.md)
1212- [Bitbucket](bitbucket.md)
1313- [Cidaas](cidaas.md)
14−- [CiscoDuo](cisco_duo.md)
1514- [DigitalOcean](digitalocean.md)
1615- [Facebook](facebook.md)
1716- [Gitea](gitea.md)
docs/versioned_docs/version-7.13.x/features/endpoints.md+1−1
@@ -14,7 +14,7 @@ OAuth2 Proxy responds directly to the following endpoints. All other endpoints w
1414- /oauth2/start - a URL that will redirect to start the OAuth cycle
1515- /oauth2/callback - the URL used at the end of the OAuth cycle. The oauth app will be configured with this as the callback url.
1616- /oauth2/userinfo - the URL is used to return user's email from the session in JSON format.
17−- /oauth2/auth - only returns a 202 Accepted response or a 401 Unauthorized response; for use with the [Nginx `auth_request` directive](../configuration/integrations/nginx)
17+- /oauth2/auth - only returns a 202 Accepted response or a 401 Unauthorized response; for use with the [Nginx `auth_request` directive](../configuration/integration#configuring-for-use-with-the-nginx-auth_request-directive)
1818- /oauth2/static/\* - stylesheets and other dependencies used in the sign_in and error pages
1919
2020### Sign out
docs/versioned_docs/version-7.14.x/behaviour.mddeleted−26
@@ -1,26 +0,0 @@
1−---
2−id: behaviour
3−title: Behaviour
4−---
5−
6−1. Authentication Requirement: All requests passing through the proxy to upstream applications require authentication, excluding default proxy endpoints.
7− - Exception: If the request matches a skipped route (configured via `--skip-auth-route`):
8− - Authentication is not enforced, but the proxy will opportunistically attempt to validate a session cookie (`--cookie-name`) or JWT (`--skip-jwt-bearer-tokens`) if present in the request.
9− - Configured user info and authentication headers (e.g., `--pass-access-token`) are injected to upstream routes when validation succeeds.
10−
11−2. Unauthenticated Requests: When authentication is missing but required, the user is redirected to the configured Identity Provider (IdP) login page by default.
12− - Ajax Requests: If the request has `Accept: application/json` header:
13− - Returns `401 Unauthorized`.
14− - Invalid JWT Tokens: If `--skip-jwt-bearer-tokens` is set and the request includes an invalid JWT:
15− - Redirects to the login page by default.
16− - Returns `403 Forbidden` if `--bearer-token-login-fallback` is set to `false`.
17−
18−3. Post-Authentication: After successful authentication with the IdP, OAuth tokens are stored in the configured session store (cookie or Redis), and a cookie is set.
19−
20−4. Request Forwarding: The authenticated request is processed based on configuration:
21− - Forwarded to the configured upstream application with added user info and authentication headers, or
22− - Returns a valid status code for downstream processing by another proxy or load balancer (e.g., Nginx or Traefik).
23−
24−---
25−
26−Note: The proxy also provides a number of useful [endpoints](features/endpoints.md) for monitoring and management.
docs/versioned_docs/version-7.14.x/community/contribution.mddeleted−91
@@ -1,91 +0,0 @@
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−See the `go.mod` file in the root of this repository for the version of Go used by this project.
19−You can follow [the installation guide for Go](https://go.dev/doc/install),
20−and you can find this specific Go version on [the Go downloads page](https://go.dev/dl/).
21−
22−# Preparing your fork
23−Clone your fork, create a feature branch and update the depedencies to get started.
24−```bash
25−git clone git@github.com:<YOUR_FORK>/oauth2-proxy
26−cd oauth2-proxy
27−git branch feature/<BRANCH_NAME>
28−git push --set-upstream origin feature/<BRANCH_NAME>
29−go mod download
30−```
31−
32−
33−# Testing / Debugging
34−For starting oauth2-proxy locally open the debugging tab and create the `launch.json` and select `Go: Launch Package`.
35−
36−![Debugging Tab](/img/debug-tab.png)
37−```json
38−{
39− "version": "0.2.0",
40− "configurations": [
41− {
42− "name": "Launch OAuth2 Proxy with Dex",
43− "type": "go",
44− "request": "launch",
45− "mode": "auto",
46− "program": "${workspaceFolder}",
47− "args": [
48− "--config",
49− // The following configuration contains settings for a locally deployed
50− // upstream and dex as an idetity provider
51− "contrib/local-environment/oauth2-proxy.cfg"
52− ]
53− },
54− {
55− "name": "Launch OAuth2 Proxy with Keycloak",
56− "type": "go",
57− "request": "launch",
58− "mode": "auto",
59− "program": "${workspaceFolder}",
60− "args": [
61− "--config",
62− // The following configuration contains settings for a locally deployed
63− // upstream and keycloak as an idetity provider
64− "contrib/local-environment/oauth2-proxy-keycloak.cfg"
65− ]
66− }
67− ]
68−}
69−```
70−
71−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.
72−
73−Inside the `contrib/local-environment` directory you can use the `Makefile` for
74−starting different example setups:
75−
76−- Dex as your IdP: `make up` or `make down`
77−- Dex as your IdP using the alpha-config: `make alpha-config-up`
78−- Keycloak as your IdP: `make keycloak-up`
79−- Dex as your IdP & nginx reverse proxy: `make nginx-up`
80−- and many more...
81−
82−Check out the `Makefile` to see what is available.
83−
84−The username and password for all setups is usually `admin@example.com` and `password`.
85−
86−The docker compose setups expose the services with a dynamic reverse DNS resolver: localtest.me
87−
88−- OAuth2 Proxy: http://oauth2-proxy.localtest.me:4180
89−- Upstream: http://httpbin.localtest.me:8080
90−- Dex: http://dex.localtest.me:5556
91−
docs/versioned_docs/version-7.14.x/community/security.mddeleted−49
@@ -1,49 +0,0 @@
1−---
2−id: security
3−title: Security
4−---
5−
6−:::note
7−OAuth2 Proxy is a community project.
8−Maintainers do not work on this project full time, and as such,
9−while we endeavour to respond to disclosures as quickly as possible,
10−this may take longer than in projects with corporate sponsorship.
11−:::
12−
13−## Security Disclosures
14−
15−:::important
16−If you believe you have found a vulnerability within OAuth2 Proxy or any of its
17−dependencies, please do NOT open an issue or PR on GitHub, please do NOT post
18−any details publicly.
19−:::
20−
21−Security disclosures MUST be done in private.
22−If you have found an issue that you would like to bring to the attention of the
23−maintenance team for OAuth2 Proxy, please compose an email and send it to the
24−list of maintainers in our [MAINTAINERS.md](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/MAINTAINERS.md) file.
25−
26−Please include as much detail as possible.
27−Ideally, your disclosure should include:
28−- A reproducible case that can be used to demonstrate the exploit
29−- How you discovered this vulnerability
30−- A potential fix for the issue (if you have thought of one)
31−- Versions affected (if not present in master)
32−- Your GitHub ID
33−
34−### How will we respond to disclosures?
35−
36−We use [GitHub Security Advisories](https://docs.github.com/en/github/managing-security-vulnerabilities/about-github-security-advisories)
37−to privately discuss fixes for disclosed vulnerabilities.
38−If you include a GitHub ID with your disclosure we will add you as a collaborator
39−for the advisory so that you can join the discussion and validate any fixes
40−we may propose.
41−
42−For minor issues and previously disclosed vulnerabilities (typically for
43−dependencies), we may use regular PRs for fixes and forego the security advisory.
44−
45−Once a fix has been agreed upon, we will merge the fix and create a new release.
46−If we have multiple security issues in flight simultaneously, we may delay
47−merging fixes until all patches are ready.
48−We may also backport the fix to previous releases,
49−but this will be at the discretion of the maintainers.
docs/versioned_docs/version-7.14.x/configuration/alpha_config.mddeleted−637
@@ -1,637 +0,0 @@
1−---
2−id: alpha-config
3−title: Alpha Configuration
4−---
5−
6−:::warning
7−This page contains documentation for alpha features.
8−We reserve the right to make breaking changes to the features detailed within this page with no notice.
9−
10−Options described in this page may be changed, removed, renamed or moved without prior warning.
11−Please beware of this before you use alpha configuration options.
12−:::
13−
14−This page details a set of **alpha** configuration options in a new format.
15−Going forward we are intending to add structured configuration in YAML format to
16−replace the existing TOML based configuration file and flags.
17−
18−Below is a reference for the structure of the configuration, with
19−[AlphaOptions](#alphaoptions) as the root of the configuration.
20−
21−When using alpha configuration, your config file will look something like below:
22−
23−```yaml
24−upstreams:
25− - id: ...
26− ...: ...
27−providers:
28− - id: ...
29− ...: ...
30−cookie:
31− secret: ...
32− ...: ...
33−injectRequestHeaders:
34− - secretSource:
35− ...: ...
36−injectResponseHeaders:
37− - claimSource:
38− ...: ...
39−```
40−
41−Please browse the [reference](#configuration-reference) below for the structure
42−of the new configuration format.
43−
44−# Migration Guide
45−
46−This section details breaking changes and migration steps for moving to the new
47−alpha configuration format.
48−
49−## Migrating header injections in v7.14.0
50−
51−From v7.14.0 onward, header injection sources must be explicitly nested. If you
52−previously relied on squashed fields, update to the new structure before
53−upgrading:
54−
55−```yaml
56−# before v7.14.0
57−injectRequestHeaders:
58−- name: X-Forwarded-User
59− values:
60− - claim: user
61−- name: X-Custom-Secret-header
62− values:
63− - value: my-super-secret
64−
65−# v7.14.0 and later
66−injectRequestHeaders:
67−- name: X-Forwarded-User
68− values:
69− - claimSource:
70− claim: user
71−- name: X-Custom-Secret-header
72− values:
73− - secretSource:
74− value: my-super-secret
75−```
76−
77−## Using Alpha Configuration
78−
79−To use the new **alpha** configuration, generate a YAML file based on the format
80−described in the [reference](#configuration-reference) below.
81−
82−Provide the path to this file using the `--alpha-config` flag.
83−
84−:::note
85−When using the `--alpha-config` flag, some options are no longer available.
86−See [removed options](#removed-options) below for more information.
87−:::
88−
89−### Converting configuration to the new structure
90−
91−Before adding the new `--alpha-config` option, start OAuth2 Proxy using the
92−`convert-config-to-alpha` flag to convert existing configuration to the new format.
93−
94−```bash
95−oauth2-proxy --convert-config-to-alpha --config ./path/to/existing/config.cfg
96−```
97−
98−This will convert any options supported by the new format to YAML and print the
99−new configuration to `STDOUT`.
100−
101−Copy this to a new file, remove any options from your existing configuration
102−noted in [removed options](#removed-options) and then start OAuth2 Proxy using
103−the new config.
104−
105−```bash
106−oauth2-proxy --alpha-config ./path/to/new/config.yaml --config ./path/to/existing/config.cfg
107−```
108−
109−### How to use environment variables
110−
111−The alpha package supports the use of environment variables in place of yaml values, allowing sensitive data to be pulled from somewhere other than the yaml file.
112−When using environment variables, your yaml will look like this:
113−
114−```yaml
115− providers:
116− - provider: azure
117− clientSecret: ${CLIENT_SECRET}
118− ...
119−```
120−Where CLIENT_SECRET is an environment variable.
121−More information and available patterns can be found [here](https://github.com/a8m/envsubst#docs)
122−
123−### How to inject custom headers
124−
125−Configure `injectRequestHeaders` and `injectResponseHeaders` in alpha config YAML.
126−
127−```yaml
128−injectRequestHeaders:
129− - name: "X-User-Email"
130− values:
131− - claimSource:
132− claim: "email" # extract the email claim contents from the id token
133− - name: "X-Static-Secret"
134− values:
135− # secrets need to be encoded with base64 when directly in the yaml config but will be send decoded
136− - secretSource:
137− value: "c3VwZXItc2VjcmV0"
138− - name: "X-Static-File-Secret"
139− - secretSource:
140− fromFile: "/path/to/my/secret"
141− - name: "X-Static-Env-Secret"
142− - secretSource:
143− value: "${MY_SECRET_ENV}" # content still needs to be base64 encoded
144−injectResponseHeaders:
145− # Following will result in a header "Authorization: Basic <user:password> (encoded)"
146− - name: "Authorization"
147− values:
148− - claimSource:
149− claim: user
150− prefix: "Basic "
151− basicAuthPassword:
152− value: c3VwZXItc2VjcmV0LXBhc3N3b3Jk # base64 encoded password
153−```
154−
155−**Value sources:**
156−* `claimSource` - `claim` (session claims either from id token or from profile URL)
157−* `secretSource` - `value` (base64), `fromFile` (file path)
158−
159−**Request option:** `preserveRequestValue: true` retains existing header values
160−
161−**Incompatibility:** Remove legacy flags `pass-user-headers`, `set-xauthrequest`
162−
163−## Removed options
164−
165−The following flags/options and their respective environment variables are no
166−longer available when using alpha configuration:
167−
168−<!-- Legacy Upstream FlagSet -->
169−- `flush-interval`/`flush_interval`
170−- `pass-host-header`/`pass_host_header`
171−- `proxy-websockets`/`proxy_websockets`
172−- `ssl-upstream-insecure-skip-verify`/`ssl_upstream_insecure_skip_verify`
173−- `upstream`/`upstreams`
174−
175−<!-- Legacy Headers FlagSet -->
176−- `pass-basic-auth`/`pass_basic_auth`
177−- `pass-access-token`/`pass_access_token`
178−- `pass-user-headers`/`pass_user_headers`
179−- `pass-authorization-header`/`pass_authorization_header`
180−- `set-basic-auth`/`set_basic_auth`
181−- `set-xauthrequest`/`set_xauthrequest`
182−- `set-authorization-header`/`set_authorization_header`
183−- `prefer-email-to-user`/`prefer_email_to_user`
184−- `basic-auth-password`/`basic_auth_password`
185−- `skip-auth-strip-headers`/`skip_auth_strip_headers`
186−
187−<!-- Legacy provider FlagSet -->
188−- `client-id`/`client_id`
189−- `client-secret`/`client_secret`, and `client-secret-file`/`client_secret_file`
190−- `provider`
191−- `provider-display-name`/`provider_display_name`
192−- `provider-ca-file`/`provider_ca_files`
193−- `login-url`/`login_url`
194−- `redeem-url`/`redeem_url`
195−- `profile-url`/`profile_url`
196−- `resource`
197−- `validate-url`/`validate_url`
198−- `scope`
199−- `prompt`
200−- `approval-prompt`/`approval_prompt`
201−- `acr-values`/`acr_values`
202−- `user-id-claim`/`user_id_claim`
203−- `allowed-group`/`allowed_groups`
204−- `allowed-role`/`allowed_roles`
205−- `jwt-key`/`jwt_key`
206−- `jwt-key-file`/`jwt_key_file`
207−- `pubjwk-url`/`pubjwk_url`
208−
209−and all provider-specific options, i.e. any option whose name includes `oidc`,
210−`azure`, `bitbucket`, `github`, `gitlab`, `google` or `keycloak`. Attempting to
211−use any of these options via flags or via config when `--alpha-config` is
212−set will result in an error.
213−
214−:::important
215−You must remove these options before starting OAuth2 Proxy with `--alpha-config`
216−:::
217−
218−## Configuration Reference
219−
220−<!--- THIS FILE IS AUTOGENERATED!!! DO NOT EDIT!!! -->
221−
222−### ADFSOptions
223−
224−(**Appears on:** [Provider](#provider))
225−
226−
227−
228−| Field | Type | Description |
229−| ----- | ---- | ----------- |
230−| `skipScope` | _bool_ | Skip adding the scope parameter in login request<br/>Default value is 'false' |
231−
232−### AlphaOptions
233−
234−AlphaOptions contains alpha structured configuration options.
235−Usage of these options allows users to access alpha features that are not
236−available as part of the primary configuration structure for OAuth2 Proxy.
237−
238−:::warning
239−The options within this structure are considered alpha.
240−They may change between releases without notice.
241−:::
242−
243−| Field | Type | Description |
244−| ----- | ---- | ----------- |
245−| `upstreamConfig` | _[UpstreamConfig](#upstreamconfig)_ | UpstreamConfig is used to configure upstream servers.<br/>Once a user is authenticated, requests to the server will be proxied to<br/>these upstream servers based on the path mappings defined in this list. |
246−| `injectRequestHeaders` | _[[]Header](#header)_ | InjectRequestHeaders is used to configure headers that should be added<br/>to requests to upstream servers.<br/>Headers may source values from either the authenticated user's session<br/>or from a static secret value. |
247−| `injectResponseHeaders` | _[[]Header](#header)_ | InjectResponseHeaders is used to configure headers that should be added<br/>to responses from the proxy.<br/>This is typically used when using the proxy as an external authentication<br/>provider in conjunction with another proxy such as NGINX and its<br/>auth_request module.<br/>Headers may source values from either the authenticated user's session<br/>or from a static secret value. |
248−| `server` | _[Server](#server)_ | Server is used to configure the HTTP(S) server for the proxy application.<br/>You may choose to run both HTTP and HTTPS servers simultaneously.<br/>This can be done by setting the BindAddress and the SecureBindAddress simultaneously.<br/>To use the secure server you must configure a TLS certificate and key. |
249−| `metricsServer` | _[Server](#server)_ | MetricsServer is used to configure the HTTP(S) server for metrics.<br/>You may choose to run both HTTP and HTTPS servers simultaneously.<br/>This can be done by setting the BindAddress and the SecureBindAddress simultaneously.<br/>To use the secure server you must configure a TLS certificate and key. |
250−| `providers` | _[Providers](#providers)_ | Providers is used to configure your provider. **Multiple-providers is not<br/>yet working.** [This feature is tracked in<br/>#925](https://github.com/oauth2-proxy/oauth2-proxy/issues/926) |
251−
252−### AzureOptions
253−
254−(**Appears on:** [Provider](#provider))
255−
256−
257−
258−| Field | Type | Description |
259−| ----- | ---- | ----------- |
260−| `tenant` | _string_ | Tenant directs to a tenant-specific or common (tenant-independent) endpoint<br/>Default value is 'common' |
261−| `graphGroupField` | _string_ | GraphGroupField configures the group field to be used when building the groups list from Microsoft Graph<br/>Default value is 'id' |
262−
263−### BitbucketOptions
264−
265−(**Appears on:** [Provider](#provider))
266−
267−
268−
269−| Field | Type | Description |
270−| ----- | ---- | ----------- |
271−| `team` | _string_ | Team sets restrict logins to members of this team |
272−| `repository` | _string_ | Repository sets restrict logins to user with access to this repository |
273−
274−### ClaimSource
275−
276−(**Appears on:** [HeaderValue](#headervalue))
277−
278−ClaimSource allows loading a header value from a claim within the session
279−
280−| Field | Type | Description |
281−| ----- | ---- | ----------- |
282−| `claim` | _string_ | Claim is the name of the claim in the session that the value should be<br/>loaded from. Available claims: `access_token` `id_token` `created_at`<br/>`expires_on` `refresh_token` `email` `user` `groups` `preferred_username`. |
283−| `prefix` | _string_ | Prefix is an optional prefix that will be prepended to the value of the<br/>claim if it is non-empty. |
284−| `basicAuthPassword` | _[SecretSource](#secretsource)_ | BasicAuthPassword converts this claim into a basic auth header.<br/>Note the value of claim will become the basic auth username and the<br/>basicAuthPassword will be used as the password value. |
285−
286−### GitHubOptions
287−
288−(**Appears on:** [Provider](#provider))
289−
290−
291−
292−| Field | Type | Description |
293−| ----- | ---- | ----------- |
294−| `org` | _string_ | Org sets restrict logins to members of this organisation |
295−| `team` | _string_ | Team sets restrict logins to members of this team |
296−| `repo` | _string_ | Repo sets restrict logins to collaborators of this repository |
297−| `token` | _string_ | Token is the token to use when verifying repository collaborators<br/>it must have push access to the repository |
298−| `users` | _[]string_ | Users allows users with these usernames to login<br/>even if they do not belong to the specified org and team or collaborators |
299−
300−### GitLabOptions
301−
302−(**Appears on:** [Provider](#provider))
303−
304−
305−
306−| Field | Type | Description |
307−| ----- | ---- | ----------- |
308−| `group` | _[]string_ | Group sets restrict logins to members of this group |
309−| `projects` | _[]string_ | Projects restricts logins to members of these projects |
310−
311−### GoogleOptions
312−
313−(**Appears on:** [Provider](#provider))
314−
315−
316−
317−| Field | Type | Description |
318−| ----- | ---- | ----------- |
319−| `group` | _[]string_ | Groups sets restrict logins to members of this Google group |
320−| `adminEmail` | _string_ | AdminEmail is the Google admin to impersonate for api calls |
321−| `serviceAccountJson` | _string_ | ServiceAccountJSON is the path to the service account json credentials |
322−| `useApplicationDefaultCredentials` | _bool_ | UseApplicationDefaultCredentials is a boolean whether to use Application Default Credentials instead of a ServiceAccountJSON |
323−| `targetPrincipal` | _string_ | TargetPrincipal is the Google Service Account used for Application Default Credentials |
324−| `useOrganizationID` | _bool_ | UseOrganizationId indicates whether to use the organization ID as the UserName claim |
325−| `adminAPIUserScope` | _string_ | admin scope needed for fetching user organization information from admin api, can be one of cloud, user or defaults to readonly |
326−
327−### Header
328−
329−(**Appears on:** [AlphaOptions](#alphaoptions))
330−
331−Header represents an individual header that will be added to a request or
332−response header.
333−
334−| Field | Type | Description |
335−| ----- | ---- | ----------- |
336−| `name` | _string_ | Name is the header name to be used for this set of values.<br/>Names should be unique within a list of Headers. |
337−| `preserveRequestValue` | _bool_ | PreserveRequestValue determines whether any values for this header<br/>should be preserved for the request to the upstream server.<br/>This option only applies to injected request headers.<br/>Defaults to false (headers that match this header will be stripped). |
338−| `InsecureSkipHeaderNormalization` | _bool_ | InsecureSkipHeaderNormalization disables normalizing the header name<br/>According to RFC 7230 Section 3.2 there aren't any rules about<br/>capitalization of header names, but the standard practice is to use<br/>Title-Case (e.g. X-Forwarded-For). By default, header names will be<br/>normalized to Title-Case and any incoming headers that match will be<br/>treated as the same header. Additionally underscores (_) in header names<br/>will be converted to dashes (-) when normalizing.<br/>Defaults to false (header names will be normalized). |
339−| `values` | _[[]HeaderValue](#headervalue)_ | Values contains the desired values for this header |
340−
341−### HeaderValue
342−
343−(**Appears on:** [Header](#header))
344−
345−HeaderValue represents a single header value and the sources that can
346−make up the header value
347−
348−| Field | Type | Description |
349−| ----- | ---- | ----------- |
350−| `value` | _[]byte_ | Value expects a base64 encoded string value. |
351−| `fromEnv` | _string_ | FromEnv expects the name of an environment variable. |
352−| `fromFile` | _string_ | FromFile expects a path to a file containing the secret value. |
353−| `claim` | _string_ | Claim is the name of the claim in the session that the value should be<br/>loaded from. Available claims: `access_token` `id_token` `created_at`<br/>`expires_on` `refresh_token` `email` `user` `groups` `preferred_username`. |
354−| `prefix` | _string_ | Prefix is an optional prefix that will be prepended to the value of the<br/>claim if it is non-empty. |
355−| `basicAuthPassword` | _[SecretSource](#secretsource)_ | BasicAuthPassword converts this claim into a basic auth header.<br/>Note the value of claim will become the basic auth username and the<br/>basicAuthPassword will be used as the password value. |
356−
357−### KeycloakOptions
358−
359−(**Appears on:** [Provider](#provider))
360−
361−
362−
363−| Field | Type | Description |
364−| ----- | ---- | ----------- |
365−| `groups` | _[]string_ | Group enables to restrict login to members of indicated group |
366−| `roles` | _[]string_ | Role enables to restrict login to users with role (only available when using the keycloak-oidc provider) |
367−
368−### LoginGovOptions
369−
370−(**Appears on:** [Provider](#provider))
371−
372−
373−
374−| Field | Type | Description |
375−| ----- | ---- | ----------- |
376−| `jwtKey` | _string_ | JWTKey is a private key in PEM format used to sign JWT, |
377−| `jwtKeyFile` | _string_ | JWTKeyFile is a path to the private key file in PEM format used to sign the JWT |
378−| `pubjwkURL` | _string_ | PubJWKURL is the JWK pubkey access endpoint |
379−
380−### LoginURLParameter
381−
382−(**Appears on:** [Provider](#provider))
383−
384−LoginURLParameter is the configuration for a single query parameter that
385−can be passed through from the `/oauth2/start` endpoint to the IdP login
386−URL. The "default" option specifies the default value or values (if any)
387−that will be passed to the IdP for this parameter, and "allow" is a list
388−of options for ways in which this parameter can be set or overridden via
389−the query string to `/oauth2/start`.
390−If _only_ a default is specified and no "allow" then the parameter is
391−effectively fixed - the default value will always be used and anything
392−passed to the start URL will be ignored. If _only_ "allow" is specified
393−but no default then the parameter will only be passed on to the IdP if
394−the caller provides it, and no value will be sent otherwise.
395−
396−Examples:
397−
398−# A parameter whose value is fixed
399−
400−```
401−name: organization
402−default:
403−- myorg
404−```
405−
406−A parameter that is not passed by default, but may be set to one of a
407−fixed set of values
408−
409−```
410−name: prompt
411−allow:
412−- value: login
413−- value: consent
414−- value: select_account
415−```
416−
417−A parameter that is passed by default but may be overridden by one of
418−a fixed set of values
419−
420−```
421−name: prompt
422−default: ["login"]
423−allow:
424−- value: consent
425−- value: select_account
426−```
427−
428−A parameter that may be overridden, but only by values that match a
429−regular expression. For example to restrict `login_hint` to email
430−addresses in your organization's domain:
431−
432−```
433−name: login_hint
434−allow:
435−- pattern: '^[^@]*@example\.com$'
436−# this allows at most one "@" sign, and requires "example.com" domain.
437−```
438−
439−Note that the YAML rules around exactly which characters are allowed
440−and/or require escaping in different types of string literals are
441−convoluted. For regular expressions the single quoted form is simplest
442−as backslash is not considered to be an escape character. Alternatively
443−use the "chomped block" format `|-`:
444−
445−```
446− - pattern: |-
447− ^[^@]*@example\.com$
448−
449−```
450−
451−The hyphen is important, a `|` block would have a trailing newline
452−character.
453−
454−| Field | Type | Description |
455−| ----- | ---- | ----------- |
456−| `name` | _string_ | Name specifies the name of the query parameter. |
457−| `default` | _[]string_ | _(Optional)_ Default specifies a default value or values that will be<br/>passed to the IdP if not overridden. |
458−| `allow` | _[[]URLParameterRule](#urlparameterrule)_ | _(Optional)_ Allow specifies rules about how the default (if any) may be<br/>overridden via the query string to `/oauth2/start`. Only<br/>values that match one or more of the allow rules will be<br/>forwarded to the IdP. |
459−
460−### MicrosoftEntraIDOptions
461−
462−(**Appears on:** [Provider](#provider))
463−
464−
465−
466−| Field | Type | Description |
467−| ----- | ---- | ----------- |
468−| `allowedTenants` | _[]string_ | AllowedTenants is a list of allowed tenants. In case of multi-tenant apps, incoming tokens are<br/>issued by different issuers and OIDC issuer verification needs to be disabled.<br/>When not specified, all tenants are allowed. Redundant for single-tenant apps<br/>(regular ID token validation matches the issuer). |
469−| `federatedTokenAuth` | _bool_ | FederatedTokenAuth enable oAuth2 client authentication with federated token projected<br/>by Entra Workload Identity plugin, instead of client secret. |
470−
471−### OIDCOptions
472−
473−(**Appears on:** [Provider](#provider))
474−
475−
476−
477−| Field | Type | Description |
478−| ----- | ---- | ----------- |
479−| `issuerURL` | _string_ | IssuerURL is the OpenID Connect issuer URL<br/>eg: https://accounts.google.com |
480−| `insecureAllowUnverifiedEmail` | _bool_ | InsecureAllowUnverifiedEmail prevents failures if an email address in an id_token is not verified<br/>default set to 'false' |
481−| `insecureSkipIssuerVerification` | _bool_ | InsecureSkipIssuerVerification skips verification of ID token issuers. When false, ID Token Issuers must match the OIDC discovery URL<br/>default set to 'false' |
482−| `insecureSkipNonce` | _bool_ | InsecureSkipNonce skips verifying the ID Token's nonce claim that must match<br/>the random nonce sent in the initial OAuth flow. Otherwise, the nonce is checked<br/>after the initial OAuth redeem & subsequent token refreshes.<br/>default set to 'true'<br/>Warning: In a future release, this will change to 'false' by default for enhanced security. |
483−| `skipDiscovery` | _bool_ | SkipDiscovery allows to skip OIDC discovery and use manually supplied Endpoints<br/>default set to 'false' |
484−| `jwksURL` | _string_ | JwksURL is the OpenID Connect JWKS URL<br/>eg: https://www.googleapis.com/oauth2/v3/certs |
485−| `publicKeyFiles` | _[]string_ | PublicKeyFiles is a list of paths pointing to public key files in PEM format to use<br/>for verifying JWT tokens |
486−| `emailClaim` | _string_ | EmailClaim indicates which claim contains the user email,<br/>default set to 'email' |
487−| `groupsClaim` | _string_ | GroupsClaim indicates which claim contains the user groups<br/>default set to 'groups' |
488−| `userIDClaim` | _string_ | UserIDClaim indicates which claim contains the user ID<br/>default set to 'email' |
489−| `audienceClaims` | _[]string_ | AudienceClaim allows to define any claim that is verified against the client id<br/>By default `aud` claim is used for verification. |
490−| `extraAudiences` | _[]string_ | ExtraAudiences is a list of additional audiences that are allowed<br/>to pass verification in addition to the client id. |
491−
492−### Provider
493−
494−(**Appears on:** [Providers](#providers))
495−
496−Provider holds all configuration for a single provider
497−
498−| Field | Type | Description |
499−| ----- | ---- | ----------- |
500−| `clientID` | _string_ | ClientID is the OAuth Client ID that is defined in the provider<br/>This value is required for all providers. |
501−| `clientSecret` | _string_ | ClientSecret is the OAuth Client Secret that is defined in the provider<br/>This value is required for all providers. |
502−| `clientSecretFile` | _string_ | ClientSecretFile is the name of the file<br/>containing the OAuth Client Secret, it will be used if ClientSecret is not set. |
503−| `keycloakConfig` | _[KeycloakOptions](#keycloakoptions)_ | KeycloakConfig holds all configurations for Keycloak provider. |
504−| `azureConfig` | _[AzureOptions](#azureoptions)_ | AzureConfig holds all configurations for Azure provider. |
505−| `microsoftEntraIDConfig` | _[MicrosoftEntraIDOptions](#microsoftentraidoptions)_ | MicrosoftEntraIDConfig holds all configurations for Entra ID provider. |
506−| `ADFSConfig` | _[ADFSOptions](#adfsoptions)_ | ADFSConfig holds all configurations for ADFS provider. |
507−| `bitbucketConfig` | _[BitbucketOptions](#bitbucketoptions)_ | BitbucketConfig holds all configurations for Bitbucket provider. |
508−| `githubConfig` | _[GitHubOptions](#githuboptions)_ | GitHubConfig holds all configurations for GitHubC provider. |
509−| `gitlabConfig` | _[GitLabOptions](#gitlaboptions)_ | GitLabConfig holds all configurations for GitLab provider. |
510−| `googleConfig` | _[GoogleOptions](#googleoptions)_ | GoogleConfig holds all configurations for Google provider. |
511−| `oidcConfig` | _[OIDCOptions](#oidcoptions)_ | OIDCConfig holds all configurations for OIDC provider<br/>or providers utilize OIDC configurations. |
512−| `loginGovConfig` | _[LoginGovOptions](#logingovoptions)_ | LoginGovConfig holds all configurations for LoginGov provider. |
513−| `id` | _string_ | ID should be a unique identifier for the provider.<br/>This value is required for all providers. |
514−| `provider` | _[ProviderType](#providertype)_ | Type is the OAuth provider<br/>must be set from the supported providers group,<br/>otherwise 'Google' is set as default |
515−| `name` | _string_ | Name is the providers display name<br/>if set, it will be shown to the users in the login page. |
516−| `caFiles` | _[]string_ | CAFiles is a list of paths to CA certificates that should be used when connecting to the provider.<br/>If not specified, the default Go trust sources are used instead |
517−| `useSystemTrustStore` | _bool_ | UseSystemTrustStore determines if your custom CA files and the system trust store are used<br/>If set to true, your custom CA files and the system trust store are used otherwise only your custom CA files. |
518−| `loginURL` | _string_ | LoginURL is the authentication endpoint |
519−| `loginURLParameters` | _[[]LoginURLParameter](#loginurlparameter)_ | LoginURLParameters defines the parameters that can be passed from the start URL to the IdP login URL |
520−| `authRequestResponseMode` | _string_ | AuthRequestResponseMode defines the response mode to request during authorization request |
521−| `redeemURL` | _string_ | RedeemURL is the token redemption endpoint |
522−| `profileURL` | _string_ | ProfileURL is the profile access endpoint |
523−| `skipClaimsFromProfileURL` | _bool_ | SkipClaimsFromProfileURL allows to skip request to Profile URL for resolving claims not present in id_token<br/>default set to 'false' |
524−| `resource` | _string_ | ProtectedResource is the resource that is protected (Azure AD and ADFS only) |
525−| `validateURL` | _string_ | ValidateURL is the access token validation endpoint |
526−| `scope` | _string_ | Scope is the OAuth scope specification |
527−| `allowedGroups` | _[]string_ | AllowedGroups is a list of restrict logins to members of this group |
528−| `code_challenge_method` | _string_ | The code challenge method |
529−| `backendLogoutURL` | _string_ | URL to call to perform backend logout, `{id_token}` would be replaced by the actual `id_token` if available in the session |
530−
531−### ProviderType
532−#### (`string` alias)
533−
534−(**Appears on:** [Provider](#provider))
535−
536−ProviderType is used to enumerate the different provider type options
537−Valid options are: adfs, azure, bitbucket, digitalocean facebook, github,
538−gitlab, google, keycloak, keycloak-oidc, linkedin, login.gov, nextcloud
539−and oidc.
540−
541−### Providers
542−
543−#### ([[]Provider](#provider) alias)
544−
545−(**Appears on:** [AlphaOptions](#alphaoptions))
546−
547−The provider can be selected using the `provider` configuration value, or
548−set in the [`providers` array using
549−AlphaConfig](https://oauth2-proxy.github.io/oauth2-proxy/configuration/alpha-config#providers).
550−However, [**the feature to implement multiple providers is not
551−complete**](https://github.com/oauth2-proxy/oauth2-proxy/issues/926).
552−
553−### SecretSource
554−
555−(**Appears on:** [ClaimSource](#claimsource), [HeaderValue](#headervalue), [TLS](#tls))
556−
557−SecretSource references an individual secret value.
558−Only one source within the struct should be defined at any time.
559−
560−| Field | Type | Description |
561−| ----- | ---- | ----------- |
562−| `value` | _[]byte_ | Value expects a base64 encoded string value. |
563−| `fromEnv` | _string_ | FromEnv expects the name of an environment variable. |
564−| `fromFile` | _string_ | FromFile expects a path to a file containing the secret value. |
565−
566−### Server
567−
568−(**Appears on:** [AlphaOptions](#alphaoptions))
569−
570−Server represents the configuration for an HTTP(S) server
571−
572−| Field | Type | Description |
573−| ----- | ---- | ----------- |
574−| `bindAddress` | _string_ | BindAddress is the address on which to serve traffic.<br/>Leave blank or set to "-" to disable. |
575−| `secureBindAddress` | _string_ | SecureBindAddress is the address on which to serve secure traffic.<br/>Leave blank or set to "-" to disable. |
576−| `tls` | _[TLS](#tls)_ | TLS contains the information for loading the certificate and key for the<br/>secure traffic and further configuration for the TLS server. |
577−
578−### TLS
579−
580−(**Appears on:** [Server](#server))
581−
582−TLS contains the information for loading a TLS certificate and key
583−as well as an optional minimal TLS version that is acceptable.
584−
585−| Field | Type | Description |
586−| ----- | ---- | ----------- |
587−| `key` | _[SecretSource](#secretsource)_ | Key is the TLS key data to use.<br/>Typically this will come from a file. |
588−| `cert` | _[SecretSource](#secretsource)_ | Cert is the TLS certificate data to use.<br/>Typically this will come from a file. |
589−| `minVersion` | _string_ | MinVersion is the minimal TLS version that is acceptable.<br/>E.g. Set to "TLS1.3" to select TLS version 1.3 |
590−| `cipherSuites` | _[]string_ | CipherSuites is a list of TLS cipher suites that are allowed.<br/>E.g.:<br/>- TLS_RSA_WITH_RC4_128_SHA<br/>- TLS_RSA_WITH_AES_256_GCM_SHA384<br/>If not specified, the default Go safe cipher list is used.<br/>List of valid cipher suites can be found in the [crypto/tls documentation](https://pkg.go.dev/crypto/tls#pkg-constants). |
591−
592−### URLParameterRule
593−
594−(**Appears on:** [LoginURLParameter](#loginurlparameter))
595−
596−URLParameterRule represents a rule by which query parameters
597−passed to the `/oauth2/start` endpoint are checked to determine whether
598−they are valid overrides for the given parameter passed to the IdP's
599−login URL. Either Value or Pattern should be supplied, not both.
600−
601−| Field | Type | Description |
602−| ----- | ---- | ----------- |
603−| `value` | _string_ | A Value rule matches just this specific value |
604−| `pattern` | _string_ | A Pattern rule gives a regular expression that must be matched by<br/>some substring of the value. The expression is _not_ automatically<br/>anchored to the start and end of the value, if you _want_ to restrict<br/>the whole parameter value you must anchor it yourself with `^` and `$`. |
605−
606−### Upstream
607−
608−(**Appears on:** [UpstreamConfig](#upstreamconfig))
609−
610−Upstream represents the configuration for an upstream server.
611−Requests will be proxied to this upstream if the path matches the request path.
612−
613−| Field | Type | Description |
614−| ----- | ---- | ----------- |
615−| `id` | _string_ | ID should be a unique identifier for the upstream.<br/>This value is required for all upstreams. |
616−| `path` | _string_ | Path is used to map requests to the upstream server.<br/>The closest match will take precedence and all Paths must be unique.<br/>Path can also take a pattern when used with RewriteTarget.<br/>Path segments can be captured and matched using regular experessions.<br/>Eg:<br/>- `^/foo$`: Match only the explicit path `/foo`<br/>- `^/bar/$`: Match any path prefixed with `/bar/`<br/>- `^/baz/(.*)$`: Match any path prefixed with `/baz` and capture the remaining path for use with RewriteTarget |
617−| `rewriteTarget` | _string_ | RewriteTarget allows users to rewrite the request path before it is sent to<br/>the upstream server (for an HTTP/HTTPS upstream) or mapped to the filesystem<br/>(for a `file:` upstream).<br/>Use the Path to capture segments for reuse within the rewrite target.<br/>Eg: With a Path of `^/baz/(.*)`, a RewriteTarget of `/foo/$1` would rewrite<br/>the request `/baz/abc/123` to `/foo/abc/123` before proxying to the<br/>upstream server. Or if the upstream were `file:///app`, a request for<br/>`/baz/info.html` would return the contents of the file `/app/foo/info.html`. |
618−| `uri` | _string_ | The URI of the upstream server. This may be an HTTP(S) server of a File<br/>based URL. It may include a path, in which case all requests will be served<br/>under that path.<br/>Eg:<br/>- http://localhost:8080<br/>- https://service.localhost<br/>- https://service.localhost/path<br/>- file://host/path<br/>If the URI's path is "/base" and the incoming request was for "/dir",<br/>the upstream request will be for "/base/dir". |
619−| `insecureSkipTLSVerify` | _bool_ | InsecureSkipTLSVerify will skip TLS verification of upstream HTTPS hosts.<br/>This option is insecure and will allow potential Man-In-The-Middle attacks<br/>between OAuth2 Proxy and the upstream server.<br/>Defaults to false. |
620−| `static` | _bool_ | Static will make all requests to this upstream have a static response.<br/>The response will have a body of "Authenticated" and a response code<br/>matching StaticCode.<br/>If StaticCode is not set, the response will return a 200 response. |
621−| `staticCode` | _int_ | StaticCode determines the response code for the Static response.<br/>This option can only be used with Static enabled. |
622−| `flushInterval` | _duration_ | FlushInterval is the period between flushing the response buffer when<br/>streaming response from the upstream.<br/>Defaults to 1 second. |
623−| `passHostHeader` | _bool_ | PassHostHeader determines whether the request host header should be proxied<br/>to the upstream server.<br/>Defaults to true. |
624−| `proxyWebSockets` | _bool_ | ProxyWebSockets enables proxying of websockets to upstream servers<br/>Defaults to true. |
625−| `timeout` | _duration_ | Timeout is the maximum duration the server will wait for a response from the upstream server.<br/>Defaults to 30 seconds. |
626−| `disableKeepAlives` | _bool_ | DisableKeepAlives disables HTTP keep-alive connections to the upstream server.<br/>Defaults to false. |
627−
628−### UpstreamConfig
629−
630−(**Appears on:** [AlphaOptions](#alphaoptions))
631−
632−UpstreamConfig is a collection of definitions for upstream servers.
633−
634−| Field | Type | Description |
635−| ----- | ---- | ----------- |
636−| `proxyRawPath` | _bool_ | ProxyRawPath will pass the raw url path to upstream allowing for urls<br/>like: "/%2F/" which would otherwise be redirected to "/" |
637−| `upstreams` | _[[]Upstream](#upstream)_ | Upstreams represents the configuration for the upstream servers.<br/>Requests will be proxied to this upstream if the path matches the request path. |
docs/versioned_docs/version-7.14.x/configuration/alpha_config.md.tmpldeleted−218
@@ -1,218 +0,0 @@
1−---
2−id: alpha-config
3−title: Alpha Configuration
4−---
5−
6−:::warning
7−This page contains documentation for alpha features.
8−We reserve the right to make breaking changes to the features detailed within this page with no notice.
9−
10−Options described in this page may be changed, removed, renamed or moved without prior warning.
11−Please beware of this before you use alpha configuration options.
12−:::
13−
14−This page details a set of **alpha** configuration options in a new format.
15−Going forward we are intending to add structured configuration in YAML format to
16−replace the existing TOML based configuration file and flags.
17−
18−Below is a reference for the structure of the configuration, with
19−[AlphaOptions](#alphaoptions) as the root of the configuration.
20−
21−When using alpha configuration, your config file will look something like below:
22−
23−```yaml
24−upstreams:
25− - id: ...
26− ...: ...
27−providers:
28− - id: ...
29− ...: ...
30−cookie:
31− secret: ...
32− ...: ...
33−injectRequestHeaders:
34− - secretSource:
35− ...: ...
36−injectResponseHeaders:
37− - claimSource:
38− ...: ...
39−```
40−
41−Please browse the [reference](#configuration-reference) below for the structure
42−of the new configuration format.
43−
44−# Migration Guide
45−
46−This section details breaking changes and migration steps for moving to the new
47−alpha configuration format.
48−
49−## Migrating header injections in v7.14.0
50−
51−From v7.14.0 onward, header injection sources must be explicitly nested. If you
52−previously relied on squashed fields, update to the new structure before
53−upgrading:
54−
55−```yaml
56−# before v7.14.0
57−injectRequestHeaders:
58−- name: X-Forwarded-User
59− values:
60− - claim: user
61−- name: X-Custom-Secret-header
62− values:
63− - value: my-super-secret
64−
65−# v7.14.0 and later
66−injectRequestHeaders:
67−- name: X-Forwarded-User
68− values:
69− - claimSource:
70− claim: user
71−- name: X-Custom-Secret-header
72− values:
73− - secretSource:
74− value: my-super-secret
75−```
76−
77−## Using Alpha Configuration
78−
79−To use the new **alpha** configuration, generate a YAML file based on the format
80−described in the [reference](#configuration-reference) below.
81−
82−Provide the path to this file using the `--alpha-config` flag.
83−
84−:::note
85−When using the `--alpha-config` flag, some options are no longer available.
86−See [removed options](#removed-options) below for more information.
87−:::
88−
89−### Converting configuration to the new structure
90−
91−Before adding the new `--alpha-config` option, start OAuth2 Proxy using the
92−`convert-config-to-alpha` flag to convert existing configuration to the new format.
93−
94−```bash
95−oauth2-proxy --convert-config-to-alpha --config ./path/to/existing/config.cfg
96−```
97−
98−This will convert any options supported by the new format to YAML and print the
99−new configuration to `STDOUT`.
100−
101−Copy this to a new file, remove any options from your existing configuration
102−noted in [removed options](#removed-options) and then start OAuth2 Proxy using
103−the new config.
104−
105−```bash
106−oauth2-proxy --alpha-config ./path/to/new/config.yaml --config ./path/to/existing/config.cfg
107−```
108−
109−### How to use environment variables
110−
111−The alpha package supports the use of environment variables in place of yaml values, allowing sensitive data to be pulled from somewhere other than the yaml file.
112−When using environment variables, your yaml will look like this:
113−
114−```yaml
115− providers:
116− - provider: azure
117− clientSecret: ${CLIENT_SECRET}
118− ...
119−```
120−Where CLIENT_SECRET is an environment variable.
121−More information and available patterns can be found [here](https://github.com/a8m/envsubst#docs)
122−
123−### How to inject custom headers
124−
125−Configure `injectRequestHeaders` and `injectResponseHeaders` in alpha config YAML.
126−
127−```yaml
128−injectRequestHeaders:
129− - name: "X-User-Email"
130− values:
131− - claimSource:
132− claim: "email" # extract the email claim contents from the id token
133− - name: "X-Static-Secret"
134− values:
135− # secrets need to be encoded with base64 when directly in the yaml config but will be send decoded
136− - secretSource:
137− value: "c3VwZXItc2VjcmV0"
138− - name: "X-Static-File-Secret"
139− - secretSource:
140− fromFile: "/path/to/my/secret"
141− - name: "X-Static-Env-Secret"
142− - secretSource:
143− value: "${MY_SECRET_ENV}" # content still needs to be base64 encoded
144−injectResponseHeaders:
145− # Following will result in a header "Authorization: Basic <user:password> (encoded)"
146− - name: "Authorization"
147− values:
148− - claimSource:
149− claim: user
150− prefix: "Basic "
151− basicAuthPassword:
152− value: c3VwZXItc2VjcmV0LXBhc3N3b3Jk # base64 encoded password
153−```
154−
155−**Value sources:**
156−* `claimSource` - `claim` (session claims either from id token or from profile URL)
157−* `secretSource` - `value` (base64), `fromFile` (file path)
158−
159−**Request option:** `preserveRequestValue: true` retains existing header values
160−
161−**Incompatibility:** Remove legacy flags `pass-user-headers`, `set-xauthrequest`
162−
163−## Removed options
164−
165−The following flags/options and their respective environment variables are no
166−longer available when using alpha configuration:
167−
168−<!-- Legacy Upstream FlagSet -->
169−- `flush-interval`/`flush_interval`
170−- `pass-host-header`/`pass_host_header`
171−- `proxy-websockets`/`proxy_websockets`
172−- `ssl-upstream-insecure-skip-verify`/`ssl_upstream_insecure_skip_verify`
173−- `upstream`/`upstreams`
174−
175−<!-- Legacy Headers FlagSet -->
176−- `pass-basic-auth`/`pass_basic_auth`
177−- `pass-access-token`/`pass_access_token`
178−- `pass-user-headers`/`pass_user_headers`
179−- `pass-authorization-header`/`pass_authorization_header`
180−- `set-basic-auth`/`set_basic_auth`
181−- `set-xauthrequest`/`set_xauthrequest`
182−- `set-authorization-header`/`set_authorization_header`
183−- `prefer-email-to-user`/`prefer_email_to_user`
184−- `basic-auth-password`/`basic_auth_password`
185−- `skip-auth-strip-headers`/`skip_auth_strip_headers`
186−
187−<!-- Legacy provider FlagSet -->
188−- `client-id`/`client_id`
189−- `client-secret`/`client_secret`, and `client-secret-file`/`client_secret_file`
190−- `provider`
191−- `provider-display-name`/`provider_display_name`
192−- `provider-ca-file`/`provider_ca_files`
193−- `login-url`/`login_url`
194−- `redeem-url`/`redeem_url`
195−- `profile-url`/`profile_url`
196−- `resource`
197−- `validate-url`/`validate_url`
198−- `scope`
199−- `prompt`
200−- `approval-prompt`/`approval_prompt`
201−- `acr-values`/`acr_values`
202−- `user-id-claim`/`user_id_claim`
203−- `allowed-group`/`allowed_groups`
204−- `allowed-role`/`allowed_roles`
205−- `jwt-key`/`jwt_key`
206−- `jwt-key-file`/`jwt_key_file`
207−- `pubjwk-url`/`pubjwk_url`
208−
209−and all provider-specific options, i.e. any option whose name includes `oidc`,
210−`azure`, `bitbucket`, `github`, `gitlab`, `google` or `keycloak`. Attempting to
211−use any of these options via flags or via config when `--alpha-config` is
212−set will result in an error.
213−
214−:::important
215−You must remove these options before starting OAuth2 Proxy with `--alpha-config`
216−:::
217−
218−## Configuration Reference
docs/versioned_docs/version-7.14.x/configuration/integrations/caddy.mddeleted−63
@@ -1,63 +0,0 @@
1−---
2−id: caddy
3−title: Caddy
4−---
5−
6−Integrate OAuth2 Proxy with Caddy v2 using the `forward_auth` directive.
7−
8−**Key features:**
9−- Simple forward_auth setup
10−- Automatic header handling
11−- Custom error handling and redirects
12−
13−## Configuring for use with the Caddy (v2) `forward_auth` directive
14−
15−The [Caddy `forward_auth` directive](https://caddyserver.com/docs/caddyfile/directives/forward_auth) allows Caddy to authenticate requests via the `oauth2-proxy`'s `/auth`.
16−
17−This example is for a simple reverse proxy setup where the `/oauth2/` path is kept under the same domain and failed auth requests (401 status returned) will be caught and redirected to the `sign_in` endpoint.
18−
19−**Following options need to be set on `oauth2-proxy`:**
20−- `--reverse-proxy=true`: Enables the use of `X-Forwarded-*` headers to determine redirects correctly
21−
22−```nginx title="Caddyfile"
23−example.com {
24− # Requests to /oauth2/* are proxied to oauth2-proxy without authentication.
25− # You can't use `reverse_proxy /oauth2/* oauth2-proxy.internal:4180` here because the reverse_proxy directive has lower precedence than the handle directive.
26− handle /oauth2/* {
27− reverse_proxy oauth2-proxy.internal:4180 {
28− # oauth2-proxy requires the X-Real-IP and X-Forwarded-{Proto,Host,Uri} headers.
29− # The reverse_proxy directive automatically sets X-Forwarded-{For,Proto,Host} headers.
30− header_up X-Real-IP {remote_host}
31− header_up X-Forwarded-Uri {uri}
32− }
33− }
34−
35− # Requests to other paths are first processed by oauth2-proxy for authentication.
36− handle {
37− forward_auth oauth2-proxy.internal:4180 {
38− uri /oauth2/auth
39−
40− # oauth2-proxy requires the X-Real-IP and X-Forwarded-{Proto,Host,Uri} headers.
41− # The forward_auth directive automatically sets the X-Forwarded-{For,Proto,Host,Method,Uri} headers.
42− header_up X-Real-IP {remote_host}
43−
44− # If needed, you can copy headers from the oauth2-proxy response to the request sent to the upstream.
45− # Make sure to configure the --set-xauthrequest flag to enable this feature.
46− #copy_headers X-Auth-Request-User X-Auth-Request-Email
47−
48− # If oauth2-proxy returns a 401 status, redirect the client to the sign-in page.
49− @error status 401
50− handle_response @error {
51− redir * /oauth2/sign_in?rd={scheme}://{host}{uri}
52− }
53− }
54−
55− # If oauth2-proxy returns a 2xx status, the request is then proxied to the upstream.
56− reverse_proxy upstream.internal:3000
57− }
58−}
59−```
60−
61−:::note
62−If you set up your OAuth2 provider to rotate your client secret, you can use the `client-secret-file` option to reload the secret when it is updated.
63−:::
docs/versioned_docs/version-7.14.x/configuration/integrations/headlamp.mddeleted−105
@@ -1,105 +0,0 @@
1−---
2−id: headlamp
3−title: Headlamp
4−---
5−
6−Modern, actively maintained Kubernetes web UI with OAuth2 Proxy integration examples.
7−
8−**Key features:**
9−- Active development and maintenance
10−- Modern, intuitive interface
11−- Multi-cluster support
12−- Plugin system
13−- Works with all OAuth2 providers
14−
15−## Configuring for use with Headlamp
16−
17−[Headlamp](https://headlamp.dev/) is a modern, user-friendly Kubernetes web UI that can be integrated with OAuth2 Proxy for authentication. This is a recommended alternative to the deprecated Kubernetes Dashboard.
18−
19−### Architecture
20−
21−```
22−User → Ingress → OAuth2 Proxy → Authentication Provider (e.g., Azure Entra ID)
23− ↓
24− Headlamp
25−```
26−
27−### Prerequisites
28−
29−- Kubernetes cluster (e.g., AKS, EKS, GKE, or self-hosted)
30−- Headlamp installed in the cluster
31−- OAuth2 provider configured (Azure Entra ID, Google, GitHub, etc.)
32−- Ingress controller (Nginx, Traefik, etc.)
33−
34−### Configuration Overview
35−
36−When integrating Headlamp with OAuth2 Proxy, the OAuth2 Proxy acts as a reverse proxy in front of Headlamp:
37−
38−1. User requests access to Headlamp
39−2. Ingress forwards to OAuth2 Proxy
40−3. OAuth2 Proxy authenticates the user via the OAuth2 provider
41−4. After successful authentication, OAuth2 Proxy proxies requests to Headlamp
42−5. Headlamp receives the authenticated user information via headers
43−
44−### OAuth2 Proxy Configuration
45−
46−Configure OAuth2 Proxy to proxy to the Headlamp service:
47−
48−```yaml
49−upstreamConfig:
50− upstreams:
51− - id: headlamp
52− path: /
53− uri: http://headlamp-service.headlamp-namespace.svc.cluster.local:4466
54−```
55−
56−Enable the necessary headers:
57−
58−```yaml
59−extraArgs:
60− reverse-proxy: true
61− pass-authorization-header: true
62− set-xauthrequest: true
63− email-domain: "*" # Or restrict to your organization
64−```
65−
66−### Example with Azure Entra ID on AKS
67−
68−For detailed instructions on deploying Headlamp with OAuth2 Proxy on Azure Kubernetes Service using Azure Entra ID, see the official Headlamp documentation:
69−
70−https://headlamp.dev/docs/latest/installation/in-cluster/aks-cluster-oauth/
71−
72−Key steps include:
73−
74−1. **Set up AKS with OIDC**: Enable Microsoft Entra ID authentication with Kubernetes RBAC
75−2. **Create Azure App Registration**: Configure redirect URI and create client secret
76−3. **Deploy Headlamp**: Install Headlamp via Helm in your cluster
77−4. **Deploy OAuth2 Proxy**: Configure OAuth2 Proxy with Entra ID provider settings and upstream pointing to Headlamp
78−5. **Configure Ingress**: Set up Ingress to route traffic through OAuth2 Proxy to Headlamp
79−6. **Set RBAC Policies**: Apply Kubernetes RBAC bindings based on users or groups
80−
81−### Integration with Other Providers
82−
83−The same integration pattern works with other OAuth2 providers supported by OAuth2 Proxy:
84−
85−- **Google**: Use the Google provider configuration
86−- **GitHub**: Use the GitHub provider configuration
87−- **GitLab**: Use the GitLab provider configuration
88−- **Keycloak**: Use the Keycloak OIDC provider configuration
89−- **Any OIDC Provider**: Use the generic OIDC provider configuration
90−
91−For provider-specific configuration examples, see the [OAuth Provider Configuration](../providers/index.md) documentation.
92−
93−### Benefits Over Kubernetes Dashboard
94−
95−Headlamp offers several advantages:
96−
97−- **Active Development**: Headlamp is actively maintained and developed
98−- **Modern UI**: Clean, intuitive interface with better UX
99−- **Plugin System**: Extensible with custom plugins
100−- **Multi-cluster Support**: Built-in support for managing multiple clusters
101−- **Desktop App**: Available as both web UI and desktop application
102−
103−:::note
104−If you set up your OAuth2 provider to rotate your client secret, you can use the `client-secret-file` option to reload the secret when it is updated.
105−:::
docs/versioned_docs/version-7.14.x/configuration/integrations/index.mddeleted−41
@@ -1,41 +0,0 @@
1−---
2−id: index
3−title: Integrations
4−---
5−
6−This section provides configuration examples for integrating OAuth2 Proxy with various reverse proxies, ingress controllers, and Kubernetes web UIs.
7−
8−## Reverse Proxies and Ingress Controllers
9−
10−OAuth2 Proxy can be integrated with popular reverse proxies and ingress controllers to add authentication to your applications:
11−
12−- [Nginx](nginx.md)
13−- [Traefik](traefik.md)
14−- [caddy](caddy.md)
15−
16−## Kubernetes Web UIs
17−
18−OAuth2 Proxy can also be used to add authentication to Kubernetes web user interfaces:
19−
20−- [Headlamp](headlamp.md) ✨ *Recommended*
21−- [Kubernetes Dashboard](kubernetes-dashboard.md) ⚠️ *Deprecated*
22−
23−:::tip
24−When integrating with Kubernetes web UIs, make sure to:
25−1. Configure the Ingress to pass the Authorization header with the bearer token
26−2. Increase buffer sizes for large OIDC tokens (especially with Azure Entra ID)
27−3. Set up appropriate Kubernetes RBAC permissions for your users or groups
28−:::
29−
30−## General Requirements
31−
32−Most integrations require the following OAuth2 Proxy configuration:
33−
34−- `--reverse-proxy=true`: Required to correctly handle `X-Forwarded-*` headers
35−- **Session storage**: For production deployments with large tokens due to a lot of claims like AD groups, use `--session-store-type=redis`
36−
37−For provider-specific configuration, see the [OAuth Provider Configuration](../providers/index.md) documentation.
38−
39−:::note
40−If you set up your OAuth2 provider to rotate your client secret, you can use the `client-secret-file` option to reload the secret when it is updated.
41−:::
docs/versioned_docs/version-7.14.x/configuration/integrations/kubernetes-dashboard.mddeleted−289
@@ -1,289 +0,0 @@
1−---
2−id: kubernetes-dashboard
3−title: Kubernetes Dashboard
4−---
5−
6−:::warning Deprecated Project
7−Kubernetes Dashboard has been deprecated and discontinued as of January 2025. See the [official announcement](https://github.com/kubernetes/dashboard/commit/0ba796dce6916bb6ca5da5ca0b3ab22cecfd1e18) for more information.
8−
9−You may want to consider alternative solutions such as [Headlamp](./headlamp.md).
10−:::
11−
12−## Kubernetes Dashboard on AKS with Azure Entra ID
13−
14−Integration guide for the deprecated Kubernetes Dashboard, including comprehensive Azure Entra ID configuration on AKS with detailed troubleshooting and RBAC setup.
15−
16−### Architecture
17−
18−```
19−User → Nginx Ingress → OAuth2 Proxy → Entra ID
20− ↓
21− Kubernetes Dashboard
22−```
23−
24−The integration flow:
25−1. Unauthenticated requests to Dashboard are intercepted by Nginx Ingress
26−2. Nginx redirects to OAuth2 Proxy for authentication
27−3. OAuth2 Proxy redirects to Entra ID login
28−4. After successful authentication, OAuth2 Proxy receives ID token from Entra ID
29−5. OAuth2 Proxy sets Authorization header with the bearer token
30−6. Nginx forwards the request with token to Kubernetes Dashboard
31−7. Dashboard validates the token and grants access based on AKS RBAC configuration
32−
33−### Prerequisites
34−
35−- AKS cluster with Entra ID integration enabled
36−- Kubernetes Dashboard installed (version 7.x or later)
37−- NGINX Ingress Controller installed
38−- Entra ID App Registration configured with:
39− - Redirect URI: `https://your-oauth2-domain.com/oauth2/callback`
40− - API Permissions: `openid`, `email`, `profile`
41− - Groups claim enabled (if using group-based RBAC)
42−- Users or groups assigned appropriate Kubernetes RBAC permissions
43−
44−### Alpha Configuration Example
45−
46−Using [Alpha Configuration](../alpha_config.md) with the OAuth2 Proxy Helm chart:
47−
48−```yaml
49−alphaConfig:
50− enabled: true
51− configData:
52− providers:
53− - id: azure-entra
54− provider: entra-id
55− clientID: YOUR_CLIENT_ID
56− clientSecret: YOUR_CLIENT_SECRET
57− oidcConfig:
58− issuerURL: https://login.microsoftonline.com/YOUR_TENANT_ID/v2.0
59− audienceClaims:
60− - aud
61− emailClaim: email
62− groupsClaim: groups
63− userIDClaim: oid
64− scope: openid email profile
65−
66− upstreamConfig:
67− upstreams:
68− - id: static
69− path: /
70− static: true
71− staticCode: 200
72−
73− # Response headers passed to Dashboard via Nginx
74− injectResponseHeaders:
75− - name: Authorization
76− values:
77− - claim: id_token
78− prefix: "Bearer "
79− - name: X-Auth-Request-User
80− values:
81− - claim: email
82− - name: X-Auth-Request-Email
83− values:
84− - claim: email
85− - name: X-Auth-Request-Groups
86− values:
87− - claim: groups
88−
89− server:
90− BindAddress: "0.0.0.0:4180"
91−
92−extraArgs:
93− cookie-domain: ".your-domain.com"
94− whitelist-domain: ".your-domain.com"
95− email-domain: "*" # Or restrict to your organization
96− skip-provider-button: true
97− reverse-proxy: true
98− pass-authorization-header: true
99− set-xauthrequest: true
100−
101−sessionStorage:
102− type: redis
103−
104−redis:
105− enabled: true
106− auth:
107− enabled: true
108−
109−ingress:
110− enabled: true
111− className: nginx
112− hosts:
113− - OAuth2 Proxy.your-domain.com
114− path: /oauth2
115− pathType: Prefix
116−```
117−
118−### Kubernetes Dashboard Ingress
119−
120−**Critical**: The Ingress must include `Authorization` in the `auth-response-headers` annotation:
121−
122−```yaml
123−apiVersion: networking.k8s.io/v1
124−kind: Ingress
125−metadata:
126− name: kubernetes-dashboard
127− namespace: kubernetes-dashboard
128− annotations:
129− nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
130− nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
131−
132− # OAuth2 Proxy authentication
133− nginx.ingress.kubernetes.io/auth-url: "https://OAuth2 Proxy.your-domain.com/oauth2/auth"
134− nginx.ingress.kubernetes.io/auth-signin: "https://OAuth2 Proxy.your-domain.com/oauth2/start?rd=$scheme://$best_http_host$request_uri"
135−
136− # Include Authorization header with bearer token
137− nginx.ingress.kubernetes.io/auth-response-headers: "Authorization, X-Auth-Request-User, X-Auth-Request-Email"
138−
139− # Buffer sizes for large tokens (Entra tokens can exceed 4KB)
140− nginx.ingress.kubernetes.io/proxy-buffer-size: "256k"
141− nginx.ingress.kubernetes.io/proxy-buffers-number: "4"
142− nginx.ingress.kubernetes.io/proxy-busy-buffers-size: "256k"
143−spec:
144− ingressClassName: nginx
145− tls:
146− - hosts:
147− - dashboard.your-domain.com
148− secretName: dashboard-tls
149− rules:
150− - host: dashboard.your-domain.com
151− http:
152− paths:
153− - path: /
154− pathType: Prefix
155− backend:
156− service:
157− name: kubernetes-dashboard-kong-proxy
158− port:
159− number: 443
160−```
161−
162−### RBAC Configuration
163−
164−Assign Kubernetes permissions to Entra ID users or groups.
165−
166−**User-based:**
167−```yaml
168−apiVersion: rbac.authorization.k8s.io/v1
169−kind: ClusterRoleBinding
170−metadata:
171− name: dashboard-user-admin
172−roleRef:
173− apiGroup: rbac.authorization.k8s.io
174− kind: ClusterRole
175− name: cluster-admin
176−subjects:
177− - kind: User
178− name: "user@your-domain.com" # Email from Entra ID token
179− apiGroup: rbac.authorization.k8s.io
180−```
181−
182−**Group-based (recommended):**
183−```yaml
184−apiVersion: rbac.authorization.k8s.io/v1
185−kind: ClusterRoleBinding
186−metadata:
187− name: dashboard-admins-group
188−roleRef:
189− apiGroup: rbac.authorization.k8s.io
190− kind: ClusterRole
191− name: cluster-admin
192−subjects:
193− - kind: Group
194− name: "YOUR_ENTRA_GROUP_OBJECT_ID" # Entra ID Group Object ID
195− apiGroup: rbac.authorization.k8s.io
196−```
197−
198−For production, create custom roles with limited permissions instead of using `cluster-admin`.
199−
200−### Troubleshooting
201−
202−**Dashboard still asks for token after authentication**
203−
204−Verify that:
205−1. `injectResponseHeaders` in alphaConfig includes Authorization header with id_token claim
206−2. Dashboard Ingress includes `Authorization` in `auth-response-headers` annotation
207−3. Buffer sizes are sufficient for large tokens (set to 256k as shown above)
208−4. Check OAuth2 Proxy logs for successful token generation: `kubectl logs -n OAuth2 Proxy <pod-name>`
209−
210−**"Unauthorized" or "Invalid token" errors**
211−
212−Common causes:
213−1. User/group not configured in Kubernetes RBAC
214− - Check: `kubectl get clusterrolebindings | grep <user-email>`
215−2. Token validation failed
216− - Verify AKS Entra ID integration is enabled
217− - Check Dashboard logs: `kubectl logs -n kubernetes-dashboard <pod-name>`
218−3. Incorrect OAuth2 Proxy configuration
219− - Ensure `reverse-proxy: true` is set
220− - Verify issuer URL matches your tenant
221−
222−**Groups not included in token**
223−
224−To include groups in the token:
225−1. In Entra ID App Registration, go to **Token configuration**
226−2. Add **groups claim** and select security groups
227−3. Or edit the manifest and add: `"groupMembershipClaims": "SecurityGroup"`
228−4. For 200+ groups, ensure scope includes `User.Read` for group overage handling
229−5. Verify groups appear in token: check OAuth2 Proxy logs
230−
231−**Session expires too quickly**
232−
233−Configure cookie expiration:
234−```yaml
235−extraArgs:
236− cookie-expire: "24h"
237− cookie-refresh: "1h"
238−```
239−
240−### Using Workload Identity (Passwordless)
241−
242−For production environments, use Workload Identity instead of client secrets:
243−
244−```yaml
245−config:
246− clientID: "YOUR_CLIENT_ID"
247− secretKeys: # Exclude client-secret
248− - client-id
249− - cookie-secret
250− cookieSecret: "YOUR_COOKIE_SECRET"
251−
252−serviceAccount:
253− annotations:
254− azure.workload.identity/client-id: YOUR_CLIENT_ID
255− azure.workload.identity/tenant-id: YOUR_TENANT_ID
256−
257−podLabels:
258− azure.workload.identity/use: "true"
259−
260−alphaConfig:
261− enabled: true
262− configData:
263− providers:
264− - id: azure-entra
265− provider: entra-id
266− clientID: YOUR_CLIENT_ID
267− oidcConfig:
268− issuerURL: https://login.microsoftonline.com/YOUR_TENANT_ID/v2.0
269− # ... other config
270− entraIdConfig:
271− federatedTokenAuth: true
272−```
273−
274−This requires:
275−- AKS with OIDC issuer and Workload Identity enabled
276−- Federated identity credential configured in Entra ID App Registration
277−- Service account annotated with `azure.workload.identity/client-id`
278−
279−For detailed Workload Identity setup instructions, see the [Workload Identity section](../providers/ms_entra_id.md#workload-identity) in the Microsoft Entra ID provider documentation.
280−
281−## Integration with Other Providers
282−
283−While this guide focuses on Azure Entra ID, Kubernetes Dashboard can be integrated with other OAuth2 providers supported by OAuth2 Proxy. The key requirements remain the same:
284−
285−1. **Authorization Header**: Pass the bearer token via the `Authorization` header
286−2. **RBAC Configuration**: Configure Kubernetes RBAC for your authentication provider's users/groups
287−3. **Buffer Sizes**: Ensure adequate buffer sizes for tokens (especially important for OIDC providers)
288−
289−For provider-specific configuration examples, see the [OAuth Provider Configuration](../providers/index.md) documentation.
docs/versioned_docs/version-7.14.x/configuration/integrations/nginx.mddeleted−174
@@ -1,174 +0,0 @@
1−---
2−id: nginx
3−title: Nginx
4−---
5−
6−Configure OAuth2 Proxy with Nginx using the `auth_request` directive. Includes examples for both standalone Nginx configurations and Kubernetes ingress-nginx with annotations.
7−
8−**Key features:**
9−- Support for `auth_request` directive
10−- Kubernetes Ingress annotations
11−- Multi-part cookie handling for large tokens
12−- Session refresh support
13−
14−## Configuring for use with the Nginx `auth_request` directive
15−
16−**This option requires `--reverse-proxy` option to be set.**
17−
18−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:
19−
20−```nginx
21−server {
22− listen 443 ssl;
23− server_name ...;
24− include ssl/ssl.conf;
25−
26− location /oauth2/ {
27− proxy_pass http://127.0.0.1:4180;
28− proxy_set_header Host $host;
29− proxy_set_header X-Real-IP $remote_addr;
30− proxy_set_header X-Auth-Request-Redirect $request_uri;
31− # or, if you are handling multiple domains:
32− # proxy_set_header X-Auth-Request-Redirect $scheme://$host$request_uri;
33− }
34− location = /oauth2/auth {
35− proxy_pass http://127.0.0.1:4180;
36− proxy_set_header Host $host;
37− proxy_set_header X-Real-IP $remote_addr;
38− proxy_set_header X-Forwarded-Uri $request_uri;
39− # nginx auth_request includes headers but not body
40− proxy_set_header Content-Length "";
41− proxy_pass_request_body off;
42− }
43−
44− location / {
45− auth_request /oauth2/auth;
46− error_page 401 = @oauth2_signin;
47−
48− # pass information via X-User and X-Email headers to backend,
49− # requires running with --set-xauthrequest flag
50− auth_request_set $user $upstream_http_x_auth_request_user;
51− auth_request_set $email $upstream_http_x_auth_request_email;
52− proxy_set_header X-User $user;
53− proxy_set_header X-Email $email;
54−
55− # if you enabled --pass-access-token, this will pass the token to the backend
56− auth_request_set $token $upstream_http_x_auth_request_access_token;
57− proxy_set_header X-Access-Token $token;
58−
59− # if you enabled --cookie-refresh, this is needed for it to work with auth_request
60− auth_request_set $auth_cookie $upstream_http_set_cookie;
61− add_header Set-Cookie $auth_cookie;
62−
63− # When using the --set-authorization-header flag, some provider's cookies can exceed the 4kb
64− # limit and so the OAuth2 Proxy splits these into multiple parts.
65− # Nginx normally only copies the first `Set-Cookie` header from the auth_request to the response,
66− # so if your cookies are larger than 4kb, you will need to extract additional cookies manually.
67− auth_request_set $auth_cookie_name_upstream_1 $upstream_cookie_auth_cookie_name_1;
68−
69− # Extract the Cookie attributes from the first Set-Cookie header and append them
70− # to the second part ($upstream_cookie_* variables only contain the raw cookie content)
71− if ($auth_cookie ~* "(; .*)") {
72− set $auth_cookie_name_0 $auth_cookie;
73− set $auth_cookie_name_1 "auth_cookie_name_1=$auth_cookie_name_upstream_1$1";
74− }
75−
76− # Send both Set-Cookie headers now if there was a second part
77− if ($auth_cookie_name_upstream_1) {
78− add_header Set-Cookie $auth_cookie_name_0;
79− add_header Set-Cookie $auth_cookie_name_1;
80− }
81−
82− proxy_pass http://backend/;
83− # or "root /path/to/site;" or "fastcgi_pass ..." etc
84− }
85−
86− # Named location for handling OAuth2 sign-in redirects
87− # This ensures the browser receives a proper 302 redirect that it will follow
88− location @oauth2_signin {
89− return 302 /oauth2/sign_in?rd=$scheme://$host$request_uri;
90− }
91−}
92−```
93−
94−### Understanding the `error_page` redirect pattern
95−
96−The `auth_request` directive expects the authentication endpoint (`/oauth2/auth`) to return:
97−- **2xx**: Request is authenticated, allow access
98−- **401 or 403**: Request is not authenticated, deny access
99−
100−When a 401 is returned, nginx triggers the `error_page` directive. The recommended pattern uses a **named location** (`@oauth2_signin`) that returns a proper **302 redirect**:
101−
102−```nginx
103−error_page 401 = @oauth2_signin;
104−
105−location @oauth2_signin {
106− return 302 /oauth2/sign_in?rd=$scheme://$host$request_uri;
107−}
108−```
109−
110−:::warning Avoid `error_page 401 =403` with sign_in
111−Some older configurations use `error_page 401 =403 /oauth2/sign_in`. While this works for displaying the sign-in page, it returns a **403 status code** with a `Location` header. Browsers do not automatically follow redirects on 403 responses, which can cause issues when using `--skip-provider-button=true` (users see a "Found." link instead of being automatically redirected).
112−
113−The named location pattern above ensures the browser receives a standard **302 redirect** that works correctly with all oauth2-proxy configurations.
114−:::
115−
116−### Browser vs API Routes
117−
118−:::important When to use redirects
119−Redirecting authentication failures (302 to `/oauth2/sign_in`) should **only be used for browser-facing routes**. API or machine clients should receive a plain 401/403 response without redirect.
120−:::
121−
122−#### Browser-facing routes (HTML, UI)
123−
124−For interactive browser routes where users should be redirected to sign in:
125−
126−```nginx
127−location / {
128− auth_request /oauth2/auth;
129− error_page 401 = @oauth2_signin;
130− proxy_pass http://backend/;
131−}
132−
133−location @oauth2_signin {
134− return 302 /oauth2/sign_in?rd=$scheme://$host$request_uri;
135−}
136−```
137−
138−#### API / Machine routes (no redirect)
139−
140−For API endpoints where clients expect a 401/403 status code (not a redirect):
141−
142−```nginx
143−location /api/ {
144− auth_request /oauth2/auth;
145− error_page 401 =401; # Pass through the 401 status
146− proxy_pass http://backend/;
147−}
148−```
149−
150−This ensures:
151−- ✅ Browsers get a redirect and smooth login flow
152−- ✅ API clients fail fast with appropriate HTTP status codes
153−- ✅ `/oauth2/auth` remains a pure boolean oracle (2xx/401)
154−
155−When you use ingress-nginx in Kubernetes, you can configure the same behavior with the following annotations on your Ingress resource:
156−
157−```yaml
158−nginx.ingress.kubernetes.io/auth-url: "https://<oauth2-proxy-fqdn>/oauth2/auth"
159−nginx.ingress.kubernetes.io/auth-signin: "https://<oauth2-proxy-fqdn>/oauth2/start?rd=$escaped_request_uri"
160−```
161−
162−This minimal configuration works for standard authentication flows. Lua/cookie handling is only needed for advanced scenarios (e.g., multi-part cookies, custom session logic). See the official ingress-nginx example: https://kubernetes.github.io/ingress-nginx/examples/auth/oauth-external-auth/.
163−
164−It is recommended to use `--session-store-type=redis` when expecting large sessions/OIDC tokens (_e.g._ with MS Azure).
165−
166−:::tip Kubernetes Dashboard with Azure Entra ID
167−For a complete example of integrating oauth2-proxy with Kubernetes Dashboard on AKS using Azure Entra ID, including RBAC configuration and troubleshooting, see the [Kubernetes Dashboard on AKS](../providers/ms_entra_id.md#kubernetes-dashboard-on-aks) section in the Microsoft Entra ID provider documentation.
168−:::
169−
170−You have to substitute *name* with the actual cookie name you configured via --cookie-name parameter. If you don't set a custom cookie name the variable should be "$upstream_cookie__oauth2_proxy_1" instead of "$upstream_cookie_name_1" and the new cookie-name should be "_oauth2_proxy_1=" instead of "name_1=".
171−
172−:::note
173−If you set up your OAuth2 provider to rotate your client secret, you can use the `client-secret-file` option to reload the secret when it is updated.
174−:::
docs/versioned_docs/version-7.14.x/configuration/integrations/traefik.mddeleted−192
@@ -1,192 +0,0 @@
1−---
2−id: traefik
3−title: Traefik
4−---
5−
6−Set up OAuth2 Proxy with Traefik v2 using the `ForwardAuth` middleware. Includes examples for both error-based redirects and static upstream configurations.
7−
8−**Key features:**
9−- ForwardAuth middleware integration
10−- Error middleware for 401 redirects
11−- Static upstream configuration (202 responses)
12−- Dynamic file configuration examples
13−
14−
15−## Configuring for use with the Traefik (v2) `ForwardAuth` middleware
16−
17−**This option requires `--reverse-proxy` option to be set.**
18−
19−### ForwardAuth with 401 errors middleware
20−
21−The [Traefik v2 `ForwardAuth` middleware](https://doc.traefik.io/traefik/middlewares/http/forwardauth/) allows Traefik to authenticate requests via the oauth2-proxy's `/oauth2/auth` endpoint on every request, which only returns a 202 Accepted response or a 401 Unauthorized response without proxying the whole request through. For example, on Dynamic File (YAML) Configuration:
22−
23−```yaml
24−http:
25− routers:
26− a-service:
27− rule: "Host(`a-service.example.com`)"
28− service: a-service-backend
29− middlewares:
30− - oauth-errors
31− - oauth-auth
32− tls:
33− certResolver: default
34− domains:
35− - main: "example.com"
36− sans:
37− - "*.example.com"
38− oauth:
39− rule: "Host(`a-service.example.com`, `oauth.example.com`) && PathPrefix(`/oauth2/`)"
40− middlewares:
41− - auth-headers
42− service: oauth-backend
43− tls:
44− certResolver: default
45− domains:
46− - main: "example.com"
47− sans:
48− - "*.example.com"
49−
50− services:
51− a-service-backend:
52− loadBalancer:
53− servers:
54− - url: http://172.16.0.2:7555
55− oauth-backend:
56− loadBalancer:
57− servers:
58− - url: http://172.16.0.1:4180
59−
60− middlewares:
61− auth-headers:
62− headers:
63− sslRedirect: true
64− stsSeconds: 315360000
65− browserXssFilter: true
66− contentTypeNosniff: true
67− forceSTSHeader: true
68− sslHost: example.com
69− stsIncludeSubdomains: true
70− stsPreload: true
71− frameDeny: true
72− oauth-auth:
73− forwardAuth:
74− address: https://oauth.example.com/oauth2/auth
75− trustForwardHeader: true
76− oauth-errors:
77− errors:
78− status:
79− - "401-403"
80− service: oauth-backend
81− query: "/oauth2/sign_in?rd={url}"
82− statusRewrites:
83− "401": 302
84−```
85−
86−:::info Troubleshooting: Browser shows "Found." instead of redirecting
87−When using the Errors middleware without `statusRewrites`, the redirect response from oauth2-proxy can be served within the original 401/403 status context. This causes some browsers to display a "Found." link instead of automatically following the redirect to the identity provider.
88−
89−Adding `statusRewrites` to rewrite `401 -> 302` ensures the browser treats the response as a proper redirect and follows it automatically.
90−:::
91−
92−### ForwardAuth with static upstreams configuration
93−
94−Redirect to sign_in functionality provided without the use of `errors` middleware with [Traefik v2 `ForwardAuth` middleware](https://doc.traefik.io/traefik/middlewares/http/forwardauth/) pointing to oauth2-proxy service's `/` endpoint
95−
96−**Following options need to be set on `oauth2-proxy`:**
97−- `--upstream=static://202`: Configures a static response for authenticated sessions
98−- `--reverse-proxy=true`: Enables the use of `X-Forwarded-*` headers to determine redirects correctly
99−
100−```yaml
101−http:
102− routers:
103− a-service-route-1:
104− rule: "Host(`a-service.example.com`, `b-service.example.com`) && PathPrefix(`/`)"
105− service: a-service-backend
106− middlewares:
107− - oauth-auth-redirect # redirects all unauthenticated to oauth2 signin
108− tls:
109− certResolver: default
110− domains:
111− - main: "example.com"
112− sans:
113− - "*.example.com"
114− a-service-route-2:
115− rule: "Host(`a-service.example.com`) && PathPrefix(`/no-auto-redirect`)"
116− service: a-service-backend
117− middlewares:
118− - oauth-auth-wo-redirect # unauthenticated session will return a 401
119− tls:
120− certResolver: default
121− domains:
122− - main: "example.com"
123− sans:
124− - "*.example.com"
125− services-oauth2-route:
126− rule: "Host(`a-service.example.com`, `b-service.example.com`) && PathPrefix(`/oauth2/`)"
127− middlewares:
128− - auth-headers
129− service: oauth-backend
130− tls:
131− certResolver: default
132− domains:
133− - main: "example.com"
134− sans:
135− - "*.example.com"
136− oauth2-proxy-route:
137− rule: "Host(`oauth.example.com`) && PathPrefix(`/`)"
138− middlewares:
139− - auth-headers
140− service: oauth-backend
141− tls:
142− certResolver: default
143− domains:
144− - main: "example.com"
145− sans:
146− - "*.example.com"
147−
148− services:
149− a-service-backend:
150− loadBalancer:
151− servers:
152− - url: http://172.16.0.2:7555
153− b-service-backend:
154− loadBalancer:
155− servers:
156− - url: http://172.16.0.3:7555
157− oauth-backend:
158− loadBalancer:
159− servers:
160− - url: http://172.16.0.1:4180
161−
162− middlewares:
163− auth-headers:
164− headers:
165− sslRedirect: true
166− stsSeconds: 315360000
167− browserXssFilter: true
168− contentTypeNosniff: true
169− forceSTSHeader: true
170− sslHost: example.com
171− stsIncludeSubdomains: true
172− stsPreload: true
173− frameDeny: true
174− oauth-auth-redirect:
175− forwardAuth:
176− address: https://oauth.example.com/
177− trustForwardHeader: true
178− authResponseHeaders:
179− - X-Auth-Request-Access-Token
180− - Authorization
181− oauth-auth-wo-redirect:
182− forwardAuth:
183− address: https://oauth.example.com/oauth2/auth
184− trustForwardHeader: true
185− authResponseHeaders:
186− - X-Auth-Request-Access-Token
187− - Authorization
188−```
189−
190−:::note
191−If you set up your OAuth2 provider to rotate your client secret, you can use the `client-secret-file` option to reload the secret when it is updated.
192−:::
docs/versioned_docs/version-7.14.x/configuration/overview.mddeleted−407
@@ -1,407 +0,0 @@
1−---
2−id: overview
3−title: Overview
4−---
5−
6−`oauth2-proxy` can be configured via [command line options](#command-line-options), [environment variables](#environment-variables) or [config file](#config-file) (in decreasing order of precedence, i.e. command line options will overwrite environment variables and environment variables will overwrite configuration file settings).
7−
8−## Generating a Cookie Secret
9−
10−To generate a strong cookie secret use one of the below commands:
11−
12−import Tabs from '@theme/Tabs';
13−import TabItem from '@theme/TabItem';
14−
15−<Tabs defaultValue="python">
16− <TabItem value="python" label="Python">
17−
18−```shell
19−python -c 'import os,base64; print(base64.urlsafe_b64encode(os.urandom(32)).decode())'
20−```
21−
22− </TabItem>
23− <TabItem value="bash" label="Bash">
24−
25−```shell
26−dd if=/dev/urandom bs=32 count=1 2>/dev/null | base64 | tr -d -- '\n' | tr -- '+/' '-_' ; echo
27−```
28−
29− </TabItem>
30− <TabItem value="openssl" label="OpenSSL">
31−
32−```shell
33−openssl rand -base64 32 | tr -- '+/' '-_'
34−```
35−
36− </TabItem>
37− <TabItem value="powershell" label="PowerShell">
38−
39−```powershell
40−# Add System.Web assembly to session, just in case
41−Add-Type -AssemblyName System.Web
42−[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes([System.Web.Security.Membership]::GeneratePassword(32,4))).Replace("+","-").Replace("/","_")
43−```
44−
45− </TabItem>
46− <TabItem value="terraform" label="Terraform">
47−
48−```hcl
49−# Valid 32 Byte Base64 URL encoding set that will decode to 24 []byte AES-192 secret
50−resource "random_password" "cookie_secret" {
51− length = 32
52− override_special = "-_"
53−}
54−```
55−
56− </TabItem>
57−</Tabs>
58−
59−## Config File
60−
61−Every command line argument can be specified in a config file by replacing hyphens (-) with underscores (\_). If the argument can be specified multiple times, the config option should be plural (trailing s).
62−
63−An example [oauth2-proxy.cfg](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/contrib/oauth2-proxy.cfg.example) config file is in the contrib directory. It can be used by specifying `--config=/etc/oauth2-proxy.cfg`
64−
65−## Config Options
66−
67−### Command Line Options
68−
69−| Flag | Description |
70−| ----------- | -------------------- |
71−| `--config` | path to config file |
72−| `--version` | print version string |
73−
74−
75−### General Provider Options
76−
77−Provider specific options can be found on their respective subpages.
78−
79−| Flag / Config Field | Type | Description | Default |
80−| --------------------------------------------------------------------------------------------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
81−| flag: `--acr-values`<br/>toml: `acr_values` | string | optional, see [docs](https://openid.net/specs/openid-connect-eap-acr-values-1_0.html#acrValues) | `""` |
82−| flag: `--allowed-group`<br/>toml: `allowed_groups` | string \| list | Restrict login to members of a group or list of groups. Furthermore, if you aren't setting the `scope` and use `allowed_groups` with the generic OIDC provider the scope `groups` gets added implicitly. | |
83−| flag: `--approval-prompt`<br/>toml: `approval_prompt` | string | OAuth approval_prompt | `"force"` |
84−| flag: `--backend-logout-url`<br/>toml: `backend_logout_url` | string | URL to perform backend logout, if you use `{id_token}` in the url it will be replaced by the actual `id_token` of the user session | |
85−| flag: `--client-id`<br/>toml: `client_id` | string | the OAuth Client ID, e.g. `"123456.apps.googleusercontent.com"` | |
86−| flag: `--client-secret-file`<br/>toml: `client_secret_file` | string | the file with OAuth Client Secret. The file must contain the secret only, with no trailing newline | |
87−| flag: `--client-secret`<br/>toml: `client_secret` | string | the OAuth Client Secret | |
88−| flag: `--code-challenge-method`<br/>toml: `code_challenge_method` | string | use PKCE code challenges with the specified method. Either 'plain' or 'S256' (recommended) | |
89−| flag: `--insecure-oidc-allow-unverified-email`<br/>toml: `insecure_oidc_allow_unverified_email` | bool | don't fail if an email address in an id_token is not verified | false |
90−| flag: `--insecure-oidc-skip-issuer-verification`<br/>toml: `insecure_oidc_skip_issuer_verification` | bool | allow the OIDC issuer URL to differ from the expected (currently required for Azure multi-tenant compatibility) | false |
91−| flag: `--insecure-oidc-skip-nonce`<br/>toml: `insecure_oidc_skip_nonce` | bool | skip verifying the OIDC ID Token's nonce claim | true |
92−| flag: `--jwt-key-file`<br/>toml: `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 | |
93−| flag: `--jwt-key`<br/>toml: `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 | |
94−| flag: `--login-url`<br/>toml: `login_url` | string | Authentication endpoint | |
95−| flag: `--auth-request-response-mode`<br/>toml: `auth-request-response-mode` | string | Response mode to ask for during authentication request | |
96−| flag: `--oidc-audience-claim`<br/>toml: `oidc_audience_claims` | string | which OIDC claim contains the audience | `"aud"` |
97−| flag: `--oidc-email-claim`<br/>toml: `oidc_email_claim` | string | which OIDC claim contains the user's email | `"email"` |
98−| flag: `--oidc-extra-audience`<br/>toml: `oidc_extra_audiences` | string \| list | additional audiences which are allowed to pass verification | `"[]"` |
99−| flag: `--oidc-groups-claim`<br/>toml: `oidc_groups_claim` | string | which OIDC claim contains the user groups | `"groups"` |
100−| flag: `--oidc-issuer-url`<br/>toml: `oidc_issuer_url` | string | the OpenID Connect issuer URL, e.g. `"https://accounts.google.com"` | |
101−| flag: `--oidc-jwks-url`<br/>toml: `oidc_jwks_url` | string | OIDC JWKS URI for token verification; required if OIDC discovery is disabled and public key files are not provided | |
102−| flag: `--oidc-public-key-file`<br/>toml: `oidc_public_key_files` | string | Path to public key file in PEM format to use for verifying JWT tokens (may be given multiple times). Required if OIDC discovery is disabled na JWKS URL isn't provided | string \| list |
103−| flag: `--profile-url`<br/>toml: `profile_url` | string | Profile access endpoint | |
104−| flag: `--prompt`<br/>toml: `prompt` | string | [OIDC prompt](https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest); if present, `approval-prompt` is ignored | `""` |
105−| flag: `--provider-ca-file`<br/>toml: `provider_ca_files` | string \| list | Paths to CA certificates that should be used when connecting to the provider. If not specified, the default Go trust sources are used instead. |
106−| flag: `--provider-display-name`<br/>toml: `provider_display_name` | string | Override the provider's name with the given string; used for the sign-in page | (depends on provider) |
107−| flag: `--provider`<br/>toml: `provider` | string | OAuth provider | google |
108−| flag: `--pubjwk-url`<br/>toml: `pubjwk_url` | string | JWK pubkey access endpoint: required by login.gov | |
109−| flag: `--redeem-url`<br/>toml: `redeem_url` | string | Token redemption endpoint | |
110−| flag: `--scope`<br/>toml:`scope` | string | OAuth scope specification. Every provider has a default list of scopes which will be used in case no scope is configured. | |
111−| flag: `--skip-claims-from-profile-url`<br/>toml: `skip_claims_from_profile_url` | bool | skip request to Profile URL for resolving claims not present in id_token | false |
112−| flag: `--skip-oidc-discovery`<br/>toml: `skip_oidc_discovery` | bool | bypass OIDC endpoint discovery. `--login-url`, `--redeem-url` and `--oidc-jwks-url` must be configured in this case | false |
113−| flag: `--use-system-trust-store`<br/>toml: `use_system_trust_store` | bool | Determines if `provider-ca-file` files and the system trust store are used. If set to true, your custom CA files and the system trust store are used otherwise only your custom CA files. | false |
114−| flag: `--validate-url`<br/>toml: `validate_url` | string | Access token validation endpoint | |
115−
116−### Cookie Options
117−
118−| Flag / Config Field | Type | Description | Default |
119−| --------------------------------------------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
120−| flag: `--cookie-csrf-expire`<br/>toml: `cookie_csrf_expire` | duration | expire timeframe for CSRF cookie | 15m |
121−| flag: `--cookie-csrf-per-request`<br/>toml:`cookie_csrf_per_request` | bool | Enable having different CSRF cookies per request, making it possible to have parallel requests. | false |
122−| flag: `--cookie-csrf-per-request-limit`<br/>toml: `cookie_csrf_per_request_limit` | int | Sets a limit on the number of CSRF requests cookies that oauth2-proxy will create. The oldest cookie will be removed. Useful if users end up with 431 Request headers too large status codes. Only effective if --cookie-csrf-per-request is true | "infinite" |
123−| flag: `--cookie-domain`<br/>toml: `cookie_domains` | string \| list | Optional cookie domains to force cookies to (e.g. `.yourcompany.com`). The longest domain matching the request's host will be used (or the shortest cookie domain if there is no match). | |
124−| flag: `--cookie-expire`<br/>toml: `cookie_expire` | duration | expire timeframe for cookie. If set to 0, cookie becomes a session-cookie which will expire when the browser is closed. | 168h0m0s |
125−| flag: `--cookie-httponly`<br/>toml: `cookie_httponly` | bool | set HttpOnly cookie flag | true |
126−| flag: `--cookie-name`<br/>toml: `cookie_name` | string | the name of the cookie that the oauth_proxy creates. Should be changed to use a [cookie prefix](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#cookie_prefixes) (`__Host-` or `__Secure-`) if `--cookie-secure` is set. | `"_oauth2_proxy"` |
127−| flag: `--cookie-path`<br/>toml: `cookie_path` | string | an optional cookie path to force cookies to (e.g. `/poc/`) | `"/"` |
128−| flag: `--cookie-refresh`<br/>toml: `cookie_refresh` | duration | refresh the cookie after this duration; `0` to disable; not supported by all providers&nbsp;[^1] | |
129−| flag: `--cookie-samesite`<br/>toml: `cookie_samesite` | string | set SameSite cookie attribute (`"lax"`, `"strict"`, `"none"`, or `""`). | `""` |
130−| flag: `--cookie-secret`<br/>toml: `cookie_secret` | string | the seed string for secure cookies (optionally base64 encoded) | |
131−| flag: `--cookie-secret-file`<br/>toml: `cookie_secret_file` | string | File containing the cookie secret (must be raw binary, exactly 16, 24, or 32 bytes). Use dd if=/dev/urandom bs=32 count=1 > cookie.secret to generate | |
132−| flag: `--cookie-secure`<br/>toml: `cookie_secure` | bool | set [secure (HTTPS only) cookie flag](https://owasp.org/www-community/controls/SecureFlag) | true |
133−
134−[^1]: The following providers support `--cookie-refresh`: ADFS, Azure, GitLab, Google, Keycloak and all other Identity Providers which support the full [OIDC specification](https://openid.net/specs/openid-connect-core-1_0.html#RefreshTokens)
135−
136−### Header Options
137−
138−| Flag / Config Field | Type | Description | Default |
139−| ------------------------------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
140−| flag: `--basic-auth-password`<br/>toml: `basic_auth_password` | string | the password to set when passing the HTTP Basic Auth header | |
141−| flag: `--set-xauthrequest`<br/>toml: `set_xauthrequest` | bool | set X-Auth-Request-User, X-Auth-Request-Groups, X-Auth-Request-Email and X-Auth-Request-Preferred-Username response headers (useful in Nginx auth_request mode). When used with `--pass-access-token`, X-Auth-Request-Access-Token is added to response headers. | false |
142−| flag: `--set-authorization-header`<br/>toml: `set_authorization_header` | bool | set Authorization Bearer response header (useful in Nginx auth_request mode) | false |
143−| flag: `--set-basic-auth`<br/>toml: `set_basic_auth` | bool | set HTTP Basic Auth information in response (useful in Nginx auth_request mode) | false |
144−| flag: `--skip-auth-strip-headers`<br/>toml: `skip_auth_strip_headers` | bool | strips `X-Forwarded-*` style authentication headers & `Authorization` header if they would be set by oauth2-proxy | true |
145−| flag: `--pass-access-token`<br/>toml: `pass_access_token` | bool | pass OAuth access_token to upstream via X-Forwarded-Access-Token header. When used with `--set-xauthrequest` this adds the X-Auth-Request-Access-Token header to the response | false |
146−| flag: `--pass-authorization-header`<br/>toml: `pass_authorization_header` | bool | pass OIDC IDToken to upstream via Authorization Bearer header | false |
147−| flag: `--pass-basic-auth`<br/>toml: `pass_basic_auth` | bool | pass HTTP Basic Auth, X-Forwarded-User, X-Forwarded-Email and X-Forwarded-Preferred-Username information to upstream | true |
148−| flag: `--prefer-email-to-user`<br/>toml: `prefer_email_to_user` | bool | Prefer to use the Email address as the Username when passing information to upstream. Will only use Username if Email is unavailable, e.g. htaccess authentication. Used in conjunction with `--pass-basic-auth` and `--pass-user-headers` | false |
149−| flag: `--pass-user-headers`<br/>toml: `pass_user_headers` | bool | pass X-Forwarded-User, X-Forwarded-Groups, X-Forwarded-Email and X-Forwarded-Preferred-Username information to upstream | true |
150−
151−### Logging Options
152−
153−| Flag / Config Field | Type | Description | Default |
154−| --------------------------------------------------------------------- | ------ | ---------------------------------------------------------------------------- | --------------------------------------------------- |
155−| flag: `--auth-logging-format`<br/>toml: `auth_logging_format` | string | Template for authentication log lines | see [Logging Configuration](#logging-configuration) |
156−| flag: `--auth-logging`<br/>toml: `auth_logging` | bool | Log authentication attempts | true |
157−| flag: `--errors-to-info-log`<br/>toml: `errors_to_info_log` | bool | redirects error-level logging to default log channel instead of stderr | false |
158−| flag: `--exclude-logging-path`<br/>toml: `exclude_logging_paths` | string | comma separated list of paths to exclude from logging, e.g. `"/ping,/path2"` | `""` (no paths excluded) |
159−| flag: `--logging-compress`<br/>toml: `logging_compress` | bool | Should rotated log files be compressed using gzip | false |
160−| flag: `--logging-filename`<br/>toml: `logging_filename` | string | File to log requests to, empty for `stdout` | `""` (stdout) |
161−| flag: `--logging-local-time`<br/>toml: `logging_local_time` | bool | Use local time in log files and backup filenames instead of UTC | true (local time) |
162−| flag: `--logging-max-age`<br/>toml: `logging_max_age` | int | Maximum number of days to retain old log files | 7 |
163−| flag: `--logging-max-backups`<br/>toml: `logging_max_backups` | int | Maximum number of old log files to retain; 0 to disable | 0 |
164−| flag: `--logging-max-size`<br/>toml: `logging_max_size` | int | Maximum size in megabytes of the log file before rotation | 100 |
165−| flag: `--request-id-header`<br/>toml: `request_id_header` | string | Request header to use as the request ID in logging | X-Request-Id |
166−| flag: `--request-logging-format`<br/>toml: `request_logging_format` | string | Template for request log lines | see [Logging Configuration](#logging-configuration) |
167−| flag: `--request-logging`<br/>toml: `request_logging` | bool | Log requests | true |
168−| flag: `--silence-ping-logging`<br/>toml: `silence_ping_logging` | bool | disable logging of requests to ping & ready endpoints | false |
169−| flag: `--standard-logging-format`<br/>toml: `standard_logging_format` | string | Template for standard log lines | see [Logging Configuration](#logging-configuration) |
170−| flag: `--standard-logging`<br/>toml: `standard_logging` | bool | Log standard runtime information | true |
171−
172−### Page Template Options
173−
174−| Flag / Config Field | Type | Description | Default |
175−| ----------------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------- | ------- |
176−| flag: `--banner`<br/>toml: `banner` | string | custom (html) banner string. Use `"-"` to disable default banner. | |
177−| flag: `--custom-sign-in-logo`<br/>toml: `custom_sign_in_logo` | string | path or a URL to an custom image for the sign_in page logo. Use `"-"` to disable default logo. |
178−| flag: `--custom-templates-dir`<br/>toml: `custom_templates_dir` | string | path to custom html templates | |
179−| flag: `--display-htpasswd-form`<br/>toml: `display_htpasswd_form` | bool | display username / password login form if an htpasswd file is provided | true |
180−| flag: `--footer`<br/>toml: `footer` | string | custom (html) footer string. Use `"-"` to disable default footer. (Can be used to obfuscate the version) | |
181−| flag: `--show-debug-on-error`<br/>toml: `show_debug_on_error` | bool | show detailed error information on error pages (WARNING: this may contain sensitive information - do not use in production) | false |
182−
183−### Probe Options
184−
185−| Flag / Config Field | Type | Description | Default |
186−| ------------------------------------------------------- | ------ | ---------------------------------------------------------- | ----------------------------- |
187−| flag: `--ping-path`<br/>toml: `ping_path` | string | the ping endpoint that can be used for basic health checks | `"/ping"` |
188−| flag: `--ping-user-agent`<br/>toml: `ping_user_agent` | string | a User-Agent that can be used for basic health checks | `""` (don't check user agent) |
189−| flag: `--ready-path`<br/>toml: `ready_path` | string | the ready endpoint that can be used for deep health checks | `"/ready"` |
190−| flag: `--gcp-healthchecks`<br/>toml: `gcp_healthchecks` | bool | Enable GCP/GKE healthcheck endpoints (deprecated) | false |
191−
192−### Proxy Options
193−
194−| Flag / Config Field | Type | Description | Default |
195−| ----------------------------------------------------------------------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
196−| flag: `--allow-query-semicolons`<br/>toml: `allow_query_semicolons` | bool | allow the use of semicolons in query args ([required for some legacy applications](https://github.com/golang/go/issues/25192)) | `false` |
197−| flag: `--api-route`<br/>toml: `api_routes` | string \| list | Requests to these paths must already be authenticated with a cookie, or a JWT if `--skip-jwt-bearer-tokens` is set. No redirect to login will be done. Return 401 if not. Format: path_regex | |
198−| flag: `--authenticated-emails-file`<br/>toml: `authenticated_emails_file` | string | authenticate against emails via file (one per line) | |
199−| flag: `--bearer-token-login-fallback`<br/>toml: `bearer_token_login_fallback` | bool | if `--skip-jwt-bearer-tokens` is set, if a request includes an invalid JWT (expired, malformed, missing required audiences, etc), fall back to normal login redirect as if the token were not sent at all. If false, respond 403 | true |
200−| flag: `--email-domain`<br/>toml: `email_domains` | string \| list | authenticate emails with the specified domain (may be given multiple times). Use `*` to authenticate any email | |
201−| flag: `--encode-state`<br/>toml: `encode_state` | bool | encode the state parameter as UrlEncodedBase64 | false |
202−| flag: `--extra-jwt-issuers`<br/>toml: `extra_jwt_issuers` | string | if `--skip-jwt-bearer-tokens` is set, a list of extra JWT `issuer=audience` (see a token's `iss`, `aud` fields) pairs (where the issuer URL has a `.well-known/openid-configuration` or a `.well-known/jwks.json`) | |
203−| flag: `--force-https`<br/>toml: `force_https` | bool | enforce https redirect | `false` |
204−| flag: `--force-json-errors`<br/>toml: `force_json_errors` | bool | force JSON errors instead of HTTP error pages or redirects | `false` |
205−| flag: `--htpasswd-file`<br/>toml: `htpasswd_file` | string | additionally authenticate against a htpasswd file. Entries must be created with `htpasswd -B` for bcrypt encryption | |
206−| flag: `--htpasswd-user-group`<br/>toml: `htpasswd_user_groups` | string \| list | the groups to be set on sessions for htpasswd users | |
207−| flag: `--proxy-prefix`<br/>toml: `proxy_prefix` | string | the url root path that this proxy should be nested under (e.g. /`<oauth2>/sign_in`) | `"/oauth2"` |
208−| flag: `--real-client-ip-header`<br/>toml: `real_client_ip_header` | string | Header used to determine the real IP of the client, requires `--reverse-proxy` to be set (one of: X-Forwarded-For, X-Real-IP, X-ProxyUser-IP, X-Envoy-External-Address, or CF-Connecting-IP) | X-Real-IP |
209−| flag: `--redirect-url`<br/>toml: `redirect_url` | string | the OAuth Redirect URL, e.g. `"https://internalapp.yourcompany.com/oauth2/callback"` | |
210−| flag: `--relative-redirect-url`<br/>toml: `relative_redirect_url` | bool | allow relative OAuth Redirect URL.` | false |
211−| flag: `--reverse-proxy`<br/>toml: `reverse_proxy` | bool | are we running behind a reverse proxy, controls whether headers like X-Real-IP are accepted and allows X-Forwarded-\{Proto,Host,Uri\} headers to be used on redirect selection | false |
212−| flag: `--signature-key`<br/>toml: `signature_key` | string | GAP-Signature request signature key (algorithm:secretkey) | |
213−| flag: `--skip-auth-preflight`<br/>toml: `skip_auth_preflight` | bool | will skip authentication for OPTIONS requests | false |
214−| flag: `--skip-auth-regex`<br/>toml: `skip_auth_regex` | string \| list | (DEPRECATED for `--skip-auth-route`) bypass authentication for requests paths that match (may be given multiple times) | |
215−| flag: `--skip-auth-route`<br/>toml: `skip_auth_routes` | string \| list | bypass authentication for requests that match the method & path. Format: method=path_regex OR method!=path_regex. For all methods: path_regex OR !=path_regex | |
216−| flag: `--skip-jwt-bearer-tokens`<br/>toml: `skip_jwt_bearer_tokens` | bool | will skip requests that have verified JWT bearer tokens (the token must have [`aud`](https://en.wikipedia.org/wiki/JSON_Web_Token#Standard_fields) that matches this client id or one of the extras from `extra-jwt-issuers`) | false |
217−| flag: `--skip-provider-button`<br/>toml: `skip_provider_button` | bool | will skip sign-in-page to directly reach the next step: oauth/start | false |
218−| flag: `--ssl-insecure-skip-verify`<br/>toml: `ssl_insecure_skip_verify` | bool | skip validation of certificates presented when using HTTPS providers | false |
219−| flag: `--trusted-ip`<br/>toml: `trusted_ips` | string \| list | list of IPs or CIDR ranges to allow to bypass authentication (may be given multiple times). When combined with `--reverse-proxy` and optionally `--real-client-ip-header` this will evaluate the trust of the IP stored in an HTTP header by a reverse proxy rather than the layer-3/4 remote address. WARNING: trusting IPs has inherent security flaws, especially when obtaining the IP address from an HTTP header (reverse-proxy mode). Use this option only if you understand the risks and how to manage them. | |
220−| flag: `--whitelist-domain`<br/>toml: `whitelist_domains` | string \| list | allowed domains for redirection after authentication. Prefix domain with a `.` or a `*.` to allow subdomains (e.g. `.example.com`, `*.example.com`)&nbsp;[^2] | |
221−
222−[^2]: When using the `whitelist-domain` option, any domain prefixed with a `.` or a `*.` will allow any subdomain of the specified domain as a valid redirect URL. By default, only empty ports are allowed. This translates to allowing the default port of the URL's protocol (80 for HTTP, 443 for HTTPS, etc.) since browsers omit them. To allow only a specific port, add it to the whitelisted domain: `example.com:8080`. To allow any port, use `*`: `example.com:*`.
223−
224−### Server Options
225−
226−| Flag / Config Field | Type | Description | Default |
227−| ------------------------------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
228−| flag: `--http-address`<br/>toml: `http_address` | string | `[http://]<addr>:<port>` or `unix://<path>` or `fd:<int>` (case insensitive) to listen on for HTTP clients. Square brackets are required for ipv6 address, e.g. `http://[::1]:4180` | `"127.0.0.1:4180"` |
229−| flag: `--https-address`<br/>toml: `https_address` | string | `[https://]<addr>:<port>` to listen on for HTTPS clients. Square brackets are required for ipv6 address, e.g. `https://[::1]:443` | `":443"` |
230−| flag: `--metrics-address`<br/>toml: `metrics_address` | string | the address prometheus metrics will be scraped from | `""` |
231−| flag: `--metrics-secure-address`<br/>toml: `metrics_secure_address` | string | the address prometheus metrics will be scraped from if using HTTPS | `""` |
232−| flag: `--metrics-tls-cert-file`<br/>toml: `metrics_tls_cert_file` | string | path to certificate file for secure metrics server | `""` |
233−| flag: `--metrics-tls-key-file`<br/>toml: `metrics_tls_key_file` | string | path to private key file for secure metrics server | `""` |
234−| flag: `--tls-cert-file`<br/>toml: `tls_cert_file` | string | path to certificate file | |
235−| flag: `--tls-key-file`<br/>toml: `tls_key_file` | string | path to private key file | |
236−| flag: `--tls-cipher-suite`<br/>toml: `tls_cipher_suites` | string \| list | Restricts TLS cipher suites used by server to those listed (e.g. TLS_RSA_WITH_RC4_128_SHA) (may be given multiple times). If not specified, the default Go safe cipher list is used. List of valid cipher suites can be found in the [crypto/tls documentation](https://pkg.go.dev/crypto/tls#pkg-constants). | |
237−| flag: `--tls-min-version`<br/>toml: `tls_min_version` | string | minimum TLS version that is acceptable, either `"TLS1.2"` or `"TLS1.3"` | `"TLS1.2"` |
238−
239−### Session Options
240−
241−| Flag / Config Field | Type | Description | Default |
242−| ----------------------------------------------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
243−| flag: `--session-cookie-minimal`<br/>toml: `session_cookie_minimal` | bool | strip OAuth tokens from cookie session stores if they aren't needed (cookie session store only) | false |
244−| flag: `--session-store-type`<br/>toml: `session_store_type` | string | [Session data storage backend](sessions.md); redis or cookie | cookie |
245−| flag: `--redis-cluster-connection-urls`<br/>toml: `redis_cluster_connection_urls` | string \| list | List of Redis cluster connection URLs (e.g. `redis://HOST[:PORT]`). Used in conjunction with `--redis-use-cluster` | |
246−| flag: `--redis-connection-url`<br/>toml: `redis_connection_url` | string | URL of redis server for redis session storage (e.g. `redis://HOST[:PORT]`) | |
247−| flag: `--redis-ca-path`<br/>toml: `redis_ca_path` | string | Path to a CA certificates file that should be used when connecting to redis. If not specified, the system cert pool is used instead. |
248−| flag: `--redis-insecure-skip-tls-verify`<br/>toml: `redis_insecure_skip_tls_verify` | bool | skip TLS verification when connecting to Redis | false |
249−| flag: `--redis-password`<br/>toml: `redis_password` | string | Redis password. Applicable for all Redis configurations. Will override any password set in `--redis-connection-url` | |
250−| flag: `--redis-sentinel-password`<br/>toml: `redis_sentinel_password` | string | Redis sentinel password. Used only for sentinel connection; any redis node passwords need to use `--redis-password` | |
251−| flag: `--redis-sentinel-master-name`<br/>toml: `redis_sentinel_master_name` | string | Redis sentinel master name. Used in conjunction with `--redis-use-sentinel` | |
252−| flag: `--redis-sentinel-connection-urls`<br/>toml: `redis_sentinel_connection_urls` | string \| list | List of Redis sentinel connection URLs (e.g. `redis://HOST[:PORT]`). Used in conjunction with `--redis-use-sentinel` | |
253−| flag: `--redis-use-cluster`<br/>toml: `redis_use_cluster` | bool | Connect to redis cluster. Must set `--redis-cluster-connection-urls` to use this feature | false |
254−| flag: `--redis-use-sentinel`<br/>toml: `redis_use_sentinel` | bool | Connect to redis via sentinels. Must set `--redis-sentinel-master-name` and `--redis-sentinel-connection-urls` to use this feature | false |
255−| flag: `--redis-connection-idle-timeout`<br/>toml: `redis_connection_idle_timeout` | int | Redis connection idle timeout seconds. If Redis [timeout](https://redis.io/docs/reference/clients/#client-timeouts) option is set to non-zero, the `--redis-connection-idle-timeout` must be less than Redis timeout option. Example: if either redis.conf includes `timeout 15` or using `CONFIG SET timeout 15` the `--redis-connection-idle-timeout` must be at least `--redis-connection-idle-timeout=14` | 0 |
256−
257−### Upstream Options
258−
259−| Flag / Config Field | Type | Description | Default |
260−| ----------------------------------------------------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------- |
261−| flag: `--flush-interval`<br/>toml: `flush_interval` | duration | period between flushing response buffers when streaming responses | `"1s"` |
262−| flag: `--pass-host-header`<br/>toml: `pass_host_header` | bool | pass the request Host Header to upstream | true |
263−| flag: `--proxy-websockets`<br/>toml: `proxy_websockets` | bool | enables WebSocket proxying | true |
264−| flag: `--ssl-upstream-insecure-skip-verify`<br/>toml: `ssl_upstream_insecure_skip_verify` | bool | skip validation of certificates presented when using HTTPS upstreams | false |
265−| flag: `--disable-keep-alives`<br/>toml: `disable_keep_alives` | bool | disable HTTP keep-alive connections to the upstream server | false |
266−| flag: `--upstream-timeout`<br/>toml: `upstream_timeout` | duration | maximum amount of time the server will wait for a response from the upstream | 30s |
267−| flag: `--upstream`<br/>toml: `upstreams` | string \| list | the http url(s) of the upstream endpoint, file:// paths for static files or `static://<status_code>` for static response. Routing is based on the path | |
268−
269−## Upstreams Configuration
270−
271−`oauth2-proxy` supports having multiple upstreams, and has the option to pass requests on to HTTP(S) servers, unix socket or serve static files from the file system.
272−
273−To configure **HTTP and HTTPS upstreams**, provide such a URL in `--upstream=URL`. The scheme+host portion and the path portion are extracted to configure proxying behavior. When processing incoming requests, the path portion becomes a lookup key for selecting the destination server of the proxied request.
274−
275−* Upstream URLs *without a trailing slash,* like in `--upstream=http://service2.internal/foo`, will match an incoming request exactly to `/foo` in `https://this.o2p.example.com/foo`, and forward the request on to service2.internal, but not match a request to `https://this.o2p.example.com/foo/more` nor ...`.com/food`.
276−* Upstream URLs *with a trailing slash,* like in `--upstream=http://service1.internal/foo/`, will match any incoming request to any incoming requests's path *starting with* `/foo/`, like `/foo/` and `/foo/more` and `/foo/lots/more?etc`.
277−
278−If multiple `--upstream` URLs' paths match an incoming request, the one with the longest matching path (the most specific match) takes priority over shorter (less specific) ones.
279−
280−**Unix socket upstreams** are configured as `unix:///path/to/unix.sock`.
281−
282−**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, e.g. `file:///var/www/static/#/static/` will make `/var/www/static/` available at `http://[oauth2-proxy url]/static/`.
283−
284−Multiple upstreams can either be configured by supplying a comma separated list to the `--upstream` parameter, supplying the parameter multiple times or providing 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.
285−
286−## Environment variables
287−
288−Every command line argument can be specified as an environment variable by
289−prefixing it with `OAUTH2_PROXY_`, capitalising it, and replacing hyphens (`-`)
290−with underscores (`_`). If the argument can be specified multiple times, the
291−environment variable should be plural (trailing `S`).
292−
293−This is particularly useful for storing secrets outside a configuration file
294−or the command line.
295−
296−For example, the `--cookie-secret` flag becomes `OAUTH2_PROXY_COOKIE_SECRET`.
297−If a flag has the type `string | list` like the `--email-domain` flag it is
298−available as an environment variable in plural form e.g. `OAUTH2_PROXY_EMAIL_DOMAINS`
299−
300−Values for type `string | list` usually have a plural environment variable name
301−and need to be seperated by `,` e.g.
302−`OAUTH2_PROXY_SKIP_AUTH_ROUTES="GET=^/api/status,POST=^/api/saved_objects/_import"`
303−
304−Please check the type for each [config option](#config-options) first.
305−
306−## Logging Configuration
307−
308−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.
309−
310−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`).
311−
312−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`.
313−
314−Each type of logging has its own configurable format and variables. By default, these formats are similar to the Apache Combined Log.
315−
316−Logging of requests to the `/ping` endpoint (or using `--ping-user-agent`) and the `/ready` endpoint can be disabled with `--silence-ping-logging` reducing log volume.
317−
318−## Auth Log Format
319−
320−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:
321−
322−```
323−<REMOTE_ADDRESS> - <REQUEST ID> - <user@domain.com> [2015/03/19 17:20:19] [<STATUS>] <MESSAGE>
324−```
325−
326−The status block will contain one of the below strings:
327−
328−- `AuthSuccess` If a user has authenticated successfully by any method
329−- `AuthFailure` If the user failed to authenticate explicitly
330−- `AuthError` If there was an unexpected error during authentication
331−
332−If you require a different format than that, you can configure it with the `--auth-logging-format` flag.
333−The default format is configured as follows:
334−
335−```
336−{{.Client}} - {{.RequestID}} - {{.Username}} [{{.Timestamp}}] [{{.Status}}] {{.Message}}
337−```
338−
339−Available variables for auth logging:
340−
341−| Variable | Example | Description |
342−| ------------- | ------------------------------------ | -------------------------------------------------------------------------------------------------------- |
343−| Client | 74.125.224.72 | The client/remote IP address. Will use the X-Real-IP header it if exists & reverse-proxy is set to true. |
344−| Host | domain.com | The value of the Host header. |
345−| Message | Authenticated via OAuth2 | The details of the auth attempt. |
346−| Protocol | HTTP/1.0 | The request protocol. |
347−| RequestID | 00010203-0405-4607-8809-0a0b0c0d0e0f | The request ID pulled from the `--request-id-header`. Random UUID if empty |
348−| RequestMethod | GET | The request method. |
349−| Timestamp | 2015/03/19 17:20:19 | The date and time of the logging event. |
350−| UserAgent | - | The full user agent as reported by the requesting client. |
351−| Username | username@email.com | The email or username of the auth request. |
352−| Status | AuthSuccess | The status of the auth request. See above for details. |
353−
354−## Request Log Format
355−
356−HTTP request logs will output by default in the below format:
357−
358−```
359−<REMOTE_ADDRESS> - <REQUEST ID> - <user@domain.com> [2015/03/19 17:20:19] <HOST_HEADER> GET <UPSTREAM_HOST> "/path/" HTTP/1.1 "<USER_AGENT>" <RESPONSE_CODE> <RESPONSE_BYTES> <REQUEST_DURATION>
360−```
361−
362−If you require a different format than that, you can configure it with the `--request-logging-format` flag.
363−The default format is configured as follows:
364−
365−```
366−{{.Client}} - {{.RequestID}} - {{.Username}} [{{.Timestamp}}] {{.Host}} {{.RequestMethod}} {{.Upstream}} {{.RequestURI}} {{.Protocol}} {{.UserAgent}} {{.StatusCode}} {{.ResponseSize}} {{.RequestDuration}}
367−```
368−
369−Available variables for request logging:
370−
371−| Variable | Example | Description |
372−| --------------- | ------------------------------------ | -------------------------------------------------------------------------------------------------------- |
373−| Client | 74.125.224.72 | The client/remote IP address. Will use the X-Real-IP header it if exists & reverse-proxy is set to true. |
374−| Host | domain.com | The value of the Host header. |
375−| Protocol | HTTP/1.0 | The request protocol. |
376−| RequestDuration | 0.001 | The time in seconds that a request took to process. |
377−| RequestID | 00010203-0405-4607-8809-0a0b0c0d0e0f | The request ID pulled from the `--request-id-header`. Random UUID if empty |
378−| RequestMethod | GET | The request method. |
379−| RequestURI | "/oauth2/auth" | The URI path of the request. |
380−| ResponseSize | 12 | The size in bytes of the response. |
381−| StatusCode | 200 | The HTTP status code of the response. |
382−| Timestamp | 2015/03/19 17:20:19 | The date and time of the logging event. |
383−| Upstream | - | The upstream data of the HTTP request. |
384−| UserAgent | - | The full user agent as reported by the requesting client. |
385−| Username | username@email.com | The email or username of the auth request. |
386−
387−## Standard Log Format
388−
389−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:
390−
391−```
392−[2015/03/19 17:20:19] [main.go:40] <MESSAGE>
393−```
394−
395−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:
396−
397−```
398−[{{.Timestamp}}] [{{.File}}] {{.Message}}
399−```
400−
401−Available variables for standard logging:
402−
403−| Variable | Example | Description |
404−| --------- | --------------------------------- | -------------------------------------------------- |
405−| Timestamp | 2015/03/19 17:20:19 | The date and time of the logging event. |
406−| File | main.go:40 | The file and line number of the logging statement. |
407−| Message | HTTP: listening on 127.0.0.1:4180 | The details of the log statement. |
docs/versioned_docs/version-7.14.x/configuration/providers/adfs.mddeleted−19
@@ -1,19 +0,0 @@
1−---
2−id: adfs
3−title: ADFS
4−---
5−
6−1. Open the ADFS administration console on your Windows Server and add a new Application Group
7−2. Provide a name for the integration, select Server Application from the Standalone applications section and click Next
8−3. Follow the wizard to get the client-id, client-secret and configure the application credentials
9−4. Configure the proxy with
10−
11−```
12− --provider=adfs
13− --client-id=<application ID from step 3>
14− --client-secret=<value from step 3>
15−```
16−
17−Note: When using the ADFS Auth provider with nginx and the cookie session store you may find the cookie is too large and
18−doesn't get passed through correctly. Increasing the proxy_buffer_size in nginx or implementing the
19−[redis session storage](../sessions.md#redis-storage) should resolve this.
docs/versioned_docs/version-7.14.x/configuration/providers/bitbucket.mddeleted−25
@@ -1,25 +0,0 @@
1−---
2−id: bitbucket
3−title: BitBucket
4−---
5−
6−1. [Add a new OAuth consumer](https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html)
7− * In "Callback URL" use `https://<oauth2-proxy>/oauth2/callback`, substituting `<oauth2-proxy>` with the actual
8− hostname that oauth2-proxy is running on.
9− * In Permissions section select:
10− * Account -> Email
11− * Team membership -> Read
12− * Repositories -> Read
13−2. Note the Client ID and Client Secret.
14−
15−To use the provider, pass the following options:
16−
17−```
18− --provider=bitbucket
19− --client-id=<Client ID>
20− --client-secret=<Client Secret>
21−```
22−
23−The default configuration allows everyone with Bitbucket account to authenticate. To restrict the access to the team
24−members use additional configuration option: `--bitbucket-team=<Team name>`. To restrict the access to only these users
25−who have access to one selected repository use `--bitbucket-repository=<Repository name>`.
docs/versioned_docs/version-7.14.x/configuration/providers/cidaas.mddeleted−37
@@ -1,37 +0,0 @@
1−---
2−id: cidaas
3−title: Cidaas
4−---
5−
6−[Cidaas](https://www.cidaas.com/) is an Identity as a Service (IDaaS) solution that provides authentication and authorization services.
7−It supports various protocols including OpenID Connect, OAuth 2.0, and SAML.
8−
9−However, Cidaas provides groups and their roles as hierarchical claims, which are not supported by oauth2-proxy yet.
10−The Cidaas provider transforms the hierarchical claims into a flat list of groups, which can be used by oauth2-proxy.
11−
12−Example of groups and roles in Cidaas:
13−
14−```json
15−{
16− "groups": [
17− {
18− "groupId": "group1",
19− "roles": ["role1", "role2"]
20− },
21− {
22− "groupId": "group2",
23− "roles": ["role3"]
24− }
25− ]
26−}
27−```
28−
29−This will be transformed into a flat list of groups:
30−
31−```json
32−{
33− "groups": ["group1:role1", "group2:role2", "group2:role3"]
34−}
35−```
36−
37−Apart from that the Cidaas provider inherits all the features of the [OpenID Connect provider](openid_connect.md).
docs/versioned_docs/version-7.14.x/configuration/providers/cisco_duo.mddeleted−44
@@ -1,44 +0,0 @@
1−---
2−id: cisco_duo
3−title: Cisco Duo
4−---
5−
6−Cisco Duo SSO can be configured with OAuth2 Proxy using the OIDC provider.
7−
8−1. Create a new **Generic OIDC Relying Party - Single Sign-On** application in the Duo Admin Portal
9−2. Configure OAuth2 Proxy with the following options:
10−
11−```
12−provider = "oidc"
13−provider_display_name = "Duo SSO"
14−scope = "openid email profile"
15−pass_access_token = true
16−code_challenge_method = "S256"
17−```
18−
19−3. Configure Provider endpoints. Copy the following values from the corresponding fields in the Duo Admin Portal:
20−
21−```
22−# Copy from "Client ID" field
23−client_id = "XXXXXXXX"
24−
25−# Copy from "Client Secret" field
26−client_secret = "XXXXXXXX"
27−
28−# Copy from "Issuer" field
29−oidc_issuer_url = "https://sso-xxxxxxxx.sso.duosecurity.com/oidc/xxxxxxxx"
30−
31−# Copy from "JWKS URL" field
32−oidc_jwks_url = "https://sso-xxxxxxxx.sso.duosecurity.com/oidc/xxxxxxxx/jwks"
33−
34−# Copy from "Token Introspection URL" field
35−validate_url = "https://sso-xxxxxxxx.sso.duosecurity.com/oidc/xxxxxxxx/token_introspection"
36−
37−# Copy from "UserInfo" field
38−profile_url = "https://sso-xxxxxxxx.sso.duosecurity.com/oidc/xxxxxxxx/userinfo"
39−
40−# Copy from "Token URL" field
41−redeem_url = "https://sso-xxxxxxxx.sso.duosecurity.com/oidc/xxxxxxxx/token"
42−```
43−
44−4. Complete Configuration by filling in any remaining required fields and save your configuration.
docs/versioned_docs/version-7.14.x/configuration/providers/digitalocean.mddeleted−21
@@ -1,21 +0,0 @@
1−---
2−id: digitalocean
3−title: DigitalOcean
4−---
5−
6−1. [Create a new OAuth application](https://cloud.digitalocean.com/account/api/applications)
7− * You can fill in the name, homepage, and description however you wish.
8− * In the "Application callback URL" field, enter: `https://oauth-proxy/oauth2/callback`, substituting `oauth2-proxy`
9− with the actual hostname that oauth2-proxy is running on. The URL must match oauth2-proxy's configured redirect URL.
10−2. Note the Client ID and Client Secret.
11−
12−To use the provider, pass the following options:
13−
14−```
15− --provider=digitalocean
16− --client-id=<Client ID>
17− --client-secret=<Client Secret>
18−```
19−
20−Alternatively, set the equivalent options in the config file. The redirect URL defaults to
21−`https://<requested host header>/oauth2/callback`. If you need to change it, you can use the `--redirect-url` command-line option.
docs/versioned_docs/version-7.14.x/configuration/providers/facebook.mddeleted−7
@@ -1,7 +0,0 @@
1−---
2−id: facebook
3−title: Facebook
4−---
5−
6−1. Create a new FB App from https://developers.facebook.com/
7−2. Under FB Login, set your Valid OAuth redirect URIs to `https://internal.yourcompany.com/oauth2/callback`
docs/versioned_docs/version-7.14.x/configuration/providers/gitea.mddeleted−24
@@ -1,24 +0,0 @@
1−---
2−id: gitea
3−title: Gitea / Forgejo
4−---
5−
6−:::note
7−This is not actually a fully serparate provider. For more details and options please refer to the [GitHub Provider Options](github.md)
8−:::
9−
10−1. Create a new application: `https://< your gitea host >/user/settings/applications`
11−2. Under `Redirect URI` enter the correct URL i.e. `https://<proxied host>/oauth2/callback`
12−3. Note the Client ID and Client Secret.
13−4. Pass the following options to the proxy:
14−
15−```
16− --provider="github"
17− --redirect-url="https://<proxied host>/oauth2/callback"
18− --provider-display-name="Gitea"
19− --client-id="< client_id as generated by Gitea >"
20− --client-secret="< client_secret as generated by Gitea >"
21− --login-url="https://< your gitea host >/login/oauth/authorize"
22− --redeem-url="https://< your gitea host >/login/oauth/access_token"
23− --validate-url="https://< your gitea host >/api/v1/user/emails"
24−```
docs/versioned_docs/version-7.14.x/configuration/providers/github.mddeleted−81
@@ -1,81 +0,0 @@
1−---
2−id: github
3−title: GitHub
4−---
5−
6−## Config Options
7−
8−| Flag | Toml Field | Type | Description | Default |
9−| ---------------- | -------------- | -------------- | ------------------------------------------------------------------------------------------------------------- | ------- |
10−| `--github-org` | `github_org` | string | restrict logins to members of this organisation | |
11−| `--github-team` | `github_team` | string | restrict logins to members of any of these teams (slug) or (org:team), comma separated | |
12−| `--github-repo` | `github_repo` | string | restrict logins to collaborators of this repository formatted as `orgname/repo` | |
13−| `--github-token` | `github_token` | string | the token to use when verifying repository collaborators (must have push access to the repository) | |
14−| `--github-user` | `github_users` | string \| list | To allow users to login by username even if they do not belong to the specified org and team or collaborators | |
15−
16−## Usage
17−
18−1. Create a new project: https://github.com/settings/developers
19−2. Under `Authorization callback URL` enter the correct url ie `https://internal.yourcompany.com/oauth2/callback`
20−
21−The GitHub auth provider supports two additional ways to restrict authentication to either organization and optional
22−team level access, or to collaborators of a repository. Restricting by these options is normally accompanied with `--email-domain=*`. Additionally, all the organizations and teams a user belongs to are set as part of the `X-Forwarded-Groups` header. e.g. `org1:team1,org1:team2,org2:team1`
23−
24−NOTE: When `--github-user` is set, the specified users are allowed to log in even if they do not belong to the specified
25−org and team or collaborators.
26−
27−To restrict access to your organization:
28−
29−```shell
30− # restrict logins to members of this organisation
31− --github-org="your-org"
32−```
33−
34−To restrict access to specific teams within an organization:
35−
36−```shell
37− --github-org="your-org"
38− # restrict logins to members of any of these teams (slug), comma separated
39− --github-team="team1,team2,team3"
40−```
41−
42−To restrict to teams within different organizations, keep the organization flag empty and use `--github-team` like so:
43−
44−```shell
45− # keep empty
46− --github-org=""
47− # restrict logins to members to any of the following teams (format <org>:<slug>, like octo:team1), comma separated
48− --github-team="org1:team1,org2:team1,org3:team42,octo:cat"
49−```
50−
51−If you would rather restrict access to collaborators of a repository, those users must either have push access to a
52−public repository or any access to a private repository:
53−
54−```shell
55− # restrict logins to collaborators of this repository formatted as orgname/repo
56− --github-repo=""
57−```
58−
59−If you'd like to allow access to users with **read only** access to a **public** repository you will need to provide a
60−[token](https://github.com/settings/tokens) for a user that has write access to the repository. The token must be
61−created with at least the `public_repo` scope:
62−
63−```shell
64− # the token to use when verifying repository collaborators
65− --github-token=""
66−```
67−
68−To allow a user to log in with their username even if they do not belong to the specified org and team or collaborators:
69−
70−```shell
71− # allow logins by username, comma separated
72− --github-user=""
73−```
74−
75−If you are using GitHub enterprise, make sure you set the following to the appropriate url:
76−
77−```shell
78− --login-url="http(s)://<enterprise github host>/login/oauth/authorize"
79− --redeem-url="http(s)://<enterprise github host>/login/oauth/access_token"
80− --validate-url="http(s)://<enterprise github host>/api/v3"
81−```
docs/versioned_docs/version-7.14.x/configuration/providers/gitlab.mddeleted−49
@@ -1,49 +0,0 @@
1−---
2−id: gitlab
3−title: GitLab
4−---
5−
6−## Config Options
7−
8−| Flag | Toml Field | Type | Description | Default |
9−| ------------------- | ----------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
10−| `--gitlab-group` | `gitlab_groups` | string \| list | restrict logins to members of any of these groups (slug), separated by a comma | |
11−| `--gitlab-project` | `gitlab_projects` | string \| list | restrict logins to members of any of these projects (may be given multiple times) formatted as `orgname/repo=accesslevel`. Access level should be a value matching [Gitlab access levels](https://docs.gitlab.com/ee/api/members.html#valid-access-levels), defaulted to 20 if absent | |
12−
13−## Usage
14−
15−This auth provider has been tested against Gitlab version 12.X. Due to Gitlab API changes, it may not work for version
16−prior to 12.X (see [994](https://github.com/oauth2-proxy/oauth2-proxy/issues/994)).
17−
18−Whether you are using GitLab.com or self-hosting GitLab, follow
19−[these steps to add an application](https://docs.gitlab.com/integration/oauth_provider/). Make sure to enable at
20−least the `openid`, `profile` and `email` scopes, and set the redirect url to your application url e.g.
21−https://myapp.com/oauth2/callback.
22−
23−If you need projects filtering, add the extra `read_api` scope to your application.
24−
25−The following config should be set to ensure that the oauth will work properly. To get a cookie secret follow
26−[these steps](../overview.md#generating-a-cookie-secret)
27−
28−```
29− --provider="gitlab"
30− --redirect-url="https://myapp.com/oauth2/callback" // Should be the same as the redirect url for the application in gitlab
31− --client-id=GITLAB_CLIENT_ID
32− --client-secret=GITLAB_CLIENT_SECRET
33− --cookie-secret=COOKIE_SECRET
34−```
35−
36−Restricting by group membership is possible with the following option:
37−
38−```shell
39− --gitlab-group="mygroup,myothergroup" # restrict logins to members of any of these groups (slug), separated by a comma
40−```
41−
42−If you are using self-hosted GitLab, make sure you set the following to the appropriate URL:
43−
44−```shell
45− --oidc-issuer-url="<your gitlab url>"
46−```
47−
48−If your self-hosted GitLab is on a subdirectory (e.g. domain.tld/gitlab), as opposed to its own subdomain
49−(e.g. gitlab.domain.tld), you may need to add a redirect from domain.tld/oauth pointing at e.g. domain.tld/gitlab/oauth.
docs/versioned_docs/version-7.14.x/configuration/providers/google.mddeleted−84
@@ -1,84 +0,0 @@
1−---
2−id: google
3−title: Google (default)
4−---
5−
6−## Config Options
7−
8−| Flag | Toml Field | Type | Description | Default |
9−|-------------------------------------------------|----------------------------------------------| ------ |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------|
10−| `--google-admin-email` | `google_admin_email` | string | the google admin to impersonate for api calls | |
11−| `--google-group` | `google_groups` | string | restrict logins to members of this google group (may be given multiple times). If not specified and service account or default credentials are configured, all user groups will be allowed. | |
12−| `--google-service-account-json` | `google_service_account_json` | string | the path to the service account json credentials | |
13−| `--google-use-application-default-credentials` | `google_use_application_default_credentials` | bool | use application default credentials instead of service account json (i.e. GKE Workload Identity) | |
14−| `--google-target-principal` | `google_target_principal` | bool | the target principal to impersonate when using ADC | defaults to the service account configured for ADC |
15−| `--google-use-organization-id` | `google_use_organization_id` | bool | use organization id as preferred username | false |
16−| `--google-admin-api-user-scope` | `google_admin_api_user_scope` | string | the OAuth scope to use when querying the Google Admin SDK for organization id, can be 'readonly', 'user' or 'cloud'<br/> | `readonly` |
17−
18−## Usage
19−
20−For Google, the registration steps are:
21−
22−1. Create a new project: https://console.developers.google.com/project
23−2. Choose the new project from the top right project dropdown (only if another project is selected)
24−3. In the project Dashboard center pane, choose **"APIs & Services"**
25−4. In the left Nav pane, choose **"Credentials"**
26−5. In the center pane, choose **"OAuth consent screen"** tab. Fill in **"Product name shown to users"** and hit save.
27−6. In the center pane, choose **"Credentials"** tab.
28− - Open the **"New credentials"** drop down
29− - Choose **"OAuth client ID"**
30− - Choose **"Web application"**
31− - Application name is freeform, choose something appropriate
32− - Authorized JavaScript origins is your domain ex: `https://internal.yourcompany.com`
33− - Authorized redirect URIs is the location of oauth2/callback ex: `https://internal.yourcompany.com/oauth2/callback`
34− - Choose **"Create"**
35−7. Take note of the **Client ID** and **Client Secret**
36−
37−It's recommended to refresh sessions on a short interval (1h) with `cookie-refresh` setting which validates that the
38−account is still authorized.
39−
40−#### Restrict auth to specific Google groups on your domain. (optional)
41−
42−1. Create a [service account](https://developers.google.com/identity/protocols/oauth2/service-account) and configure it
43− to use [Application Default Credentials / Workload Identity / Workload Identity Federation (recommended)](#using-application-default-credentials-adc--workload-identity--workload-identity-federation-recommended) or,
44− alternatively download the JSON.
45−2. Make note of the Client ID for a future step.
46−3. Under "APIs & Auth", choose APIs.
47−4. Click on Admin SDK and then Enable API.
48−5. Follow the steps on [Set up domain-wide delegation for a service account](https://developers.google.com/workspace/guides/create-credentials#optional_set_up_domain-wide_delegation_for_a_service_account)
49− and give the client id from step 2 the following oauth scopes:
50−
51− ```
52− https://www.googleapis.com/auth/admin.directory.group.member.readonly
53− ```
54−
55−6. Follow the steps on https://support.google.com/a/answer/60757 to enable Admin API access.
56−7. Create or choose an existing administrative email address on the Gmail domain to assign to the `google-admin-email`
57− flag. This email will be impersonated by this client to make calls to the Admin SDK. See the note on the link from
58− step 5 for the reason why.
59−8. Create or choose an existing email group and set that email to the `google-group` flag. You can pass multiple instances
60− of this flag with different groups and the user will be checked against all the provided groups.
61−
62−(Only if using a JSON file (see step 1))
63−
64−9. Lock down the permissions on the json file downloaded from step 1 so only oauth2-proxy is able to read the file and
65− set the path to the file in the `google-service-account-json` flag.
66−10. Restart oauth2-proxy.
67−
68−Note: The user is checked against the group members list on initial authentication and every time the token is
69−refreshed ( about once an hour ).
70−
71−##### Using Application Default Credentials (ADC) / Workload Identity / Workload Identity Federation (recommended)
72−oauth2-proxy can make use of [Application Default Credentials](https://cloud.google.com/docs/authentication/application-default-credentials).
73−When deployed within GCP, this means that it can automatically use the service account attached to the resource. When deployed to GKE, ADC
74−can be leveraged through a feature called Workload Identity. Follow Google's [guide](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity)
75−to set up Workload Identity.
76−
77−When deployed outside of GCP, [Workload Identity Federation](https://cloud.google.com/docs/authentication/provide-credentials-adc#wlif) might be an option.
78−
79−##### Using Organization ID as Preferred Username (optional)
80−By default, the google provider uses the google id as username. If you would like to use an organization id instead, you can set the `google-use-organization-id` flag to true.
81−This requires that the service account used to query the Google Admin SDK has one of the following scopes granted in step 5 above:
82−- `https://www.googleapis.com/auth/admin.directory.user.readonly`,
83−- `https://www.googleapis.com/auth/admin.directory.user`
84−- `https://www.googleapis.com/auth/cloud-platform`
docs/versioned_docs/version-7.14.x/configuration/providers/index.mddeleted−46
@@ -1,46 +0,0 @@
1−---
2−id: index
3−title: OAuth Provider Configuration
4−---
5−
6−You will need to register an OAuth application with a Provider (Google, GitHub or another provider), and configure it
7−with Redirect URI(s) for the domain you intend to run `oauth2-proxy` on.
8−
9−Valid providers are :
10−
11−- [ADFS](adfs.md)
12−- [Bitbucket](bitbucket.md)
13−- [Cidaas](cidaas.md)
14−- [CiscoDuo](cisco_duo.md)
15−- [DigitalOcean](digitalocean.md)
16−- [Facebook](facebook.md)
17−- [Gitea](gitea.md)
18−- [GitHub](github.md)
19−- [GitLab](gitlab.md)
20−- [Google](google.md) _default_
21−- [Keycloak](keycloak.md) (Deprecated)
22−- [Keycloak OIDC](keycloak_oidc.md)
23−- [LinkedIn](linkedin.md)
24−- [login.gov](login_gov.md)
25−- [Microsoft Azure](ms_azure_ad.md) (Deprecated)
26−- [Microsoft Entra ID](ms_entra_id.md)
27−- [Nextcloud](nextcloud.md)
28−- [OpenID Connect](openid_connect.md)
29−- [SourceHut](sourcehut.md)
30−
31−The provider can be selected using the `provider` configuration value, or set in the [`providers` array using AlphaConfig](https://oauth2-proxy.github.io/oauth2-proxy/configuration/alpha-config#providers). However, [**the feature to implement multiple providers is not complete**](https://github.com/oauth2-proxy/oauth2-proxy/issues/926).
32−
33−Please note that not all providers support all claims. The `preferred_username` claim is currently only supported by the
34−OpenID Connect provider.
35−
36−## Email Authentication
37−
38−To authorize a specific email-domain use `--email-domain=yourcompany.com`. To authorize individual email addresses use
39−`--authenticated-emails-file=/path/to/file` with one email per line. To authorize all email addresses use `--email-domain=*`.
40−
41−## Adding a new Provider
42−
43−Follow the examples in the [`providers` package](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/providers/) to define a new
44−`Provider` instance. Add a new `case` to
45−[`providers.New()`](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/providers/providers.go) to allow `oauth2-proxy` to use the
46−new `Provider`.
docs/versioned_docs/version-7.14.x/configuration/providers/keycloak.mddeleted−36
@@ -1,36 +0,0 @@
1−---
2−id: keycloak
3−title: Keycloak (Deprecated)
4−---
5−
6−:::note
7−This is the legacy and deprecated provider for Keycloak, use [Keycloak OIDC Auth Provider](keycloak_oidc.md) if possible.
8−:::
9−
10−1. Create new client in your Keycloak realm with **Access Type** 'confidential' and **Valid Redirect URIs** 'https://internal.yourcompany.com/oauth2/callback'
11−2. Take note of the Secret in the credential tab of the client
12−3. Create a mapper with **Mapper Type** 'Group Membership' and **Token Claim Name** 'groups'.
13−
14−Make sure you set the following to the appropriate url:
15−
16−```
17− --provider=keycloak
18− --client-id=<client you have created>
19− --client-secret=<your client's secret>
20− --login-url="http(s)://<keycloak host>/auth/realms/<your realm>/protocol/openid-connect/auth"
21− --redeem-url="http(s)://<keycloak host>/auth/realms/<your realm>/protocol/openid-connect/token"
22− --profile-url="http(s)://<keycloak host>/auth/realms/<your realm>/protocol/openid-connect/userinfo"
23− --validate-url="http(s)://<keycloak host>/auth/realms/<your realm>/protocol/openid-connect/userinfo"
24− --keycloak-group=<first_allowed_user_group>
25− --keycloak-group=<second_allowed_user_group>
26−```
27−
28−For group based authorization, the optional `--keycloak-group` (legacy) or `--allowed-group` (global standard)
29−flags can be used to specify which groups to limit access to.
30−
31−If these are unset but a `groups` mapper is set up above in step (3), the provider will still
32−populate the `X-Forwarded-Groups` header to your upstream server with the `groups` data in the
33−Keycloak userinfo endpoint response.
34−
35−The group management in keycloak is using a tree. If you create a group named admin in keycloak
36−you should define the 'keycloak-group' value to /admin.
docs/versioned_docs/version-7.14.x/configuration/providers/keycloak_oidc.mddeleted−151
@@ -1,151 +0,0 @@
1−---
2−id: keycloak_oidc
3−title: Keycloak OIDC
4−---
5−
6−## Config Options
7−
8−| Flag | Toml Field | Type | Description | Default |
9−| ---------------- | --------------- | -------------- | ------------------------------------------------------------------------------------------------------------------ | ------- |
10−| `--allowed-role` | `allowed_roles` | string \| list | restrict logins to users with this role (may be given multiple times). Only works with the keycloak-oidc provider. | |
11−
12−## Usage
13−
14−```
15− --provider=keycloak-oidc
16− --client-id=<your client's id>
17− --client-secret=<your client's secret>
18− --redirect-url=https://internal.yourcompany.com/oauth2/callback
19− --oidc-issuer-url=https://<keycloak host>/realms/<your realm> // For Keycloak versions <17: --oidc-issuer-url=https://<keycloak host>/auth/realms/<your realm>
20− --email-domain=<yourcompany.com> // Validate email domain for users, see option documentation
21− --allowed-role=<realm role name> // Optional, required realm role
22− --allowed-role=<client id>:<client role name> // Optional, required client role
23− --allowed-group=</group name> // Optional, requires group client scope
24− --code-challenge-method=S256 // PKCE
25−```
26−
27−:::note
28−Keycloak has updated its admin console and as of version 19.0.0, the new admin console is enabled by default. The
29−legacy admin console has been announced for removal with the release of version 21.0.0.
30−:::
31−
32−**Keycloak legacy admin console**
33−
34−1. Create new client in your Keycloak realm with **Access Type** 'confidential', **Client protocol** 'openid-connect'
35− and **Valid Redirect URIs** 'https://internal.yourcompany.com/oauth2/callback'
36−2. Take note of the Secret in the credential tab of the client
37−3. Create a mapper with **Mapper Type** 'Group Membership' and **Token Claim Name** 'groups'.
38−4. Create a mapper with **Mapper Type** 'Audience' and **Included Client Audience** and **Included Custom Audience** set
39− to your client name.
40−
41−**Keycloak new admin console (default as of v19.0.0)**
42−
43−The following example shows how to create a simple OIDC client using the new Keycloak admin2 console. However, for best
44−practices, it is recommended to consult the Keycloak documentation.
45−
46−The OIDC client must be configured with an _audience mapper_ to include the client's name in the `aud` claim of the JWT token.
47−The `aud` claim specifies the intended recipient of the token, and OAuth2 Proxy expects a match against the values of
48−either `--client-id` or `--oidc-extra-audience`.
49−
50−_In Keycloak, claims are added to JWT tokens through the use of mappers at either the realm level using "client scopes" or
51−through "dedicated" client mappers._
52−
53−**Creating the client**
54−
55−1. Create a new OIDC client in your Keycloak realm by navigating to:
56− **Clients** -> **Create client**
57− * **Client Type** 'OpenID Connect'
58− * **Client ID** `<your client's id>`, please complete the remaining fields as appropriate and click **Next**.
59− * **Client authentication** 'On'
60− * **Authentication flow**
61− * **Standard flow** 'selected'
62− * **Direct access grants** 'deselect'
63− * _Save the configuration._
64− * **Settings / Access settings**:
65− * **Valid redirect URIs** `https://internal.yourcompany.com/oauth2/callback`
66− * _Save the configuration._
67− * Under the **Credentials** tab you will now be able to locate `<your client's secret>`.
68−2. Configure a dedicated *audience mapper* for your client by navigating to **Clients** -> **\<your client's id\>** -> **Client scopes**.
69−* Access the dedicated mappers pane by clicking **\<your client's id\>-dedicated**, located under *Assigned client scope*.
70− _(It should have a description of "Dedicated scope and mappers for this client")_
71− * Click **Configure a new mapper** and select **Audience**
72− * **Name** 'aud-mapper-\<your client's id\>'
73− * **Included Client Audience** select `<your client's id>` from the dropdown.
74− * _OAuth2 proxy can be set up to pass both the access and ID JWT tokens to your upstream services.
75− If you require additional audience entries, you can use the **Included Custom Audience** field in addition
76− to the "Included Client Audience" dropdown. Note that the "aud" claim of a JWT token should be limited and
77− only specify its intended recipients._
78− * **Add to ID token** 'On'
79− * **Add to access token** 'On' - [#1916](https://github.com/oauth2-proxy/oauth2-proxy/pull/1916)
80− * _Save the configuration._
81−* Any subsequent dedicated client mappers can be defined by clicking **Dedicated scopes** -> **Add mapper** ->
82− **By configuration** -> *Select mapper*
83−
84−You should now be able to create a test user in Keycloak and get access to the OAuth2 Proxy instance, make sure to set
85−an email address matching `<yourcompany.com>` and select _Email verified_.
86−
87−**Authorization**
88−
89−_OAuth2 Proxy will perform authorization by requiring a valid user, this authorization can be extended to take into
90−account a user's membership in Keycloak `groups`, `realm roles`, and `client roles` using the keycloak-oidc provider options
91−`--allowed-role` or `--allowed-group`_
92−
93−**Roles**
94−
95−_A standard Keycloak installation comes with the required mappers for **realm roles** and **client roles** through the
96−pre-defined client scope "roles". This ensures that any roles assigned to a user are included in the `JWT` tokens when
97−using an OIDC client that has the "Full scope allowed" feature activated, the feature is enabled by default._
98−
99−_Creating a realm role_
100−* Navigate to **Realm roles** -> **Create role**
101− * **Role name**, *`<realm role name>`* -> **save**
102−
103−_Creating a client role_
104−* Navigate to **Clients** -> `<your client's id>` -> **Roles** -> **Create role**
105− * **Role name**, *`<client role name>`* -> **save**
106−
107−
108−_Assign a role to a user_
109−
110−**Users** -> _Username_ -> **Role mapping** -> **Assign role** -> _filter by roles or clients and select_ -> **Assign**.
111−
112−Keycloak "realm roles" can be authorized using the `--allowed-role=<realm role name>` option, while "client roles" can be
113−evaluated using `--allowed-role=<your client's id>:<client role name>`.
114−
115−You may limit the _realm roles_ included in the JWT tokens for any given client by navigating to:
116−**Clients** -> `<your client's id>` -> **Client scopes** -> _\<your client's id\>-dedicated_ -> **Scope**
117−Disabling **Full scope allowed** activates the **Assign role** option, allowing you to select which roles, if assigned
118−to a user, will be included in the user's JWT tokens. This can be useful when a user has many associated roles, and you
119−want to reduce the size and impact of the JWT token.
120−
121−
122−**Groups**
123−
124−You may also do authorization on group memberships by using the OAuth2 Proxy option `--allowed-group`.
125−We will only do a brief description of creating the required _client scope_ **groups** and refer you to read the Keycloak
126−documentation.
127−
128−To summarize, the steps required to authorize Keycloak group membership with OAuth2 Proxy are as follows:
129−
130−* Create a new Client Scope with the name **groups** in Keycloak.
131− * Include a mapper of type **Group Membership**.
132− * Set the "Token Claim Name" to **groups** or customize by matching it to the `--oidc-groups-claim` option of OAuth2 Proxy.
133− * If the "Full group path" option is selected, you need to include a "/" separator in the group names defined in the
134− `--allowed-group` option of OAuth2 Proxy. Example: "/groupname" or "/groupname/child_group".
135−
136−After creating the _Client Scope_ named _groups_ you will need to attach it to your client.
137−**Clients** -> `<your client's id>` -> **Client scopes** -> **Add client scope** -> Select **groups** and choose Optional
138−and you should now have a client that maps group memberships into the JWT tokens so that Oauth2 Proxy may evaluate them.
139−
140−Create a group by navigating to **Groups** -> **Create group** and _add_ your test user as a member.
141−
142−The OAuth2 Proxy option `--allowed-group=/groupname` will now allow you to filter on group membership
143−
144−Keycloak also has the option of attaching roles to groups, please refer to the Keycloak documentation for more information.
145−
146−**Tip**
147−
148−To check if roles or groups are added to JWT tokens, you can preview a users token in the Keycloak console by following
149−these steps: **Clients** -> `<your client's id>` -> **Client scopes** -> **Evaluate**.
150−Select a _realm user_ and optional _scope parameters_ such as groups, and generate the JSON representation of an access
151−or id token to examine its contents.
docs/versioned_docs/version-7.14.x/configuration/providers/linkedin.mddeleted−13
@@ -1,13 +0,0 @@
1−---
2−id: linkedin
3−title: LinkedIn
4−---
5−
6−For LinkedIn, the registration steps are:
7−
8−1. Create a new project: https://www.linkedin.com/secure/developer
9−2. In the OAuth User Agreement section:
10− - In default scope, select r_basicprofile and r_emailaddress.
11− - In "OAuth 2.0 Redirect URLs", enter `https://internal.yourcompany.com/oauth2/callback`
12−3. Fill in the remaining required fields and Save.
13−4. Take note of the **Consumer Key / API Key** and **Consumer Secret / Secret Key**
docs/versioned_docs/version-7.14.x/configuration/providers/login_gov.mddeleted−79
@@ -1,79 +0,0 @@
1−---
2−id: login_gov
3−title: Login.gov
4−---
5−
6−login.gov is an OIDC provider for the US Government.
7−If you are a US Government agency, you can contact the login.gov team through the contact information
8−that you can find on https://login.gov/developers/ and work with them to understand how to get login.gov
9−accounts for integration/test and production access.
10−
11−A developer guide is available here: https://developers.login.gov/, though this proxy handles everything
12−but the data you need to create to register your application in the login.gov dashboard.
13−
14−As a demo, we will assume that you are running your application that you want to secure locally on
15−http://localhost:3000/, that you will be starting your proxy up on http://localhost:4180/, and that
16−you have an agency integration account for testing.
17−
18−First, register your application in the dashboard. The important bits are:
19−* Identity protocol: make this `Openid connect`
20−* Issuer: do what they say for OpenID Connect. We will refer to this string as `${LOGINGOV_ISSUER}`.
21−* Public key: This is a self-signed certificate in .pem format generated from a 2048-bit RSA private key.
22− A quick way to do this is
23− `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'`.
24− The contents of the `key.pem` shall be referred to as `${OAUTH2_PROXY_JWT_KEY}`.
25−* Return to App URL: Make this be `http://localhost:4180/`
26−* Redirect URIs: Make this be `http://localhost:4180/oauth2/callback`.
27−* Attribute Bundle: Make sure that email is selected.
28−
29−Now start the proxy up with the following options:
30−```
31−./oauth2-proxy -provider login.gov \
32− -client-id=${LOGINGOV_ISSUER} \
33− -redirect-url=http://localhost:4180/oauth2/callback \
34− -oidc-issuer-url=https://idp.int.identitysandbox.gov/ \
35− -cookie-secure=false \
36− -email-domain=gsa.gov \
37− -upstream=http://localhost:3000/ \
38− -cookie-secret=somerandomstring12341234567890AB \
39− -cookie-domain=localhost \
40− -skip-provider-button=true \
41− -pubjwk-url=https://idp.int.identitysandbox.gov/api/openid_connect/certs \
42− -profile-url=https://idp.int.identitysandbox.gov/api/openid_connect/userinfo \
43− -jwt-key="${OAUTH2_PROXY_JWT_KEY}"
44−```
45−You can also set all these options with environment variables, for use in cloud/docker environments.
46−One tricky thing that you may encounter is that some cloud environments will pass in environment
47−variables in a docker env-file, which does not allow multiline variables like a PEM file.
48−If you encounter this, then you can create a `jwt_signing_key.pem` file in the top level
49−directory of the repo which contains the key in PEM format and then do your docker build.
50−The docker build process will copy that file into your image which you can then access by
51−setting the `OAUTH2_PROXY_JWT_KEY_FILE=/etc/ssl/private/jwt_signing_key.pem`
52−environment variable, or by setting `--jwt-key-file=/etc/ssl/private/jwt_signing_key.pem` on the commandline.
53−
54−Once it is running, you should be able to go to `http://localhost:4180/` in your browser,
55−get authenticated by the login.gov integration server, and then get proxied on to your
56−application running on `http://localhost:3000/`. In a real deployment, you would secure
57−your application with a firewall or something so that it was only accessible from the
58−proxy, and you would use real hostnames everywhere.
59−
60−#### Skip OIDC discovery
61−
62−Some providers do not support OIDC discovery via their issuer URL, so oauth2-proxy cannot simply grab the authorization,
63−token and jwks URI endpoints from the provider's metadata.
64−
65−In this case, you can set the `--skip-oidc-discovery` option, and supply those required endpoints manually:
66−
67−```
68− -provider oidc
69− -client-id oauth2-proxy
70− -client-secret proxy
71− -redirect-url http://127.0.0.1:4180/oauth2/callback
72− -oidc-issuer-url http://127.0.0.1:5556
73− -skip-oidc-discovery
74− -login-url http://127.0.0.1:5556/authorize
75− -redeem-url http://127.0.0.1:5556/token
76− -oidc-jwks-url http://127.0.0.1:5556/keys
77− -cookie-secure=false
78− -email-domain example.com
79−```
docs/versioned_docs/version-7.14.x/configuration/providers/ms_azure_ad.mddeleted−59
@@ -1,59 +0,0 @@
1−---
2−id: azure
3−title: Azure (Deprecated)
4−---
5−
6−:::note
7−This is the legacy and deprecated provider for Azure, use [Microsoft Entra ID](ms_entra_id.md) if possible.
8−:::
9−
10−## Config Options
11−
12−| Flag | Toml Field | Type | Description | Default |
13−| ---------------- | -------------- | ------ | ---------------------------------------------------------------- | ---------- |
14−| `--azure-tenant` | `azure_tenant` | string | go to a tenant-specific or common (tenant-independent) endpoint. | `"common"` |
15−| `--resource` | `resource` | string | The resource that is protected (Azure AD only) | |
16−
17−## Usage
18−
19−1. Add an application: go to [https://portal.azure.com](https://portal.azure.com), choose **Azure Active Directory**, select
20− **App registrations** and then click on **New registration**.
21−2. Pick a name, check the supported account type(single-tenant, multi-tenant, etc). In the **Redirect URI** section create a new
22− **Web** platform entry for each app that you want to protect by the oauth2 proxy(e.g.
23− https://internal.yourcompanycom/oauth2/callback). Click **Register**.
24−3. Next we need to add group read permissions for the app registration, on the **API Permissions** page of the app, click on
25− **Add a permission**, select **Microsoft Graph**, then select **Application permissions**, then click on **Group** and select
26− **Group.Read.All**. Hit **Add permissions** and then on **Grant admin consent** (you might need an admin to do this).
27− <br/>**IMPORTANT**: Even if this permission is listed with **"Admin consent required=No"** the consent might actually
28− be required, due to AAD policies you won't be able to see. If you get a **"Need admin approval"** during login,
29− most likely this is what you're missing!
30−4. Next, if you are planning to use v2.0 Azure Auth endpoint, go to the **Manifest** page and set `"accessTokenAcceptedVersion": 2`
31− in the App registration manifest file.
32−5. On the **Certificates & secrets** page of the app, add a new client secret and note down the value after hitting **Add**.
33−6. Configure the proxy with:
34−- for V1 Azure Auth endpoint (Azure Active Directory Endpoints - https://login.microsoftonline.com/common/oauth2/authorize)
35−
36−```
37− --provider=azure
38− --client-id=<application ID from step 3>
39− --client-secret=<value from step 5>
40− --azure-tenant={tenant-id}
41− --oidc-issuer-url=https://sts.windows.net/{tenant-id}/
42−```
43−
44−- for V2 Azure Auth endpoint (Microsoft Identity Platform Endpoints - https://login.microsoftonline.com/common/oauth2/v2.0/authorize)
45−```
46− --provider=azure
47− --client-id=<application ID from step 3>
48− --client-secret=<value from step 5>
49− --azure-tenant={tenant-id}
50− --oidc-issuer-url=https://login.microsoftonline.com/{tenant-id}/v2.0
51−```
52−
53−***Notes***:
54−- When using v2.0 Azure Auth endpoint (`https://login.microsoftonline.com/{tenant-id}/v2.0`) as `--oidc_issuer_url`, in conjunction
55− with `--resource` flag, be sure to append `/.default` at the end of the resource name. See
56− https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-permissions-and-consent#the-default-scope for more details.
57−- When using the Azure Auth provider with nginx and the cookie session store you may find the cookie is too large and doesn't
58− get passed through correctly. Increasing the proxy_buffer_size in nginx or implementing the
59− [redis session storage](../sessions.md#redis-storage) should resolve this.
docs/versioned_docs/version-7.14.x/configuration/providers/ms_entra_id.mddeleted−197
@@ -1,197 +0,0 @@
1−---
2−id: ms_entra_id
3−title: Microsoft Entra ID
4−---
5−
6−Provider for Microsoft Entra ID. Fully compliant with OIDC, with support for group overage and multi-tenant apps.
7−
8−## Config Options
9−
10−The provider is OIDC-compliant, so all the OIDC parameters are honored. Additional provider-specific configuration parameters are:
11−
12−| Flag | Toml Field | Type | Description | Default |
13−| --------------------------- | -------------------------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
14−| `--entra-id-allowed-tenant` | `entra_id_allowed_tenants` | string \| list | List of allowed tenants. In case of multi-tenant apps, incoming tokens are issued by different issuers and OIDC issuer verification needs to be disabled. When not specified, all tenants are allowed. Redundant for single-tenant apps (regular ID token validation matches the issuer). | |
15−| `--entra-id-federated-token-auth` | `entra_id_federated_token_auth` | boolean | Enable oAuth2 client authentication with federated token projected by Entra Workload Identity plugin, instead of client secret. | false |
16−
17−## Configure App registration
18−To begin, create an App registration, set a redirect URI, and generate a secret. All account types are supported, including single-tenant, multi-tenant, multi-tenant with Microsoft accounts, and Microsoft accounts only.
19−
20−<details>
21− <summary>See Azure Portal example</summary>
22− <div class="videoBlock">
23− <iframe src="https://www.youtube.com/embed/IUNfxhOzr4E"></iframe>
24− </div>
25−</details>
26−
27−<details>
28− <summary>See Terraform example</summary>
29−```
30− resource "azuread_application" "auth" {
31− display_name = "oauth2-proxy"
32− sign_in_audience = "AzureADMyOrg" # Others are also supported
33−
34− web {
35− redirect_uris = [
36− "https://podinfo.lakis.tech/oauth2/callback",
37− ]
38− }
39− // We don't specify any required API permissions - we allow user consent only
40− }
41−
42− resource "azuread_service_principal" "sp" {
43− client_id = azuread_application.auth.client_id
44− app_role_assignment_required = false
45− }
46−
47− resource "azuread_service_principal_password" "pass" {
48− service_principal_id = azuread_service_principal.sp.id
49− }
50−
51−```
52−</details>
53−
54−### Configure groups
55−If you want to make use of groups, you can configure *groups claim* to be present in ID Tokens issued by the App registration.
56−<details>
57− <summary>See Azure Portal example</summary>
58− <div class="videoBlock">
59− <div class="videoBlock">
60− <iframe src="https://www.youtube.com/embed/QZmP5MKEJis"></iframe>
61− </div>
62− </div>
63−</details>
64−<details>
65− <summary>See Terraform example</summary>
66−```
67− resource "azuread_application" "auth" {
68− display_name = "oauth2-proxy"
69− sign_in_audience = "AzureADMyOrg"
70−
71− group_membership_claims = [
72− "SecurityGroup"
73− ]
74−
75− web {
76− redirect_uris = [
77− "https://podinfo.lakis.tech/oauth2/callback",
78− ]
79− }
80− }
81−
82− resource "azuread_service_principal" "sp" {
83− client_id = azuread_application.auth.client_id
84− app_role_assignment_required = false
85− }
86−
87− resource "azuread_service_principal_password" "pass" {
88− service_principal_id = azuread_service_principal.sp.id
89− }
90−
91−```
92−</details>
93−
94−### Scopes and claims
95−For single-tenant and multi-tenant apps without groups, the only required scope is `openid` (See: [Scopes and permissions](https://learn.microsoft.com/en-us/entra/identity-platform/scopes-oidc#the-openid-scope)).
96−
97−To make use of groups - for example use `allowed_groups` setting or authorize based on groups inside your service - you need to enable *groups claims* in the App Registration. When enabled, list of groups is present in the issued ID token. No additional scopes are required besides `openid`. This works up to 200 groups.
98−
99−When user has more than 200 group memberships, OAuth2-Proxy attempts to retrieve the complete list from Microsoft Graph API's [`transitiveMemberOf`](https://learn.microsoft.com/en-us/graph/api/user-list-transitivememberof). Endpoint requires `User.Read` scope (delegated permission). This permission can be by default consented by user during first login. Set scope to `openid User.Read` to request user consent. Without proper scope, user with 200+ groups will authenticate with 0 groups. See: [group overages](https://learn.microsoft.com/en-us/security/zero-trust/develop/configure-tokens-group-claims-app-roles#group-overages).
100−
101−Alternatively to user consent, both `openid` and `User.Read` permissions can be consented by admistrator. Then, user is not asked for consent on the first login, and group overage works with `openid` scope only. Admin consent can also be required for some tenants. It can be granted with [azuread_service_principal_delegated_permission_grant](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/resources/service_principal_delegated_permission_grant) terraform resource.
102−
103−For personal microsoft accounts, required scope is `openid profile email`.
104−
105−See: [Overview of permissions and consent in the Microsoft identity platform](https://learn.microsoft.com/en-us/entra/identity-platform/permissions-consent-overview).
106−
107−### Multi-tenant apps
108−To authenticate apps from multiple tenants (including personal Microsoft accounts), set the common OIDC issuer url and disable verification:
109−```toml
110−oidc_issuer_url=https://login.microsoftonline.com/common/v2.0
111−insecure_oidc_skip_issuer_verification=true
112−```
113−`insecure_oidc_skip_issuer_verification` setting is required to disable following checks:
114−* Startup check for matching issuer URL returned from [discovery document](https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration) with `oidc_issuer_url` setting. Required, as document's `issuer` field doesn't equal to `https://login.microsoftonline.com/common/v2.0`. See [OIDC Discovery 4.3](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfigurationValidation).
115−* Matching ID token's `issuer` claim with `oidc_issuer_url` setting during ID token validation. Required to support tokens issued by different tenants. See [OIDC Core 3.1.3.7](https://openid.net/specs/openid-connect-core-1_0.html#IDTokenValidation).
116−
117−To provide additional security, Entra ID provider performs check on the ID token's `issuer` claim to match the `https://login.microsoftonline.com/{tenant-id}/v2.0` template.
118−
119−### Workload Identity
120−Provider supports authentication with federated token, without need of using client secret. Following conditions have to be met:
121−
122−* Cluster has public OIDC provider URL. For major cloud providers, it can be enabled with a single flag, for example for [Azure Kubernetes Service deployed with Terraform](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/kubernetes_cluster), it's `oidc_issuer_enabled`.
123−* Workload Identity admission webhook is deployed on the cluster. For AKS, it can be enabled with a flag (`workload_identity_enabled` in Terraform resource), for clusters outside of Azure, it can be installed from [helm chart](https://github.com/Azure/azure-workload-identity).
124−* Appropriate federated credential is added to application registration.
125−<details>
126− <summary>See federated credential terraform example</summary>
127−```
128− resource "azuread_application_federated_identity_credential" "fedcred" {
129− application_id = azuread_application.application.id # ID of your application
130− display_name = "federation-cred"
131− description = "Workload identity for oauth2-proxy"
132− audiences = ["api://AzureADTokenExchange"] # Fixed value
133− issuer = "https://cluster-oidc-issuer-url..."
134− subject = "system:serviceaccount:oauth2-proxy-namespace-name:oauth2-proxy-sa-name" # set proper NS and SA name
135− }
136−```
137−</details>
138−
139−* Kubernetes service account associated with oauth2-proxy deployment, is annotated with `azure.workload.identity/client-id: <app-registration-client-id>`
140−* oauth2-proxy pod is labeled with `azure.workload.identity/use: "true"`
141−* oauth2-proxy is configured with `entra_id_federated_token_auth` set to `true`.
142−
143−`client_secret` setting can be omitted when using federated token authentication.
144−
145−See: [Azure Workload Identity documentation](https://azure.github.io/azure-workload-identity/docs/).
146−
147−### Example configurations
148−Single-tenant app without groups (*groups claim* not enabled). Consider using generic OIDC provider:
149−```toml
150−provider="entra-id"
151−oidc_issuer_url="https://login.microsoftonline.com/<tenant-id>/v2.0"
152−client_id="<client-id>"
153−client_secret="<client-secret>"
154−scope="openid"
155−```
156−
157−Single-tenant app with up to 200 groups (*groups claim* enabled). Consider using generic OIDC provider:
158−```toml
159−provider="entra-id"
160−oidc_issuer_url="https://login.microsoftonline.com/<tenant-id>/v2.0"
161−client_id="<client-id>"
162−client_secret="<client-secret>"
163−scope="openid"
164−allowed_groups=["ac51800c-2679-4ecb-8130-636380a3b491"]
165−```
166−
167−Single-tenant app with more than 200 groups:
168−```toml
169−provider="entra-id"
170−oidc_issuer_url="https://login.microsoftonline.com/<tenant-id>/v2.0"
171−client_id="<client-id>"
172−client_secret="<client-secret>"
173−scope="openid User.Read"
174−allowed_groups=["968b4844-d5e7-4e18-a834-59927959369f"]
175−```
176−
177−Single-tenant app with more than 200 groups and workload identity enabled:
178−```toml
179−provider="entra-id"
180−oidc_issuer_url="https://login.microsoftonline.com/<tenant-id>/v2.0"
181−client_id="<client-id>"
182−scope="openid User.Read"
183−allowed_groups=["968b4844-d5e7-4e18-a834-59927959369f"]
184−entra_id_federated_token_auth=true
185−```
186−
187−Multi-tenant app with Microsoft personal accounts & one Entra tenant allowed, with group overage considered:
188−```toml
189−provider="entra-id"
190−oidc_issuer_url="https://login.microsoftonline.com/common/v2.0"
191−client_id="<client-id>"
192−client_secret="<client-secret>"
193−insecure_oidc_skip_issuer_verification=true
194−scope="openid profile email User.Read"
195−entra_id_allowed_tenants=["9188040d-6c67-4c5b-b112-36a304b66dad","<my-tenant-id>"] # Allow only <my-tenant-id> and Personal MS Accounts tenant
196−email_domains="*"
197−```
docs/versioned_docs/version-7.14.x/configuration/providers/nextcloud.mddeleted−28
@@ -1,28 +0,0 @@
1−---
2−id: nextcloud
3−title: NextCloud
4−---
5−
6−The Nextcloud provider allows you to authenticate against users in your
7−Nextcloud instance.
8−
9−When you are using the Nextcloud provider, you must specify the urls via
10−configuration, environment variable, or command line argument. Depending
11−on whether your Nextcloud instance is using pretty urls your urls may be of the
12−form `/index.php/apps/oauth2/*` or `/apps/oauth2/*`.
13−
14−Refer to the [OAuth2
15−documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/oauth2.html)
16−to set up the client id and client secret. Your "Redirection URI" will be
17−`https://internalapp.yourcompany.com/oauth2/callback`.
18−
19−```
20− -provider nextcloud
21− -client-id <from nextcloud admin>
22− -client-secret <from nextcloud admin>
23− -login-url="<your nextcloud url>/index.php/apps/oauth2/authorize"
24− -redeem-url="<your nextcloud url>/index.php/apps/oauth2/api/v1/token"
25− -validate-url="<your nextcloud url>/ocs/v2.php/cloud/user?format=json"
26−```
27−
28−Note: in *all* cases the validate-url will *not* have the `index.php`.
docs/versioned_docs/version-7.14.x/configuration/providers/openid_connect.mddeleted−146
@@ -1,146 +0,0 @@
1−---
2−id: openid_connect
3−title: OpenID Connect
4−---
5−
6−OpenID Connect is a spec for OAUTH 2.0 + identity that is implemented by many major providers and several open source projects.
7−
8−This provider was originally built against CoreOS Dex, and we will use it as an example.
9−The OpenID Connect Provider (OIDC) can also be used to connect to other Identity Providers such as Okta, an example can be found below.
10−
11−#### Dex
12−
13−To configure the OIDC provider for Dex, perform the following steps:
14−
15−1. Download Dex:
16−
17− ```
18− go get github.com/dexidp/dex
19− ```
20−
21− See the [getting started guide](https://dexidp.io/docs/getting-started/) for more details.
22−
23−2. Setup oauth2-proxy with the correct provider and using the default ports and callbacks. Add a configuration block to
24− the `staticClients` section of `examples/config-dev.yaml`:
25−
26− ```
27− - id: oauth2-proxy
28− redirectURIs:
29− - 'http://127.0.0.1:4180/oauth2/callback'
30− name: 'oauth2-proxy'
31− secret: proxy
32− ```
33−
34−3. Launch Dex: from `$GOPATH/github.com/dexidp/dex`, run:
35−
36− ```
37− bin/dex serve examples/config-dev.yaml
38− ```
39−
40−4. In a second terminal, run the oauth2-proxy with the following args:
41−
42− ```shell
43− --provider oidc
44− --provider-display-name "My OIDC Provider"
45− --client-id oauth2-proxy
46− --client-secret proxy
47− --redirect-url http://127.0.0.1:4180/oauth2/callback
48− --oidc-issuer-url http://127.0.0.1:5556/dex
49− --cookie-secure=false
50− --cookie-secret=secret
51− --email-domain kilgore.trout
52− ```
53−
54− To serve the current working directory as a website under the `/static` endpoint, add:
55−
56− ```shell
57− --upstream file://$PWD/#/static/
58− ```
59−
60−5. Test the setup by visiting http://127.0.0.1:4180 or http://127.0.0.1:4180/static .
61−
62−See also [our local testing environment](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/contrib/local-environment) for a self-contained example using Docker and etcd as storage for Dex.
63−
64−#### Okta
65−
66−To configure the OIDC provider for Okta, perform the following steps:
67−
68−1. Log in to Okta using an administrative account. It is suggested you try this in preview first, `example.oktapreview.com`
69−2. (OPTIONAL) If you want to configure authorization scopes and claims to be passed on to multiple applications,
70− you may wish to configure an authorization server for each application. Otherwise, the provided `default` will work.
71− * Navigate to **Security** then select **API**
72− * Click **Add Authorization Server**, if this option is not available you may require an additional license for a custom
73− authorization server.
74− * Fill out the **Name** with something to describe the application you are protecting. e.g. 'Example App'.
75− * For **Audience**, pick the URL of the application you wish to protect: https://example.corp.com
76− * Fill out a **Description**
77− * Add any **Access Policies** you wish to configure to limit application access.
78− * The default settings will work for other options.
79− [See Okta documentation for more information on Authorization Servers](https://developer.okta.com/docs/guides/customize-authz-server/overview/)
80−3. Navigate to **Applications** then select **Add Application**.
81− * Select **Web** for the **Platform** setting.
82− * Select **OpenID Connect** and click **Create**
83− * Pick an **Application Name** such as `Example App`.
84− * Set the **Login redirect URI** to `https://example.corp.com`.
85− * Under **General** set the **Allowed grant types** to `Authorization Code` and `Refresh Token`.
86− * Leave the rest as default, taking note of the `Client ID` and `Client Secret`.
87− * Under **Assignments** select the users or groups you wish to access your application.
88−4. Create a configuration file like the following:
89−
90− ```
91− provider = "oidc"
92− redirect_url = "https://example.corp.com/oauth2/callback"
93− oidc_issuer_url = "https://corp.okta.com/oauth2/abCd1234"
94− upstreams = [
95− "https://example.corp.com"
96− ]
97− email_domains = [
98− "corp.com"
99− ]
100− client_id = "XXXXX"
101− client_secret = "YYYYY"
102− pass_access_token = true
103− cookie_secret = "ZZZZZ"
104− skip_provider_button = true
105− ```
106−
107−The `oidc_issuer_url` is based on URL from your **Authorization Server**'s **Issuer** field in step 2, or simply
108−https://corp.okta.com. The `client_id` and `client_secret` are configured in the application settings.
109−Generate a unique `cookie_secret` to encrypt the cookie.
110−
111−Then you can start the oauth2-proxy with `./oauth2-proxy --config /etc/example.cfg`
112−
113−#### Okta - localhost
114−
115−1. Signup for developer account: https://developer.okta.com/signup/
116−2. Create New `Web` Application: https://$\{your-okta-domain\}/dev/console/apps/new
117−3. Example Application Settings for localhost:
118− * **Name:** My Web App
119− * **Base URIs:** http://localhost:4180/
120− * **Login redirect URIs:** http://localhost:4180/oauth2/callback
121− * **Logout redirect URIs:** http://localhost:4180/
122− * **Group assignments:** `Everyone`
123− * **Grant type allowed:** `Authorization Code` and `Refresh Token`
124−4. Make note of the `Client ID` and `Client secret`, they are needed in a future step
125−5. Make note of the **default** Authorization Server Issuer URI from: https://$\{your-okta-domain\}/admin/oauth2/as
126−6. Example config file `/etc/localhost.cfg`
127− ```shell
128− provider = "oidc"
129− redirect_url = "http://localhost:4180/oauth2/callback"
130− oidc_issuer_url = "https://$\{your-okta-domain\}/oauth2/default"
131− upstreams = [
132− "http://0.0.0.0:8080"
133− ]
134− email_domains = [
135− "*"
136− ]
137− client_id = "XXX"
138− client_secret = "YYY"
139− pass_access_token = true
140− cookie_secret = "ZZZ"
141− cookie_secure = false
142− skip_provider_button = true
143− # Note: use the following for testing within a container
144− # http_address = "0.0.0.0:4180"
145− ```
146−7. Then you can start the oauth2-proxy with `./oauth2-proxy --config /etc/localhost.cfg`
docs/versioned_docs/version-7.14.x/configuration/providers/sourcehut.mddeleted−25
@@ -1,25 +0,0 @@
1−---
2−id: sourcehut
3−title: SourceHut
4−---
5−
6−1. Create a new OAuth client: https://meta.sr.ht/oauth2
7−2. Under `Redirection URI` enter the correct URL, i.e.
8− `https://internal.yourcompany.com/oauth2/callback`
9−
10−To use the provider, start with `--provider=sourcehut`.
11−
12−If you are hosting your own SourceHut instance, make sure you set the following
13−to the appropriate URLs:
14−
15−```shell
16− --login-url="https://<meta.your.instance>/oauth2/authorize"
17− --redeem-url="https://<meta.your.instance>/oauth2/access-token"
18− --profile-url="https://<meta.your.instance>/query"
19− --validate-url="https://<meta.your.instance>/profile"
20−```
21−
22−The default configuration allows everyone with an account to authenticate.
23−Restricting access is currently only supported by
24−[email](index.md#email-authentication).
25−
docs/versioned_docs/version-7.14.x/configuration/sessions.mddeleted−99
@@ -1,99 +0,0 @@
1−---
2−id: session_storage
3−title: Session Storage
4−---
5−
6−Sessions allow a user's authentication to be tracked between multiple HTTP
7−requests to a service.
8−
9−The OAuth2 Proxy uses a Cookie to track user sessions and will store the session
10−data in one of the available session storage backends.
11−
12−At present the available backends are (as passed to `--session-store-type`):
13−- [cookie](#cookie-storage) (default)
14−- [redis](#redis-storage)
15−
16−### Cookie Storage
17−
18−The Cookie storage backend is the default backend implementation and has
19−been used in the OAuth2 Proxy historically.
20−
21−With the Cookie storage backend, all session information is stored in client
22−side cookies and transferred with each and every request.
23−
24−The following should be known when using this implementation:
25−- Since all state is stored client side, this storage backend means that the OAuth2 Proxy is completely stateless
26−- Cookies are signed server side to prevent modification client-side
27−- It is mandatory to set a `cookie-secret` which will ensure data is encrypted within the cookie data.
28−- Since multiple requests can be made concurrently to the OAuth2 Proxy, this session implementation
29−cannot lock sessions and while updating and refreshing sessions, there can be conflicts which force
30−users to re-authenticate
31−
32−
33−### Redis Storage
34−
35−The Redis Storage backend stores encrypted sessions in redis. Instead of sending all the information
36−back the client for storage, as in the [Cookie storage](#cookie-storage), a ticket is sent back
37−to the user as the cookie value instead.
38−
39−A ticket is composed as the following:
40−
41−`{CookieName}-{ticketID}.{secret}`
42−
43−Where:
44−
45−- The `CookieName` is the OAuth2 cookie name (_oauth2_proxy by default)
46−- The `ticketID` is a 128-bit random number, hex-encoded
47−- The `secret` is a 128-bit random number, base64url encoded (no padding). The secret is unique for every session.
48−- The pair of `{CookieName}-{ticketID}` comprises a ticket handle, and thus, the redis key
49−to which the session is stored. The encoded session is encrypted with the secret and stored
50−in redis via the `SETEX` command.
51−
52−Encrypting every session uniquely protects the refresh/access/id tokens stored in the session from
53−disclosure. Additionally, the browser only has to send a short Cookie with every request and not the whole JWT,
54−which can get quite big.
55−
56−Two settings are used to configure the OAuth2 Proxy cookie lifetime:
57−
58− --cookie-refresh duration refresh the cookie after this duration; 0 to disable
59− --cookie-expire duration expire timeframe for cookie 168h0m0s
60−
61−The "cookie-expire" value should be equal to the lifetime of the Refresh-Token that is issued by the OAuth2 authorization server.
62−If it expires earlier and is deleted by the browser, OAuth2 Proxy cannot find the stored Refresh-Tokens in Redis and thus cannot start
63−the refresh flow to get a new Access-Token. If it is longer, it might be that the old Refresh-Token will be found in Redis but has already
64−expired.
65−
66−The "cookie-refresh" value controls when OAuth2 Proxy tries to refresh an Access-Token. If it is set to "0", the
67−Access-Token will never be refreshed, even if it is already expired and a valid Refresh-Token is available. If set, OAuth2 Proxy will
68−refresh the Access-Token after this many seconds whether it is still valid or not. According to the official OAuth2.0 specification
69−Access-Tokens are not required to follow a specific format. Therefore OAuth2 Proxy cannot check for any expiry date without an
70−introspection endpoint. If an Access-Token expires and you have not set a corresponding "cookie-refresh" value, you will likely
71−encounter expiry issues.
72−
73−Caveat: It can happen that the Access-Token is valid for e.g. "1m" and a request happens after exactly "59s".
74−It would pass OAuth2 Proxy and be forwarded to the backend but is just expired when the backend tries to validate
75−it. This is especially relevant if the backend uses the JWT to make requests to other backends.
76−For this reason, it's advised to set the cookie-refresh a couple of seconds less than the Access-Token lifespan.
77−
78−Recommended settings:
79−
80−* cookie_refresh := Access-Token lifespan - 1m
81−* cookie_expire := Refresh-Token lifespan (i.e. Keycloak client_session_idle)
82−
83−#### Usage
84−
85−When using the redis store, specify `--session-store-type=redis` as well as the Redis connection URL, via
86−`--redis-connection-url=redis://host[:port][/db-number]`.
87−
88−You may also configure the store for Redis Sentinel. In this case, you will want to use the
89−`--redis-use-sentinel=true` flag, as well as configure the flags `--redis-sentinel-master-name`
90−and `--redis-sentinel-connection-urls` appropriately.
91−
92−Redis Cluster is available to be the backend store as well. To leverage it, you will need to set the
93−`--redis-use-cluster=true` flag, and configure the flags `--redis-cluster-connection-urls` appropriately.
94−
95−Note that flags `--redis-use-sentinel=true` and `--redis-use-cluster=true` are mutually exclusive.
96−
97−Note, if Redis timeout option is set to non-zero, the `--redis-connection-idle-timeout`
98−must be less than [Redis timeout option](https://redis.io/docs/reference/clients/#client-timeouts). For example: if either redis.conf includes
99−`timeout 15` or using `CONFIG SET timeout 15` the `--redis-connection-idle-timeout` must be at least `--redis-connection-idle-timeout=14`
docs/versioned_docs/version-7.14.x/configuration/systemd_socket.mddeleted−43
@@ -1,43 +0,0 @@
1−---
2−id: systemd_socket
3−title: Systemd Socket Activation
4−---
5−
6−Pass an existing listener created by systemd.socket to oauth2-proxy.
7−
8−To do this create a socket:
9−
10−oauth2-proxy.socket
11−```
12−[Socket]
13−ListenStream=%t/oauth2.sock
14−SocketGroup=www-data
15−SocketMode=0660
16−```
17−
18−Now it's possible to call this socket from e.g. nginx:
19−```
20−server {
21− location /oauth2/ {
22− proxy_pass http://unix:/run/oauth2-proxy/oauth2.sock;
23−}
24−```
25−
26−The oauth2-proxy should have `--http-address=fd:3` as a parameter.
27−Here fd is case insensitive and means file descriptor. The number 3 refers to the first non-stdin/stdout/stderr file descriptor,
28−systemd-socket-activate (which is what systemd.socket uses), listens to what it is told and passes
29−the listener it created onto the process, starting with file descriptor 3.
30−
31−```
32−./oauth2-proxy \
33− --http-address="fd:3" \
34− --email-domain="yourcompany.com" \
35− --upstream=http://127.0.0.1:8080/ \
36− --cookie-secret=... \
37− --cookie-secure=true \
38− --provider=... \
39− --client-id=... \
40− --client-secret=...
41−```
42−
43−Currently TLS is not supported (but it's doable).
docs/versioned_docs/version-7.14.x/configuration/tls.mddeleted−85
@@ -1,85 +0,0 @@
1−---
2−id: tls
3−title: TLS Configuration
4−---
5−
6−There are two recommended configurations:
7−- [At OAuth2 Proxy](#terminate-tls-at-oauth2-proxy)
8−- [At Reverse Proxy](#terminate-tls-at-reverse-proxy-eg-nginx)
9−
10−### Terminate TLS at OAuth2 Proxy
11−
12−1. Configure SSL Termination with OAuth2 Proxy by providing a `--tls-cert-file=/path/to/cert.pem` and `--tls-key-file=/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-file=/path/to/cert.pem \
21− --tls-key-file=/path/to/cert.key \
22− --cookie-secret=... \
23− --cookie-secure=true \
24− --provider=... \
25− --client-id=... \
26− --client-secret=...
27− ```
28−
29−2. With this configuration approach the customization of the TLS settings is limited.
30−
31− The minimal acceptable TLS version can be set with `--tls-min-version=TLS1.3`.
32− The defaults set `TLS1.2` as the minimal version.
33− Regardless of the minimum version configured, `TLS1.3` is currently always used as the maximal version.
34−
35− TLS server side cipher suites can be specified with `--tls-cipher-suite=TLS_RSA_WITH_RC4_128_SHA`.
36− If not specified, the defaults from [`crypto/tls`](https://pkg.go.dev/crypto/tls#CipherSuites) of the currently used `go` version for building `oauth2-proxy` will be used.
37− A complete list of valid TLS cipher suite names can be found in [`crypto/tls`](https://pkg.go.dev/crypto/tls#pkg-constants).
38−
39−### Terminate TLS at Reverse Proxy, e.g. Nginx
40−
41−1. Configure SSL Termination with [Nginx](http://nginx.org/) (example config below), Amazon ELB, Google Cloud Platform Load Balancing, or ...
42−
43− Because `oauth2-proxy` listens on `127.0.0.1:4180` by default, to listen on all interfaces (needed when using an
44− external load balancer like Amazon ELB or Google Platform Load Balancing) use `--http-address="0.0.0.0:4180"` or
45− `--http-address="http://:4180"`.
46−
47− Nginx will listen on port `443` and handle SSL connections while proxying to `oauth2-proxy` on port `4180`.
48− `oauth2-proxy` will then authenticate requests for an upstream application. The external endpoint for this example
49− would be `https://internal.yourcompany.com/`.
50−
51− An example Nginx config follows. Note the use of `Strict-Transport-Security` header to pin requests to SSL
52− via [HSTS](http://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security):
53−
54− ```
55− server {
56− listen 443 default ssl;
57− server_name internal.yourcompany.com;
58− ssl_certificate /path/to/cert.pem;
59− ssl_certificate_key /path/to/cert.key;
60− add_header Strict-Transport-Security max-age=2592000;
61−
62− location / {
63− proxy_pass http://127.0.0.1:4180;
64− proxy_set_header Host $host;
65− proxy_set_header X-Real-IP $remote_addr;
66− proxy_connect_timeout 1;
67− proxy_send_timeout 30;
68− proxy_read_timeout 30;
69− }
70− }
71− ```
72−
73−2. The command line to run `oauth2-proxy` in this configuration would look like this:
74−
75− ```bash
76− ./oauth2-proxy \
77− --email-domain="yourcompany.com" \
78− --upstream=http://127.0.0.1:8080/ \
79− --cookie-secret=... \
80− --cookie-secure=true \
81− --provider=... \
82− --reverse-proxy=true \
83− --client-id=... \
84− --client-secret=...
85− ```
docs/versioned_docs/version-7.14.x/features/endpoints.mddeleted−59
@@ -1,59 +0,0 @@
1−---
2−id: endpoints
3−title: Endpoints
4−---
5−
6−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.
7−
8−- / - the proxy endpoint provides authentication and returns the appropriate 40x error if not authenticated or authorized then passes the request upstream.
9−- /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
10−- /ping - returns a 200 OK response, which is intended for use with health checks
11−- /ready - returns a 200 OK response if all the underlying connections (e.g., Redis store) are connected
12−- /metrics - Metrics endpoint for Prometheus to scrape, serve on the address specified by `--metrics-address`, disabled by default
13−- /oauth2/sign_in - the login page, which also doubles as a sign-out page (it clears cookies)
14−- /oauth2/sign_out - this URL is used to clear the session cookie
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/userinfo - the URL is used to return user's email from the session in JSON format.
18−- /oauth2/auth - only returns a 202 Accepted response or a 401 Unauthorized response; for use with the [Nginx `auth_request` directive](../configuration/integrations/nginx)
19−- /oauth2/static/\* - stylesheets and other dependencies used in the sign_in and error pages
20−
21−### Sign out
22−
23−To sign the user out, redirect them to `/oauth2/sign_out`. This endpoint only removes oauth2-proxy's own cookies, i.e. the user is still logged in with the authentication provider and may automatically re-login when accessing the application again. You will also need to redirect the user to the authentication provider's sign-out page afterward using the `rd` query parameter, i.e. redirect the user to something like (notice the url-encoding!):
24−
25−```
26−/oauth2/sign_out?rd=https%3A%2F%2Fmy-oidc-provider.example.com%2Fsign_out_page
27−```
28−
29−Alternatively, include the redirect URL in the `X-Auth-Request-Redirect` header:
30−
31−```
32−GET /oauth2/sign_out HTTP/1.1
33−X-Auth-Request-Redirect: https://my-oidc-provider/sign_out_page
34−...
35−```
36−
37−(The "sign_out_page" should be the [`end_session_endpoint`](https://openid.net/specs/openid-connect-session-1_0.html#rfc.section.2.1) from [the metadata](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig) if your OIDC provider supports Session Management and Discovery.)
38−
39−BEWARE that the domain you want to redirect to (`my-oidc-provider.example.com` in the example) must be added to the [`--whitelist-domain`](../configuration/overview) configuration option otherwise the redirect will be ignored. Make sure to include the actual domain and port (if needed) and not the URL (e.g "localhost:8081" instead of "http://localhost:8081").
40−
41−### Auth
42−
43−This endpoint returns 202 Accepted response or a 401 Unauthorized response.
44−
45−It can be configured using the following query parameters:
46−- `allowed_groups`: comma separated list of allowed groups
47−- `allowed_email_domains`: comma separated list of allowed email domains
48−- `allowed_emails`: comma separated list of allowed emails
49−
50−### Proxy (/)
51−
52−This endpoint returns the upstream response if authenticated.
53−If unauthenticated it returns a 401 Unauthorized. If the authenticatd user
54−is not in one of the allowed groups, or emails then it returns a 403 forbidden
55−
56−It can be configured using the following query parameters:
57−- `allowed_groups`: comma separated list of allowed groups
58−- `allowed_email_domains`: comma separated list of allowed email domains
59−- `allowed_emails`: comma separated list of allowed emails
docs/versioned_docs/version-7.14.x/installation.mddeleted−32
@@ -1,32 +0,0 @@
1−---
2−id: installation
3−title: Installation
4−---
5−
6−1. Choose how to deploy:
7−
8− a. Using a [Prebuilt Binary](https://github.com/oauth2-proxy/oauth2-proxy/releases) (current release is `v7.14.3`)
9−
10− b. Using Go to install the latest release
11− ```bash
12− $ go install github.com/oauth2-proxy/oauth2-proxy/v7@latest
13− ```
14− This will install the binary into `$GOPATH/bin`. Make sure you include `$GOPATH` in your `$PATH`. Otherwise your system won't find binaries installed via `go install`
15−
16− c. Using a [Prebuilt Docker Image](https://quay.io/oauth2-proxy/oauth2-proxy) (AMD64, PPC64LE, S390x, ARMv6, ARMv7, and ARM64 available)
17−
18− d. Using a [Pre-Release Nightly Docker Image](https://quay.io/oauth2-proxy/oauth2-proxy-nightly) (AMD64, PPC64LE, ARMv6, ARMv7, and ARM64 available)
19−
20− e. Using the official [Kubernetes manifest](https://github.com/oauth2-proxy/manifests) (Helm)
21−
22− 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`.
23−
24− ```
25− $ sha256sum -c sha256sum.txt
26− oauth2-proxy-x.y.z.linux-amd64: OK
27− ```
28−
29−2. [Select a Provider and Register an OAuth Application with a Provider](configuration/providers/index.md)
30−3. [Configure OAuth2 Proxy using config file, command line options, or environment variables](configuration/overview.md)
31−4. [Configure SSL or Deploy behind an SSL endpoint](configuration/tls.md) (example provided for Nginx)
32−5. [Configure OAuth2 Proxy using systemd.socket](configuration/systemd_socket.md) (example provided for Nginx/Systemd)
docs/versioned_docs/version-7.14.x/welcome.mddeleted−32
@@ -1,32 +0,0 @@
1−---
2−id: welcome
3−title: Welcome
4−hide_table_of_contents: true
5−slug: /
6−---
7−
8−![OAuth2 Proxy](/img/logos/OAuth2_Proxy_horizontal.svg)
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
14−This repository was forked from [bitly/OAuth2_Proxy](https://github.com/bitly/oauth2_proxy) on 27/11/2018.
15−Versions v3.0.0 and up are from this fork and will have diverged from any changes in the original fork.
16−A list of changes can be seen in the [CHANGELOG](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/CHANGELOG.md).
17−:::
18−
19−![Sign In Page](/img/sign-in-page.png)
20−
21−## Architecture
22−
23−![OAuth2 Proxy Architecture](/img/simplified-architecture.svg)
24−
25−## Cloud Native Computing Foundation
26−
27−OAuth2 Proxy is a [Cloud Native Computing Foundation](https://cncf.io) Sandbox project.
28−
29−![CNCF](https://www.cncf.io/wp-content/uploads/2023/04/cncf-main-site-logo.svg)
30−
31−The Linux Foundation® (TLF) has registered trademarks and uses trademarks. For a list of TLF trademarks, see [Trademark Usage](https://www.linuxfoundation.org/legal/trademark-usage).
32−
docs/versioned_docs/version-7.15.x/behaviour.mddeleted−26
@@ -1,26 +0,0 @@
1−---
2−id: behaviour
3−title: Behaviour
4−---
5−
6−1. Authentication Requirement: All requests passing through the proxy to upstream applications require authentication, excluding default proxy endpoints.
7− - Exception: If the request matches a skipped route (configured via `--skip-auth-route`):
8− - Authentication is not enforced, but the proxy will opportunistically attempt to validate a session cookie (`--cookie-name`) or JWT (`--skip-jwt-bearer-tokens`) if present in the request.
9− - Configured user info and authentication headers (e.g., `--pass-access-token`) are injected to upstream routes when validation succeeds.
10−
11−2. Unauthenticated Requests: When authentication is missing but required, the user is redirected to the configured Identity Provider (IdP) login page by default.
12− - Ajax Requests: If the request has `Accept: application/json` header:
13− - Returns `401 Unauthorized`.
14− - Invalid JWT Tokens: If `--skip-jwt-bearer-tokens` is set and the request includes an invalid JWT:
15− - Redirects to the login page by default.
16− - Returns `403 Forbidden` if `--bearer-token-login-fallback` is set to `false`.
17−
18−3. Post-Authentication: After successful authentication with the IdP, OAuth tokens are stored in the configured session store (cookie or Redis), and a cookie is set.
19−
20−4. Request Forwarding: The authenticated request is processed based on configuration:
21− - Forwarded to the configured upstream application with added user info and authentication headers, or
22− - Returns a valid status code for downstream processing by another proxy or load balancer (e.g., Nginx or Traefik).
23−
24−---
25−
26−Note: The proxy also provides a number of useful [endpoints](features/endpoints.md) for monitoring and management.
docs/versioned_docs/version-7.15.x/community/contribution.mddeleted−91
@@ -1,91 +0,0 @@
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−See the `go.mod` file in the root of this repository for the version of Go used by this project.
19−You can follow [the installation guide for Go](https://go.dev/doc/install),
20−and you can find this specific Go version on [the Go downloads page](https://go.dev/dl/).
21−
22−# Preparing your fork
23−Clone your fork, create a feature branch and update the depedencies to get started.
24−```bash
25−git clone git@github.com:<YOUR_FORK>/oauth2-proxy
26−cd oauth2-proxy
27−git branch feature/<BRANCH_NAME>
28−git push --set-upstream origin feature/<BRANCH_NAME>
29−go mod download
30−```
31−
32−
33−# Testing / Debugging
34−For starting oauth2-proxy locally open the debugging tab and create the `launch.json` and select `Go: Launch Package`.
35−
36−![Debugging Tab](/img/debug-tab.png)
37−```json
38−{
39− "version": "0.2.0",
40− "configurations": [
41− {
42− "name": "Launch OAuth2 Proxy with Dex",
43− "type": "go",
44− "request": "launch",
45− "mode": "auto",
46− "program": "${workspaceFolder}",
47− "args": [
48− "--config",
49− // The following configuration contains settings for a locally deployed
50− // upstream and dex as an idetity provider
51− "contrib/local-environment/oauth2-proxy.cfg"
52− ]
53− },
54− {
55− "name": "Launch OAuth2 Proxy with Keycloak",
56− "type": "go",
57− "request": "launch",
58− "mode": "auto",
59− "program": "${workspaceFolder}",
60− "args": [
61− "--config",
62− // The following configuration contains settings for a locally deployed
63− // upstream and keycloak as an idetity provider
64− "contrib/local-environment/oauth2-proxy-keycloak.cfg"
65− ]
66− }
67− ]
68−}
69−```
70−
71−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.
72−
73−Inside the `contrib/local-environment` directory you can use the `Makefile` for
74−starting different example setups:
75−
76−- Dex as your IdP: `make up` or `make down`
77−- Dex as your IdP using the alpha-config: `make alpha-config-up`
78−- Keycloak as your IdP: `make keycloak-up`
79−- Dex as your IdP & nginx reverse proxy: `make nginx-up`
80−- and many more...
81−
82−Check out the `Makefile` to see what is available.
83−
84−The username and password for all setups is usually `admin@example.com` and `password`.
85−
86−The docker compose setups expose the services with a dynamic reverse DNS resolver: localtest.me
87−
88−- OAuth2 Proxy: http://oauth2-proxy.localtest.me:4180
89−- Upstream: http://httpbin.localtest.me:8080
90−- Dex: http://dex.localtest.me:5556
91−
docs/versioned_docs/version-7.15.x/community/security.mddeleted−49
@@ -1,49 +0,0 @@
1−---
2−id: security
3−title: Security
4−---
5−
6−:::note
7−OAuth2 Proxy is a community project.
8−Maintainers do not work on this project full time, and as such,
9−while we endeavour to respond to disclosures as quickly as possible,
10−this may take longer than in projects with corporate sponsorship.
11−:::
12−
13−## Security Disclosures
14−
15−:::important
16−If you believe you have found a vulnerability within OAuth2 Proxy or any of its
17−dependencies, please do NOT open an issue or PR on GitHub, please do NOT post
18−any details publicly.
19−:::
20−
21−Security disclosures MUST be done in private.
22−If you have found an issue that you would like to bring to the attention of the
23−maintenance team for OAuth2 Proxy, please compose an email and send it to the
24−list of maintainers in our [MAINTAINERS.md](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/MAINTAINERS.md) file.
25−
26−Please include as much detail as possible.
27−Ideally, your disclosure should include:
28−- A reproducible case that can be used to demonstrate the exploit
29−- How you discovered this vulnerability
30−- A potential fix for the issue (if you have thought of one)
31−- Versions affected (if not present in master)
32−- Your GitHub ID
33−
34−### How will we respond to disclosures?
35−
36−We use [GitHub Security Advisories](https://docs.github.com/en/github/managing-security-vulnerabilities/about-github-security-advisories)
37−to privately discuss fixes for disclosed vulnerabilities.
38−If you include a GitHub ID with your disclosure we will add you as a collaborator
39−for the advisory so that you can join the discussion and validate any fixes
40−we may propose.
41−
42−For minor issues and previously disclosed vulnerabilities (typically for
43−dependencies), we may use regular PRs for fixes and forego the security advisory.
44−
45−Once a fix has been agreed upon, we will merge the fix and create a new release.
46−If we have multiple security issues in flight simultaneously, we may delay
47−merging fixes until all patches are ready.
48−We may also backport the fix to previous releases,
49−but this will be at the discretion of the maintainers.
docs/versioned_docs/version-7.15.x/configuration/alpha_config.mddeleted−702
@@ -1,702 +0,0 @@
1−---
2−id: alpha-config
3−title: Alpha Configuration
4−---
5−
6−:::warning
7−This page contains documentation for alpha features.
8−We reserve the right to make breaking changes to the features detailed within this page with no notice.
9−
10−Options described in this page may be changed, removed, renamed or moved without prior warning.
11−Please beware of this before you use alpha configuration options.
12−:::
13−
14−This page details a set of **alpha** configuration options in a new format.
15−Going forward we are intending to add structured configuration in YAML format to
16−replace the existing TOML based configuration file and flags.
17−
18−Below is a reference for the structure of the configuration, with
19−[AlphaOptions](#alphaoptions) as the root of the configuration.
20−
21−When using alpha configuration, your config file will look something like below:
22−
23−```yaml
24−upstreams:
25− - id: ...
26− ...: ...
27−providers:
28− - id: ...
29− ...: ...
30−cookie:
31− secret: ...
32− ...: ...
33−injectRequestHeaders:
34− - secretSource:
35− ...: ...
36−injectResponseHeaders:
37− - claimSource:
38− ...: ...
39−```
40−
41−Please browse the [reference](#configuration-reference) below for the structure
42−of the new configuration format.
43−
44−# Migration Guide
45−
46−This section details breaking changes and migration steps for moving to the new
47−alpha configuration format.
48−
49−## Migrating header injections in v7.14.0
50−
51−From v7.14.0 onward, header injection sources must be explicitly nested. If you
52−previously relied on squashed fields, update to the new structure before
53−upgrading:
54−
55−```yaml
56−# before v7.14.0
57−injectRequestHeaders:
58−- name: X-Forwarded-User
59− values:
60− - claim: user
61−- name: X-Custom-Secret-header
62− values:
63− - value: my-super-secret
64−
65−# v7.14.0 and later
66−injectRequestHeaders:
67−- name: X-Forwarded-User
68− values:
69− - claimSource:
70− claim: user
71−- name: X-Custom-Secret-header
72− values:
73− - secretSource:
74− value: my-super-secret
75−```
76−
77−## Using Alpha Configuration
78−
79−To use the new **alpha** configuration, generate a YAML file based on the format
80−described in the [reference](#configuration-reference) below.
81−
82−Provide the path to this file using the `--alpha-config` flag.
83−
84−:::note
85−When using the `--alpha-config` flag, some options are no longer available.
86−See [removed options](#removed-options) below for more information.
87−:::
88−
89−### Converting configuration to the new structure
90−
91−Before adding the new `--alpha-config` option, start OAuth2 Proxy using the
92−`convert-config-to-alpha` flag to convert existing configuration to the new format.
93−
94−```bash
95−oauth2-proxy --convert-config-to-alpha --config ./path/to/existing/config.cfg
96−```
97−
98−This will convert any options supported by the new format to YAML and print the
99−new configuration to `STDOUT`.
100−
101−Copy this to a new file, remove any options from your existing configuration
102−noted in [removed options](#removed-options) and then start OAuth2 Proxy using
103−the new config.
104−
105−```bash
106−oauth2-proxy --alpha-config ./path/to/new/config.yaml --config ./path/to/existing/config.cfg
107−```
108−
109−### Validating Alpha Configuration
110−
111−Use `--config-test` to validate your alpha configuration without starting the proxy:
112−
113−```bash
114−oauth2-proxy --config core.cfg --alpha-config alpha.yaml --config-test
115−```
116−
117−This is useful for CI/CD pipelines to catch configuration errors before deployment.
118−See the [Configuration Validation](./overview.md#configuration-validation) section for more details.
119−
120−### How to use environment variables
121−
122−The alpha package supports the use of environment variables in place of yaml values, allowing sensitive data to be pulled from somewhere other than the yaml file.
123−When using environment variables, your yaml will look like this:
124−
125−```yaml
126− providers:
127− - provider: azure
128− clientSecret: ${CLIENT_SECRET}
129− ...
130−```
131−Where CLIENT_SECRET is an environment variable.
132−More information and available patterns can be found [here](https://github.com/a8m/envsubst#docs)
133−
134−### How to inject custom headers
135−
136−Configure `injectRequestHeaders` and `injectResponseHeaders` in alpha config YAML.
137−
138−```yaml
139−injectRequestHeaders:
140− - name: "X-User-Email"
141− values:
142− - claimSource:
143− claim: "email" # extract the email claim contents from the id token
144− - name: "X-Static-Secret"
145− values:
146− # secrets need to be encoded with base64 when directly in the yaml config but will be send decoded
147− - secretSource:
148− value: "c3VwZXItc2VjcmV0"
149− - name: "X-Static-File-Secret"
150− - secretSource:
151− fromFile: "/path/to/my/secret"
152− - name: "X-Static-Env-Secret"
153− - secretSource:
154− value: "${MY_SECRET_ENV}" # content still needs to be base64 encoded
155−injectResponseHeaders:
156− # Following will result in a header "Authorization: Basic <user:password> (encoded)"
157− - name: "Authorization"
158− values:
159− - claimSource:
160− claim: user
161− prefix: "Basic "
162− basicAuthPassword:
163− value: c3VwZXItc2VjcmV0LXBhc3N3b3Jk # base64 encoded password
164−```
165−
166−**Value sources:**
167−* `claimSource` - `claim` (session claims either from id token or from profile URL)
168−* `secretSource` - `value` (base64), `fromFile` (file path)
169−
170−**Request option:** `preserveRequestValue: true` retains existing header values
171−
172−**Incompatibility:** Remove legacy flags `pass-user-headers`, `set-xauthrequest`
173−
174−### How to utilize arbitrary claims provided by your Identity Provider
175−
176−With the additionalClaims attribute you can specify which claims you want to extract
177−from the ID Token or userinfo (ProfileURL) endpoint.
178−
179−Configure these on the relevant provider entry:
180−
181−```yaml
182−providers:
183− - id: my-oidc-provider
184− provider: oidc
185− clientID: ${OAUTH_CLIENT_ID}
186− clientSecret: ${OAUTH_CLIENT_SECRET}
187− oidcConfig:
188− issuerURL: https://issuer.example.com
189− profileURL: https://issuer.example.com/oauth2/userinfo
190− additionalClaims:
191− - department
192− - employee_id
193− - organization.name
194−```
195−
196−OAuth2 Proxy resolves each configured claim using the following order:
197−
198−1. The raw ID token is checked first.
199−2. If the claim is not present there and `profileURL` is configured, the userinfo endpoint is queried.
200−3. If `skipClaimsFromProfileURL: true` is set, only the ID token is used.
201−
202−Claims that are not found are ignored rather than causing authentication to fail.
203−
204−You can use dot-separated paths for nested JSON objects, for example `organization.name`.
205−Array indexes are not supported.
206−
207−Once loaded, these claims are stored in the session as `additionalClaims`. They can then be
208−used anywhere session claims are accepted, including header injection:
209−
210−```yaml
211−injectRequestHeaders:
212− - name: X-Department
213− values:
214− - claimSource:
215− claim: department
216− - name: X-Organization
217− values:
218− - claimSource:
219− claim: organization.name
220−```
221−
222−This is useful when your IdP exposes application-specific attributes such as department,
223−tenant, employee ID, entitlement, or other custom claims that are not part of the default
224−OAuth2 Proxy session fields.
225−
226−## Removed options
227−
228−The following flags/options and their respective environment variables are no
229−longer available when using alpha configuration:
230−
231−<!-- Legacy Upstream FlagSet -->
232−- `flush-interval`/`flush_interval`
233−- `pass-host-header`/`pass_host_header`
234−- `proxy-websockets`/`proxy_websockets`
235−- `ssl-upstream-insecure-skip-verify`/`ssl_upstream_insecure_skip_verify`
236−- `upstream`/`upstreams`
237−
238−<!-- Legacy Headers FlagSet -->
239−- `pass-basic-auth`/`pass_basic_auth`
240−- `pass-access-token`/`pass_access_token`
241−- `pass-user-headers`/`pass_user_headers`
242−- `pass-authorization-header`/`pass_authorization_header`
243−- `set-basic-auth`/`set_basic_auth`
244−- `set-xauthrequest`/`set_xauthrequest`
245−- `set-authorization-header`/`set_authorization_header`
246−- `prefer-email-to-user`/`prefer_email_to_user`
247−- `basic-auth-password`/`basic_auth_password`
248−- `skip-auth-strip-headers`/`skip_auth_strip_headers`
249−
250−<!-- Legacy provider FlagSet -->
251−- `client-id`/`client_id`
252−- `client-secret`/`client_secret`, and `client-secret-file`/`client_secret_file`
253−- `provider`
254−- `provider-display-name`/`provider_display_name`
255−- `provider-ca-file`/`provider_ca_files`
256−- `login-url`/`login_url`
257−- `redeem-url`/`redeem_url`
258−- `profile-url`/`profile_url`
259−- `resource`
260−- `validate-url`/`validate_url`
261−- `scope`
262−- `prompt`
263−- `approval-prompt`/`approval_prompt`
264−- `acr-values`/`acr_values`
265−- `user-id-claim`/`user_id_claim`
266−- `allowed-group`/`allowed_groups`
267−- `allowed-role`/`allowed_roles`
268−- `jwt-key`/`jwt_key`
269−- `jwt-key-file`/`jwt_key_file`
270−- `pubjwk-url`/`pubjwk_url`
271−
272−and all provider-specific options, i.e. any option whose name includes `oidc`,
273−`azure`, `bitbucket`, `github`, `gitlab`, `google` or `keycloak`. Attempting to
274−use any of these options via flags or via config when `--alpha-config` is
275−set will result in an error.
276−
277−:::important
278−You must remove these options before starting OAuth2 Proxy with `--alpha-config`
279−:::
280−
281−## Configuration Reference
282−
283−<!--- THIS FILE IS AUTOGENERATED!!! DO NOT EDIT!!! -->
284−
285−### ADFSOptions
286−
287−(**Appears on:** [Provider](#provider))
288−
289−
290−
291−| Field | Type | Description |
292−| ----- | ---- | ----------- |
293−| `skipScope` | _bool_ | Skip adding the scope parameter in login request<br/>Default value is 'false' |
294−
295−### AlphaOptions
296−
297−AlphaOptions contains alpha structured configuration options.
298−Usage of these options allows users to access alpha features that are not
299−available as part of the primary configuration structure for OAuth2 Proxy.
300−
301−:::warning
302−The options within this structure are considered alpha.
303−They may change between releases without notice.
304−:::
305−
306−| Field | Type | Description |
307−| ----- | ---- | ----------- |
308−| `upstreamConfig` | _[UpstreamConfig](#upstreamconfig)_ | UpstreamConfig is used to configure upstream servers.<br/>Once a user is authenticated, requests to the server will be proxied to<br/>these upstream servers based on the path mappings defined in this list. |
309−| `injectRequestHeaders` | _[[]Header](#header)_ | InjectRequestHeaders is used to configure headers that should be added<br/>to requests to upstream servers.<br/>Headers may source values from either the authenticated user's session<br/>or from a static secret value. |
310−| `injectResponseHeaders` | _[[]Header](#header)_ | InjectResponseHeaders is used to configure headers that should be added<br/>to responses from the proxy.<br/>This is typically used when using the proxy as an external authentication<br/>provider in conjunction with another proxy such as NGINX and its<br/>auth_request module.<br/>Headers may source values from either the authenticated user's session<br/>or from a static secret value. |
311−| `server` | _[Server](#server)_ | Server is used to configure the HTTP(S) server for the proxy application.<br/>You may choose to run both HTTP and HTTPS servers simultaneously.<br/>This can be done by setting the BindAddress and the SecureBindAddress simultaneously.<br/>To use the secure server you must configure a TLS certificate and key. |
312−| `metricsServer` | _[Server](#server)_ | MetricsServer is used to configure the HTTP(S) server for metrics.<br/>You may choose to run both HTTP and HTTPS servers simultaneously.<br/>This can be done by setting the BindAddress and the SecureBindAddress simultaneously.<br/>To use the secure server you must configure a TLS certificate and key. |
313−| `providers` | _[Providers](#providers)_ | Providers is used to configure your provider. **Multiple-providers is not<br/>yet working.** [This feature is tracked in<br/>#925](https://github.com/oauth2-proxy/oauth2-proxy/issues/926) |
314−
315−### AzureOptions
316−
317−(**Appears on:** [Provider](#provider))
318−
319−
320−
321−| Field | Type | Description |
322−| ----- | ---- | ----------- |
323−| `tenant` | _string_ | Tenant directs to a tenant-specific or common (tenant-independent) endpoint<br/>Default value is 'common' |
324−| `graphGroupField` | _string_ | GraphGroupField configures the group field to be used when building the groups list from Microsoft Graph<br/>Default value is 'id' |
325−
326−### BitbucketOptions
327−
328−(**Appears on:** [Provider](#provider))
329−
330−
331−
332−| Field | Type | Description |
333−| ----- | ---- | ----------- |
334−| `team` | _string_ | Team sets restrict logins to members of this team |
335−| `repository` | _string_ | Repository sets restrict logins to user with access to this repository |
336−
337−### ClaimSource
338−
339−(**Appears on:** [HeaderValue](#headervalue))
340−
341−ClaimSource allows loading a header value from a claim within the session
342−
343−| Field | Type | Description |
344−| ----- | ---- | ----------- |
345−| `claim` | _string_ | Claim is the name of the claim in the session that the value should be<br/>loaded from. Available claims: `access_token` `id_token` `created_at`<br/>`expires_on` `refresh_token` `email` `user` `groups` `preferred_username`. |
346−| `prefix` | _string_ | Prefix is an optional prefix that will be prepended to the value of the<br/>claim if it is non-empty. |
347−| `basicAuthPassword` | _[SecretSource](#secretsource)_ | BasicAuthPassword converts this claim into a basic auth header.<br/>Note the value of claim will become the basic auth username and the<br/>basicAuthPassword will be used as the password value. |
348−
349−### GitHubOptions
350−
351−(**Appears on:** [Provider](#provider))
352−
353−
354−
355−| Field | Type | Description |
356−| ----- | ---- | ----------- |
357−| `org` | _string_ | Org sets restrict logins to members of this organisation |
358−| `team` | _string_ | Team sets restrict logins to members of this team |
359−| `repo` | _string_ | Repo sets restrict logins to collaborators of this repository |
360−| `token` | _string_ | Token is the token to use when verifying repository collaborators<br/>it must have push access to the repository |
361−| `users` | _[]string_ | Users allows users with these usernames to login<br/>even if they do not belong to the specified org and team or collaborators |
362−
363−### GitLabOptions
364−
365−(**Appears on:** [Provider](#provider))
366−
367−
368−
369−| Field | Type | Description |
370−| ----- | ---- | ----------- |
371−| `group` | _[]string_ | Group sets restrict logins to members of this group |
372−| `projects` | _[]string_ | Projects restricts logins to members of these projects |
373−
374−### GoogleOptions
375−
376−(**Appears on:** [Provider](#provider))
377−
378−
379−
380−| Field | Type | Description |
381−| ----- | ---- | ----------- |
382−| `group` | _[]string_ | Groups sets restrict logins to members of this Google group |
383−| `adminEmail` | _string_ | AdminEmail is the Google admin to impersonate for api calls |
384−| `serviceAccountJson` | _string_ | ServiceAccountJSON is the path to the service account json credentials |
385−| `useApplicationDefaultCredentials` | _bool_ | UseApplicationDefaultCredentials is a boolean whether to use Application Default Credentials instead of a ServiceAccountJSON |
386−| `targetPrincipal` | _string_ | TargetPrincipal is the Google Service Account used for Application Default Credentials |
387−| `useOrganizationID` | _bool_ | UseOrganizationId indicates whether to use the organization ID as the UserName claim |
388−| `adminAPIUserScope` | _string_ | admin scope needed for fetching user organization information from admin api, can be one of cloud, user or defaults to readonly |
389−
390−### Header
391−
392−(**Appears on:** [AlphaOptions](#alphaoptions))
393−
394−Header represents an individual header that will be added to a request or
395−response header.
396−
397−| Field | Type | Description |
398−| ----- | ---- | ----------- |
399−| `name` | _string_ | Name is the header name to be used for this set of values.<br/>Names should be unique within a list of Headers. |
400−| `preserveRequestValue` | _bool_ | PreserveRequestValue determines whether any values for this header<br/>should be preserved for the request to the upstream server.<br/>This option only applies to injected request headers.<br/>Defaults to false (headers that match this header will be stripped). |
401−| `InsecureSkipHeaderNormalization` | _bool_ | InsecureSkipHeaderNormalization disables normalizing the header name<br/>According to RFC 7230 Section 3.2 there aren't any rules about<br/>capitalization of header names, but the standard practice is to use<br/>Title-Case (e.g. X-Forwarded-For). By default, header names will be<br/>normalized to Title-Case and any incoming headers that match will be<br/>treated as the same header. Additionally underscores (_) in header names<br/>will be converted to dashes (-) when normalizing.<br/>Defaults to false (header names will be normalized). |
402−| `values` | _[[]HeaderValue](#headervalue)_ | Values contains the desired values for this header |
403−
404−### HeaderValue
405−
406−(**Appears on:** [Header](#header))
407−
408−HeaderValue represents a single header value and the sources that can
409−make up the header value
410−
411−| Field | Type | Description |
412−| ----- | ---- | ----------- |
413−| `value` | _[]byte_ | Value expects a base64 encoded string value. |
414−| `fromEnv` | _string_ | FromEnv expects the name of an environment variable. |
415−| `fromFile` | _string_ | FromFile expects a path to a file containing the secret value. |
416−| `claim` | _string_ | Claim is the name of the claim in the session that the value should be<br/>loaded from. Available claims: `access_token` `id_token` `created_at`<br/>`expires_on` `refresh_token` `email` `user` `groups` `preferred_username`. |
417−| `prefix` | _string_ | Prefix is an optional prefix that will be prepended to the value of the<br/>claim if it is non-empty. |
418−| `basicAuthPassword` | _[SecretSource](#secretsource)_ | BasicAuthPassword converts this claim into a basic auth header.<br/>Note the value of claim will become the basic auth username and the<br/>basicAuthPassword will be used as the password value. |
419−
420−### KeycloakOptions
421−
422−(**Appears on:** [Provider](#provider))
423−
424−
425−
426−| Field | Type | Description |
427−| ----- | ---- | ----------- |
428−| `groups` | _[]string_ | Group enables to restrict login to members of indicated group |
429−| `roles` | _[]string_ | Role enables to restrict login to users with role (only available when using the keycloak-oidc provider) |
430−
431−### LoginGovOptions
432−
433−(**Appears on:** [Provider](#provider))
434−
435−
436−
437−| Field | Type | Description |
438−| ----- | ---- | ----------- |
439−| `jwtKey` | _string_ | JWTKey is a private key in PEM format used to sign JWT, |
440−| `jwtKeyFile` | _string_ | JWTKeyFile is a path to the private key file in PEM format used to sign the JWT |
441−| `pubjwkURL` | _string_ | PubJWKURL is the JWK pubkey access endpoint |
442−
443−### LoginURLParameter
444−
445−(**Appears on:** [Provider](#provider))
446−
447−LoginURLParameter is the configuration for a single query parameter that
448−can be passed through from the `/oauth2/start` endpoint to the IdP login
449−URL. The "default" option specifies the default value or values (if any)
450−that will be passed to the IdP for this parameter, and "allow" is a list
451−of options for ways in which this parameter can be set or overridden via
452−the query string to `/oauth2/start`.
453−If _only_ a default is specified and no "allow" then the parameter is
454−effectively fixed - the default value will always be used and anything
455−passed to the start URL will be ignored. If _only_ "allow" is specified
456−but no default then the parameter will only be passed on to the IdP if
457−the caller provides it, and no value will be sent otherwise.
458−
459−Examples:
460−
461−# A parameter whose value is fixed
462−
463−```
464−name: organization
465−default:
466−- myorg
467−```
468−
469−A parameter that is not passed by default, but may be set to one of a
470−fixed set of values
471−
472−```
473−name: prompt
474−allow:
475−- value: login
476−- value: consent
477−- value: select_account
478−```
479−
480−A parameter that is passed by default but may be overridden by one of
481−a fixed set of values
482−
483−```
484−name: prompt
485−default: ["login"]
486−allow:
487−- value: consent
488−- value: select_account
489−```
490−
491−A parameter that may be overridden, but only by values that match a
492−regular expression. For example to restrict `login_hint` to email
493−addresses in your organization's domain:
494−
495−```
496−name: login_hint
497−allow:
498−- pattern: '^[^@]*@example\.com$'
499−# this allows at most one "@" sign, and requires "example.com" domain.
500−```
501−
502−Note that the YAML rules around exactly which characters are allowed
503−and/or require escaping in different types of string literals are
504−convoluted. For regular expressions the single quoted form is simplest
505−as backslash is not considered to be an escape character. Alternatively
506−use the "chomped block" format `|-`:
507−
508−```
509− - pattern: |-
510− ^[^@]*@example\.com$
511−
512−```
513−
514−The hyphen is important, a `|` block would have a trailing newline
515−character.
516−
517−| Field | Type | Description |
518−| ----- | ---- | ----------- |
519−| `name` | _string_ | Name specifies the name of the query parameter. |
520−| `default` | _[]string_ | _(Optional)_ Default specifies a default value or values that will be<br/>passed to the IdP if not overridden. |
521−| `allow` | _[[]URLParameterRule](#urlparameterrule)_ | _(Optional)_ Allow specifies rules about how the default (if any) may be<br/>overridden via the query string to `/oauth2/start`. Only<br/>values that match one or more of the allow rules will be<br/>forwarded to the IdP. |
522−
523−### MicrosoftEntraIDOptions
524−
525−(**Appears on:** [Provider](#provider))
526−
527−
528−
529−| Field | Type | Description |
530−| ----- | ---- | ----------- |
531−| `allowedTenants` | _[]string_ | AllowedTenants is a list of allowed tenants. In case of multi-tenant apps, incoming tokens are<br/>issued by different issuers and OIDC issuer verification needs to be disabled.<br/>When not specified, all tenants are allowed. Redundant for single-tenant apps<br/>(regular ID token validation matches the issuer). |
532−| `federatedTokenAuth` | _bool_ | FederatedTokenAuth enable oAuth2 client authentication with federated token projected<br/>by Entra Workload Identity plugin, instead of client secret. |
533−
534−### OIDCOptions
535−
536−(**Appears on:** [Provider](#provider))
537−
538−
539−
540−| Field | Type | Description |
541−| ----- | ---- | ----------- |
542−| `issuerURL` | _string_ | IssuerURL is the OpenID Connect issuer URL<br/>eg: https://accounts.google.com |
543−| `insecureAllowUnverifiedEmail` | _bool_ | InsecureAllowUnverifiedEmail prevents failures if an email address in an id_token is not verified<br/>default set to 'false' |
544−| `insecureSkipIssuerVerification` | _bool_ | InsecureSkipIssuerVerification skips verification of ID token issuers. When false, ID Token Issuers must match the OIDC discovery URL<br/>default set to 'false' |
545−| `insecureSkipNonce` | _bool_ | InsecureSkipNonce skips verifying the ID Token's nonce claim that must match<br/>the random nonce sent in the initial OAuth flow. Otherwise, the nonce is checked<br/>after the initial OAuth redeem & subsequent token refreshes.<br/>default set to 'true'<br/>Warning: In a future release, this will change to 'false' by default for enhanced security. |
546−| `skipDiscovery` | _bool_ | SkipDiscovery allows to skip OIDC discovery and use manually supplied Endpoints<br/>default set to 'false' |
547−| `jwksURL` | _string_ | JwksURL is the OpenID Connect JWKS URL<br/>eg: https://www.googleapis.com/oauth2/v3/certs |
548−| `publicKeyFiles` | _[]string_ | PublicKeyFiles is a list of paths pointing to public key files in PEM format to use<br/>for verifying JWT tokens |
549−| `emailClaim` | _string_ | EmailClaim indicates which claim contains the user email,<br/>default set to 'email' |
550−| `groupsClaim` | _string_ | GroupsClaim indicates which claim contains the user groups<br/>default set to 'groups' |
551−| `userIDClaim` | _string_ | UserIDClaim indicates which claim contains the user ID<br/>default set to 'email' |
552−| `audienceClaims` | _[]string_ | AudienceClaim allows to define any claim that is verified against the client id<br/>By default `aud` claim is used for verification. |
553−| `extraAudiences` | _[]string_ | ExtraAudiences is a list of additional audiences that are allowed<br/>to pass verification in addition to the client id. |
554−| `enabledSigningAlgs` | _[]string_ | EnabledSigningAlgs is a list of allowed JWT signing algorithms.<br/>When discovery is enabled, the effective set is the intersection<br/>between this list and the provider's discovered supported algorithms.<br/>By default `RS256` is used if nothing has been discovered or specified. |
555−
556−### Provider
557−
558−(**Appears on:** [Providers](#providers))
559−
560−Provider holds all configuration for a single provider
561−
562−| Field | Type | Description |
563−| ----- | ---- | ----------- |
564−| `clientID` | _string_ | ClientID is the OAuth Client ID that is defined in the provider<br/>This value is required for all providers. |
565−| `clientSecret` | _string_ | ClientSecret is the OAuth Client Secret that is defined in the provider<br/>This value is required for all providers. |
566−| `clientSecretFile` | _string_ | ClientSecretFile is the name of the file<br/>containing the OAuth Client Secret, it will be used if ClientSecret is not set. |
567−| `keycloakConfig` | _[KeycloakOptions](#keycloakoptions)_ | KeycloakConfig holds all configurations for Keycloak provider. |
568−| `azureConfig` | _[AzureOptions](#azureoptions)_ | AzureConfig holds all configurations for Azure provider. |
569−| `microsoftEntraIDConfig` | _[MicrosoftEntraIDOptions](#microsoftentraidoptions)_ | MicrosoftEntraIDConfig holds all configurations for Entra ID provider. |
570−| `ADFSConfig` | _[ADFSOptions](#adfsoptions)_ | ADFSConfig holds all configurations for ADFS provider. |
571−| `bitbucketConfig` | _[BitbucketOptions](#bitbucketoptions)_ | BitbucketConfig holds all configurations for Bitbucket provider. |
572−| `githubConfig` | _[GitHubOptions](#githuboptions)_ | GitHubConfig holds all configurations for GitHubC provider. |
573−| `gitlabConfig` | _[GitLabOptions](#gitlaboptions)_ | GitLabConfig holds all configurations for GitLab provider. |
574−| `googleConfig` | _[GoogleOptions](#googleoptions)_ | GoogleConfig holds all configurations for Google provider. |
575−| `oidcConfig` | _[OIDCOptions](#oidcoptions)_ | OIDCConfig holds all configurations for OIDC provider<br/>or providers utilize OIDC configurations. |
576−| `loginGovConfig` | _[LoginGovOptions](#logingovoptions)_ | LoginGovConfig holds all configurations for LoginGov provider. |
577−| `id` | _string_ | ID should be a unique identifier for the provider.<br/>This value is required for all providers. |
578−| `provider` | _[ProviderType](#providertype)_ | Type is the OAuth provider<br/>must be set from the supported providers group,<br/>otherwise 'Google' is set as default |
579−| `name` | _string_ | Name is the providers display name<br/>if set, it will be shown to the users in the login page. |
580−| `caFiles` | _[]string_ | CAFiles is a list of paths to CA certificates that should be used when connecting to the provider.<br/>If not specified, the default Go trust sources are used instead |
581−| `useSystemTrustStore` | _bool_ | UseSystemTrustStore determines if your custom CA files and the system trust store are used<br/>If set to true, your custom CA files and the system trust store are used otherwise only your custom CA files. |
582−| `loginURL` | _string_ | LoginURL is the authentication endpoint |
583−| `loginURLParameters` | _[[]LoginURLParameter](#loginurlparameter)_ | LoginURLParameters defines the parameters that can be passed from the start URL to the IdP login URL |
584−| `authRequestResponseMode` | _string_ | AuthRequestResponseMode defines the response mode to request during authorization request |
585−| `redeemURL` | _string_ | RedeemURL is the token redemption endpoint |
586−| `profileURL` | _string_ | ProfileURL is the profile access endpoint |
587−| `skipClaimsFromProfileURL` | _bool_ | SkipClaimsFromProfileURL allows to skip request to Profile URL for resolving claims not present in id_token<br/>default set to 'false' |
588−| `resource` | _string_ | ProtectedResource is the resource that is protected (Azure AD and ADFS only) |
589−| `validateURL` | _string_ | ValidateURL is the access token validation endpoint |
590−| `scope` | _string_ | Scope is the OAuth scope specification |
591−| `allowedGroups` | _[]string_ | AllowedGroups is a list of restrict logins to members of this group |
592−| `code_challenge_method` | _string_ | The code challenge method |
593−| `additionalClaims` | _[]string_ | Additional claims to be obtained from the upstream IDP, either from the id_token or from the userinfo endpoint if configured. |
594−| `backendLogoutURL` | _string_ | URL to call to perform backend logout, `{id_token}` would be replaced by the actual `id_token` if available in the session |
595−
596−### ProviderType
597−#### (`string` alias)
598−
599−(**Appears on:** [Provider](#provider))
600−
601−ProviderType is used to enumerate the different provider type options
602−Valid options are: adfs, azure, bitbucket, digitalocean facebook, github,
603−gitlab, google, keycloak, keycloak-oidc, linkedin, login.gov, nextcloud
604−and oidc.
605−
606−### Providers
607−
608−#### ([[]Provider](#provider) alias)
609−
610−(**Appears on:** [AlphaOptions](#alphaoptions))
611−
612−The provider can be selected using the `provider` configuration value, or
613−set in the [`providers` array using
614−AlphaConfig](https://oauth2-proxy.github.io/oauth2-proxy/configuration/alpha-config#providers).
615−However, [**the feature to implement multiple providers is not
616−complete**](https://github.com/oauth2-proxy/oauth2-proxy/issues/926).
617−
618−### SecretSource
619−
620−(**Appears on:** [ClaimSource](#claimsource), [HeaderValue](#headervalue), [TLS](#tls))
621−
622−SecretSource references an individual secret value.
623−Only one source within the struct should be defined at any time.
624−
625−| Field | Type | Description |
626−| ----- | ---- | ----------- |
627−| `value` | _[]byte_ | Value expects a base64 encoded string value. |
628−| `fromEnv` | _string_ | FromEnv expects the name of an environment variable. |
629−| `fromFile` | _string_ | FromFile expects a path to a file containing the secret value. |
630−
631−### Server
632−
633−(**Appears on:** [AlphaOptions](#alphaoptions))
634−
635−Server represents the configuration for an HTTP(S) server
636−
637−| Field | Type | Description |
638−| ----- | ---- | ----------- |
639−| `bindAddress` | _string_ | BindAddress is the address on which to serve traffic.<br/>Different types of bind addresses are supported:<br/>* `[http://]<addr>:<port>`<br/>* `fd:<int>` (case insensitive)<br/>* `unix://<path>`<br/>Unix sockets are created with default system umask mode, which can be overridden, e.g.: `unix://my-socket,mode=0777`<br/>Square brackets are required for ipv6 address, e.g. `http://[::1]:4180`<br/>Leave blank or set to "-" to disable. |
640−| `secureBindAddress` | _string_ | SecureBindAddress is the address on which to serve secure traffic.<br/>Secure bind addresses need to respond with valid SSL and use the following format:<br/>* `[https://]<addr>:<port>`<br/>Square brackets are required for ipv6 address, e.g. `https://[::1]:4180`<br/>Leave blank or set to "-" to disable. |
641−| `tls` | _[TLS](#tls)_ | TLS contains the information for loading the certificate and key for the<br/>secure traffic and further configuration for the TLS server. |
642−
643−### TLS
644−
645−(**Appears on:** [Server](#server))
646−
647−TLS contains the information for loading a TLS certificate and key
648−as well as an optional minimal TLS version that is acceptable.
649−
650−| Field | Type | Description |
651−| ----- | ---- | ----------- |
652−| `key` | _[SecretSource](#secretsource)_ | Key is the TLS key data to use.<br/>Typically this will come from a file. |
653−| `cert` | _[SecretSource](#secretsource)_ | Cert is the TLS certificate data to use.<br/>Typically this will come from a file. |
654−| `minVersion` | _string_ | MinVersion is the minimal TLS version that is acceptable.<br/>E.g. Set to "TLS1.3" to select TLS version 1.3 |
655−| `cipherSuites` | _[]string_ | CipherSuites is a list of TLS cipher suites that are allowed.<br/>E.g.:<br/>- TLS_RSA_WITH_RC4_128_SHA<br/>- TLS_RSA_WITH_AES_256_GCM_SHA384<br/>If not specified, the default Go safe cipher list is used.<br/>List of valid cipher suites can be found in the [crypto/tls documentation](https://pkg.go.dev/crypto/tls#pkg-constants). |
656−
657−### URLParameterRule
658−
659−(**Appears on:** [LoginURLParameter](#loginurlparameter))
660−
661−URLParameterRule represents a rule by which query parameters
662−passed to the `/oauth2/start` endpoint are checked to determine whether
663−they are valid overrides for the given parameter passed to the IdP's
664−login URL. Either Value or Pattern should be supplied, not both.
665−
666−| Field | Type | Description |
667−| ----- | ---- | ----------- |
668−| `value` | _string_ | A Value rule matches just this specific value |
669−| `pattern` | _string_ | A Pattern rule gives a regular expression that must be matched by<br/>some substring of the value. The expression is _not_ automatically<br/>anchored to the start and end of the value, if you _want_ to restrict<br/>the whole parameter value you must anchor it yourself with `^` and `$`. |
670−
671−### Upstream
672−
673−(**Appears on:** [UpstreamConfig](#upstreamconfig))
674−
675−Upstream represents the configuration for an upstream server.
676−Requests will be proxied to this upstream if the path matches the request path.
677−
678−| Field | Type | Description |
679−| ----- | ---- | ----------- |
680−| `id` | _string_ | ID should be a unique identifier for the upstream.<br/>This value is required for all upstreams. |
681−| `path` | _string_ | Path is used to map requests to the upstream server.<br/>The closest match will take precedence and all Paths must be unique.<br/>Path can also take a pattern when used with RewriteTarget.<br/>Path segments can be captured and matched using regular experessions.<br/>Eg:<br/>- `^/foo$`: Match only the explicit path `/foo`<br/>- `^/bar/$`: Match any path prefixed with `/bar/`<br/>- `^/baz/(.*)$`: Match any path prefixed with `/baz` and capture the remaining path for use with RewriteTarget |
682−| `rewriteTarget` | _string_ | RewriteTarget allows users to rewrite the request path before it is sent to<br/>the upstream server (for an HTTP/HTTPS upstream) or mapped to the filesystem<br/>(for a `file:` upstream).<br/>Use the Path to capture segments for reuse within the rewrite target.<br/>Eg: With a Path of `^/baz/(.*)`, a RewriteTarget of `/foo/$1` would rewrite<br/>the request `/baz/abc/123` to `/foo/abc/123` before proxying to the<br/>upstream server. Or if the upstream were `file:///app`, a request for<br/>`/baz/info.html` would return the contents of the file `/app/foo/info.html`. |
683−| `uri` | _string_ | The URI of the upstream server. This may be an HTTP(S) server of a File<br/>based URL. It may include a path, in which case all requests will be served<br/>under that path.<br/>Eg:<br/>- http://localhost:8080<br/>- https://service.localhost<br/>- https://service.localhost/path<br/>- file://host/path<br/>If the URI's path is "/base" and the incoming request was for "/dir",<br/>the upstream request will be for "/base/dir". |
684−| `insecureSkipTLSVerify` | _bool_ | InsecureSkipTLSVerify will skip TLS verification of upstream HTTPS hosts.<br/>This option is insecure and will allow potential Man-In-The-Middle attacks<br/>between OAuth2 Proxy and the upstream server.<br/>Defaults to false. |
685−| `static` | _bool_ | Static will make all requests to this upstream have a static response.<br/>The response will have a body of "Authenticated" and a response code<br/>matching StaticCode.<br/>If StaticCode is not set, the response will return a 200 response. |
686−| `staticCode` | _int_ | StaticCode determines the response code for the Static response.<br/>This option can only be used with Static enabled. |
687−| `flushInterval` | _duration_ | FlushInterval is the period between flushing the response buffer when<br/>streaming response from the upstream.<br/>Defaults to 1 second. |
688−| `passHostHeader` | _bool_ | PassHostHeader determines whether the request host header should be proxied<br/>to the upstream server.<br/>Defaults to true. |
689−| `proxyWebSockets` | _bool_ | ProxyWebSockets enables proxying of websockets to upstream servers<br/>Defaults to true. |
690−| `timeout` | _duration_ | Timeout is the maximum duration the server will wait for a response from the upstream server.<br/>Defaults to 30 seconds. |
691−| `disableKeepAlives` | _bool_ | DisableKeepAlives disables HTTP keep-alive connections to the upstream server.<br/>Defaults to false. |
692−
693−### UpstreamConfig
694−
695−(**Appears on:** [AlphaOptions](#alphaoptions))
696−
697−UpstreamConfig is a collection of definitions for upstream servers.
698−
699−| Field | Type | Description |
700−| ----- | ---- | ----------- |
701−| `proxyRawPath` | _bool_ | ProxyRawPath will pass the raw url path to upstream allowing for urls<br/>like: "/%2F/" which would otherwise be redirected to "/" |
702−| `upstreams` | _[[]Upstream](#upstream)_ | Upstreams represents the configuration for the upstream servers.<br/>Requests will be proxied to this upstream if the path matches the request path. |
docs/versioned_docs/version-7.15.x/configuration/alpha_config.md.tmpldeleted−281
@@ -1,281 +0,0 @@
1−---
2−id: alpha-config
3−title: Alpha Configuration
4−---
5−
6−:::warning
7−This page contains documentation for alpha features.
8−We reserve the right to make breaking changes to the features detailed within this page with no notice.
9−
10−Options described in this page may be changed, removed, renamed or moved without prior warning.
11−Please beware of this before you use alpha configuration options.
12−:::
13−
14−This page details a set of **alpha** configuration options in a new format.
15−Going forward we are intending to add structured configuration in YAML format to
16−replace the existing TOML based configuration file and flags.
17−
18−Below is a reference for the structure of the configuration, with
19−[AlphaOptions](#alphaoptions) as the root of the configuration.
20−
21−When using alpha configuration, your config file will look something like below:
22−
23−```yaml
24−upstreams:
25− - id: ...
26− ...: ...
27−providers:
28− - id: ...
29− ...: ...
30−cookie:
31− secret: ...
32− ...: ...
33−injectRequestHeaders:
34− - secretSource:
35− ...: ...
36−injectResponseHeaders:
37− - claimSource:
38− ...: ...
39−```
40−
41−Please browse the [reference](#configuration-reference) below for the structure
42−of the new configuration format.
43−
44−# Migration Guide
45−
46−This section details breaking changes and migration steps for moving to the new
47−alpha configuration format.
48−
49−## Migrating header injections in v7.14.0
50−
51−From v7.14.0 onward, header injection sources must be explicitly nested. If you
52−previously relied on squashed fields, update to the new structure before
53−upgrading:
54−
55−```yaml
56−# before v7.14.0
57−injectRequestHeaders:
58−- name: X-Forwarded-User
59− values:
60− - claim: user
61−- name: X-Custom-Secret-header
62− values:
63− - value: my-super-secret
64−
65−# v7.14.0 and later
66−injectRequestHeaders:
67−- name: X-Forwarded-User
68− values:
69− - claimSource:
70− claim: user
71−- name: X-Custom-Secret-header
72− values:
73− - secretSource:
74− value: my-super-secret
75−```
76−
77−## Using Alpha Configuration
78−
79−To use the new **alpha** configuration, generate a YAML file based on the format
80−described in the [reference](#configuration-reference) below.
81−
82−Provide the path to this file using the `--alpha-config` flag.
83−
84−:::note
85−When using the `--alpha-config` flag, some options are no longer available.
86−See [removed options](#removed-options) below for more information.
87−:::
88−
89−### Converting configuration to the new structure
90−
91−Before adding the new `--alpha-config` option, start OAuth2 Proxy using the
92−`convert-config-to-alpha` flag to convert existing configuration to the new format.
93−
94−```bash
95−oauth2-proxy --convert-config-to-alpha --config ./path/to/existing/config.cfg
96−```
97−
98−This will convert any options supported by the new format to YAML and print the
99−new configuration to `STDOUT`.
100−
101−Copy this to a new file, remove any options from your existing configuration
102−noted in [removed options](#removed-options) and then start OAuth2 Proxy using
103−the new config.
104−
105−```bash
106−oauth2-proxy --alpha-config ./path/to/new/config.yaml --config ./path/to/existing/config.cfg
107−```
108−
109−### Validating Alpha Configuration
110−
111−Use `--config-test` to validate your alpha configuration without starting the proxy:
112−
113−```bash
114−oauth2-proxy --config core.cfg --alpha-config alpha.yaml --config-test
115−```
116−
117−This is useful for CI/CD pipelines to catch configuration errors before deployment.
118−See the [Configuration Validation](./overview.md#configuration-validation) section for more details.
119−
120−### How to use environment variables
121−
122−The alpha package supports the use of environment variables in place of yaml values, allowing sensitive data to be pulled from somewhere other than the yaml file.
123−When using environment variables, your yaml will look like this:
124−
125−```yaml
126− providers:
127− - provider: azure
128− clientSecret: ${CLIENT_SECRET}
129− ...
130−```
131−Where CLIENT_SECRET is an environment variable.
132−More information and available patterns can be found [here](https://github.com/a8m/envsubst#docs)
133−
134−### How to inject custom headers
135−
136−Configure `injectRequestHeaders` and `injectResponseHeaders` in alpha config YAML.
137−
138−```yaml
139−injectRequestHeaders:
140− - name: "X-User-Email"
141− values:
142− - claimSource:
143− claim: "email" # extract the email claim contents from the id token
144− - name: "X-Static-Secret"
145− values:
146− # secrets need to be encoded with base64 when directly in the yaml config but will be send decoded
147− - secretSource:
148− value: "c3VwZXItc2VjcmV0"
149− - name: "X-Static-File-Secret"
150− - secretSource:
151− fromFile: "/path/to/my/secret"
152− - name: "X-Static-Env-Secret"
153− - secretSource:
154− value: "${MY_SECRET_ENV}" # content still needs to be base64 encoded
155−injectResponseHeaders:
156− # Following will result in a header "Authorization: Basic <user:password> (encoded)"
157− - name: "Authorization"
158− values:
159− - claimSource:
160− claim: user
161− prefix: "Basic "
162− basicAuthPassword:
163− value: c3VwZXItc2VjcmV0LXBhc3N3b3Jk # base64 encoded password
164−```
165−
166−**Value sources:**
167−* `claimSource` - `claim` (session claims either from id token or from profile URL)
168−* `secretSource` - `value` (base64), `fromFile` (file path)
169−
170−**Request option:** `preserveRequestValue: true` retains existing header values
171−
172−**Incompatibility:** Remove legacy flags `pass-user-headers`, `set-xauthrequest`
173−
174−### How to utilize arbitrary claims provided by your Identity Provider
175−
176−With the additionalClaims attribute you can specify which claims you want to extract
177−from the ID Token or userinfo (ProfileURL) endpoint.
178−
179−Configure these on the relevant provider entry:
180−
181−```yaml
182−providers:
183− - id: my-oidc-provider
184− provider: oidc
185− clientID: ${OAUTH_CLIENT_ID}
186− clientSecret: ${OAUTH_CLIENT_SECRET}
187− oidcConfig:
188− issuerURL: https://issuer.example.com
189− profileURL: https://issuer.example.com/oauth2/userinfo
190− additionalClaims:
191− - department
192− - employee_id
193− - organization.name
194−```
195−
196−OAuth2 Proxy resolves each configured claim using the following order:
197−
198−1. The raw ID token is checked first.
199−2. If the claim is not present there and `profileURL` is configured, the userinfo endpoint is queried.
200−3. If `skipClaimsFromProfileURL: true` is set, only the ID token is used.
201−
202−Claims that are not found are ignored rather than causing authentication to fail.
203−
204−You can use dot-separated paths for nested JSON objects, for example `organization.name`.
205−Array indexes are not supported.
206−
207−Once loaded, these claims are stored in the session as `additionalClaims`. They can then be
208−used anywhere session claims are accepted, including header injection:
209−
210−```yaml
211−injectRequestHeaders:
212− - name: X-Department
213− values:
214− - claimSource:
215− claim: department
216− - name: X-Organization
217− values:
218− - claimSource:
219− claim: organization.name
220−```
221−
222−This is useful when your IdP exposes application-specific attributes such as department,
223−tenant, employee ID, entitlement, or other custom claims that are not part of the default
224−OAuth2 Proxy session fields.
225−
226−## Removed options
227−
228−The following flags/options and their respective environment variables are no
229−longer available when using alpha configuration:
230−
231−<!-- Legacy Upstream FlagSet -->
232−- `flush-interval`/`flush_interval`
233−- `pass-host-header`/`pass_host_header`
234−- `proxy-websockets`/`proxy_websockets`
235−- `ssl-upstream-insecure-skip-verify`/`ssl_upstream_insecure_skip_verify`
236−- `upstream`/`upstreams`
237−
238−<!-- Legacy Headers FlagSet -->
239−- `pass-basic-auth`/`pass_basic_auth`
240−- `pass-access-token`/`pass_access_token`
241−- `pass-user-headers`/`pass_user_headers`
242−- `pass-authorization-header`/`pass_authorization_header`
243−- `set-basic-auth`/`set_basic_auth`
244−- `set-xauthrequest`/`set_xauthrequest`
245−- `set-authorization-header`/`set_authorization_header`
246−- `prefer-email-to-user`/`prefer_email_to_user`
247−- `basic-auth-password`/`basic_auth_password`
248−- `skip-auth-strip-headers`/`skip_auth_strip_headers`
249−
250−<!-- Legacy provider FlagSet -->
251−- `client-id`/`client_id`
252−- `client-secret`/`client_secret`, and `client-secret-file`/`client_secret_file`
253−- `provider`
254−- `provider-display-name`/`provider_display_name`
255−- `provider-ca-file`/`provider_ca_files`
256−- `login-url`/`login_url`
257−- `redeem-url`/`redeem_url`
258−- `profile-url`/`profile_url`
259−- `resource`
260−- `validate-url`/`validate_url`
261−- `scope`
262−- `prompt`
263−- `approval-prompt`/`approval_prompt`
264−- `acr-values`/`acr_values`
265−- `user-id-claim`/`user_id_claim`
266−- `allowed-group`/`allowed_groups`
267−- `allowed-role`/`allowed_roles`
268−- `jwt-key`/`jwt_key`
269−- `jwt-key-file`/`jwt_key_file`
270−- `pubjwk-url`/`pubjwk_url`
271−
272−and all provider-specific options, i.e. any option whose name includes `oidc`,
273−`azure`, `bitbucket`, `github`, `gitlab`, `google` or `keycloak`. Attempting to
274−use any of these options via flags or via config when `--alpha-config` is
275−set will result in an error.
276−
277−:::important
278−You must remove these options before starting OAuth2 Proxy with `--alpha-config`
279−:::
280−
281−## Configuration Reference
docs/versioned_docs/version-7.15.x/configuration/integrations/caddy.mddeleted−63
@@ -1,63 +0,0 @@
1−---
2−id: caddy
3−title: Caddy
4−---
5−
6−Integrate OAuth2 Proxy with Caddy v2 using the `forward_auth` directive.
7−
8−**Key features:**
9−- Simple forward_auth setup
10−- Automatic header handling
11−- Custom error handling and redirects
12−
13−## Configuring for use with the Caddy (v2) `forward_auth` directive
14−
15−The [Caddy `forward_auth` directive](https://caddyserver.com/docs/caddyfile/directives/forward_auth) allows Caddy to authenticate requests via the `oauth2-proxy`'s `/auth`.
16−
17−This example is for a simple reverse proxy setup where the `/oauth2/` path is kept under the same domain and failed auth requests (401 status returned) will be caught and redirected to the `sign_in` endpoint.
18−
19−**Following options need to be set on `oauth2-proxy`:**
20−- `--reverse-proxy=true`: Enables the use of `X-Forwarded-*` headers to determine redirects correctly
21−
22−```nginx title="Caddyfile"
23−example.com {
24− # Requests to /oauth2/* are proxied to oauth2-proxy without authentication.
25− # You can't use `reverse_proxy /oauth2/* oauth2-proxy.internal:4180` here because the reverse_proxy directive has lower precedence than the handle directive.
26− handle /oauth2/* {
27− reverse_proxy oauth2-proxy.internal:4180 {
28− # oauth2-proxy requires the X-Real-IP and X-Forwarded-{Proto,Host,Uri} headers.
29− # The reverse_proxy directive automatically sets X-Forwarded-{For,Proto,Host} headers.
30− header_up X-Real-IP {remote_host}
31− header_up X-Forwarded-Uri {uri}
32− }
33− }
34−
35− # Requests to other paths are first processed by oauth2-proxy for authentication.
36− handle {
37− forward_auth oauth2-proxy.internal:4180 {
38− uri /oauth2/auth
39−
40− # oauth2-proxy requires the X-Real-IP and X-Forwarded-{Proto,Host,Uri} headers.
41− # The forward_auth directive automatically sets the X-Forwarded-{For,Proto,Host,Method,Uri} headers.
42− header_up X-Real-IP {remote_host}
43−
44− # If needed, you can copy headers from the oauth2-proxy response to the request sent to the upstream.
45− # Make sure to configure the --set-xauthrequest flag to enable this feature.
46− #copy_headers X-Auth-Request-User X-Auth-Request-Email
47−
48− # If oauth2-proxy returns a 401 status, redirect the client to the sign-in page.
49− @error status 401
50− handle_response @error {
51− redir * /oauth2/sign_in?rd={scheme}://{host}{uri}
52− }
53− }
54−
55− # If oauth2-proxy returns a 2xx status, the request is then proxied to the upstream.
56− reverse_proxy upstream.internal:3000
57− }
58−}
59−```
60−
61−:::note
62−If you set up your OAuth2 provider to rotate your client secret, you can use the `client-secret-file` option to reload the secret when it is updated.
63−:::
docs/versioned_docs/version-7.15.x/configuration/integrations/headlamp.mddeleted−105
@@ -1,105 +0,0 @@
1−---
2−id: headlamp
3−title: Headlamp
4−---
5−
6−Modern, actively maintained Kubernetes web UI with OAuth2 Proxy integration examples.
7−
8−**Key features:**
9−- Active development and maintenance
10−- Modern, intuitive interface
11−- Multi-cluster support
12−- Plugin system
13−- Works with all OAuth2 providers
14−
15−## Configuring for use with Headlamp
16−
17−[Headlamp](https://headlamp.dev/) is a modern, user-friendly Kubernetes web UI that can be integrated with OAuth2 Proxy for authentication. This is a recommended alternative to the deprecated Kubernetes Dashboard.
18−
19−### Architecture
20−
21−```
22−User → Ingress → OAuth2 Proxy → Authentication Provider (e.g., Azure Entra ID)
23− ↓
24− Headlamp
25−```
26−
27−### Prerequisites
28−
29−- Kubernetes cluster (e.g., AKS, EKS, GKE, or self-hosted)
30−- Headlamp installed in the cluster
31−- OAuth2 provider configured (Azure Entra ID, Google, GitHub, etc.)
32−- Ingress controller (Nginx, Traefik, etc.)
33−
34−### Configuration Overview
35−
36−When integrating Headlamp with OAuth2 Proxy, the OAuth2 Proxy acts as a reverse proxy in front of Headlamp:
37−
38−1. User requests access to Headlamp
39−2. Ingress forwards to OAuth2 Proxy
40−3. OAuth2 Proxy authenticates the user via the OAuth2 provider
41−4. After successful authentication, OAuth2 Proxy proxies requests to Headlamp
42−5. Headlamp receives the authenticated user information via headers
43−
44−### OAuth2 Proxy Configuration
45−
46−Configure OAuth2 Proxy to proxy to the Headlamp service:
47−
48−```yaml
49−upstreamConfig:
50− upstreams:
51− - id: headlamp
52− path: /
53− uri: http://headlamp-service.headlamp-namespace.svc.cluster.local:4466
54−```
55−
56−Enable the necessary headers:
57−
58−```yaml
59−extraArgs:
60− reverse-proxy: true
61− pass-authorization-header: true
62− set-xauthrequest: true
63− email-domain: "*" # Or restrict to your organization
64−```
65−
66−### Example with Azure Entra ID on AKS
67−
68−For detailed instructions on deploying Headlamp with OAuth2 Proxy on Azure Kubernetes Service using Azure Entra ID, see the official Headlamp documentation:
69−
70−https://headlamp.dev/docs/latest/installation/in-cluster/aks-cluster-oauth/
71−
72−Key steps include:
73−
74−1. **Set up AKS with OIDC**: Enable Microsoft Entra ID authentication with Kubernetes RBAC
75−2. **Create Azure App Registration**: Configure redirect URI and create client secret
76−3. **Deploy Headlamp**: Install Headlamp via Helm in your cluster
77−4. **Deploy OAuth2 Proxy**: Configure OAuth2 Proxy with Entra ID provider settings and upstream pointing to Headlamp
78−5. **Configure Ingress**: Set up Ingress to route traffic through OAuth2 Proxy to Headlamp
79−6. **Set RBAC Policies**: Apply Kubernetes RBAC bindings based on users or groups
80−
81−### Integration with Other Providers
82−
83−The same integration pattern works with other OAuth2 providers supported by OAuth2 Proxy:
84−
85−- **Google**: Use the Google provider configuration
86−- **GitHub**: Use the GitHub provider configuration
87−- **GitLab**: Use the GitLab provider configuration
88−- **Keycloak**: Use the Keycloak OIDC provider configuration
89−- **Any OIDC Provider**: Use the generic OIDC provider configuration
90−
91−For provider-specific configuration examples, see the [OAuth Provider Configuration](../providers/index.md) documentation.
92−
93−### Benefits Over Kubernetes Dashboard
94−
95−Headlamp offers several advantages:
96−
97−- **Active Development**: Headlamp is actively maintained and developed
98−- **Modern UI**: Clean, intuitive interface with better UX
99−- **Plugin System**: Extensible with custom plugins
100−- **Multi-cluster Support**: Built-in support for managing multiple clusters
101−- **Desktop App**: Available as both web UI and desktop application
102−
103−:::note
104−If you set up your OAuth2 provider to rotate your client secret, you can use the `client-secret-file` option to reload the secret when it is updated.
105−:::
docs/versioned_docs/version-7.15.x/configuration/integrations/index.mddeleted−41
@@ -1,41 +0,0 @@
1−---
2−id: index
3−title: Integrations
4−---
5−
6−This section provides configuration examples for integrating OAuth2 Proxy with various reverse proxies, ingress controllers, and Kubernetes web UIs.
7−
8−## Reverse Proxies and Ingress Controllers
9−
10−OAuth2 Proxy can be integrated with popular reverse proxies and ingress controllers to add authentication to your applications:
11−
12−- [Nginx](nginx.md)
13−- [Traefik](traefik.md)
14−- [caddy](caddy.md)
15−
16−## Kubernetes Web UIs
17−
18−OAuth2 Proxy can also be used to add authentication to Kubernetes web user interfaces:
19−
20−- [Headlamp](headlamp.md) ✨ *Recommended*
21−- [Kubernetes Dashboard](kubernetes-dashboard.md) ⚠️ *Deprecated*
22−
23−:::tip
24−When integrating with Kubernetes web UIs, make sure to:
25−1. Configure the Ingress to pass the Authorization header with the bearer token
26−2. Increase buffer sizes for large OIDC tokens (especially with Azure Entra ID)
27−3. Set up appropriate Kubernetes RBAC permissions for your users or groups
28−:::
29−
30−## General Requirements
31−
32−Most integrations require the following OAuth2 Proxy configuration:
33−
34−- `--reverse-proxy=true`: Required to correctly handle `X-Forwarded-*` headers
35−- **Session storage**: For production deployments with large tokens due to a lot of claims like AD groups, use `--session-store-type=redis`
36−
37−For provider-specific configuration, see the [OAuth Provider Configuration](../providers/index.md) documentation.
38−
39−:::note
40−If you set up your OAuth2 provider to rotate your client secret, you can use the `client-secret-file` option to reload the secret when it is updated.
41−:::
docs/versioned_docs/version-7.15.x/configuration/integrations/kubernetes-dashboard.mddeleted−289
@@ -1,289 +0,0 @@
1−---
2−id: kubernetes-dashboard
3−title: Kubernetes Dashboard
4−---
5−
6−:::warning Deprecated Project
7−Kubernetes Dashboard has been deprecated and discontinued as of January 2025. See the [official announcement](https://github.com/kubernetes/dashboard/commit/0ba796dce6916bb6ca5da5ca0b3ab22cecfd1e18) for more information.
8−
9−You may want to consider alternative solutions such as [Headlamp](./headlamp.md).
10−:::
11−
12−## Kubernetes Dashboard on AKS with Azure Entra ID
13−
14−Integration guide for the deprecated Kubernetes Dashboard, including comprehensive Azure Entra ID configuration on AKS with detailed troubleshooting and RBAC setup.
15−
16−### Architecture
17−
18−```
19−User → Nginx Ingress → OAuth2 Proxy → Entra ID
20− ↓
21− Kubernetes Dashboard
22−```
23−
24−The integration flow:
25−1. Unauthenticated requests to Dashboard are intercepted by Nginx Ingress
26−2. Nginx redirects to OAuth2 Proxy for authentication
27−3. OAuth2 Proxy redirects to Entra ID login
28−4. After successful authentication, OAuth2 Proxy receives ID token from Entra ID
29−5. OAuth2 Proxy sets Authorization header with the bearer token
30−6. Nginx forwards the request with token to Kubernetes Dashboard
31−7. Dashboard validates the token and grants access based on AKS RBAC configuration
32−
33−### Prerequisites
34−
35−- AKS cluster with Entra ID integration enabled
36−- Kubernetes Dashboard installed (version 7.x or later)
37−- NGINX Ingress Controller installed
38−- Entra ID App Registration configured with:
39− - Redirect URI: `https://your-oauth2-domain.com/oauth2/callback`
40− - API Permissions: `openid`, `email`, `profile`
41− - Groups claim enabled (if using group-based RBAC)
42−- Users or groups assigned appropriate Kubernetes RBAC permissions
43−
44−### Alpha Configuration Example
45−
46−Using [Alpha Configuration](../alpha_config.md) with the OAuth2 Proxy Helm chart:
47−
48−```yaml
49−alphaConfig:
50− enabled: true
51− configData:
52− providers:
53− - id: azure-entra
54− provider: entra-id
55− clientID: YOUR_CLIENT_ID
56− clientSecret: YOUR_CLIENT_SECRET
57− oidcConfig:
58− issuerURL: https://login.microsoftonline.com/YOUR_TENANT_ID/v2.0
59− audienceClaims:
60− - aud
61− emailClaim: email
62− groupsClaim: groups
63− userIDClaim: oid
64− scope: openid email profile
65−
66− upstreamConfig:
67− upstreams:
68− - id: static
69− path: /
70− static: true
71− staticCode: 200
72−
73− # Response headers passed to Dashboard via Nginx
74− injectResponseHeaders:
75− - name: Authorization
76− values:
77− - claim: id_token
78− prefix: "Bearer "
79− - name: X-Auth-Request-User
80− values:
81− - claim: email
82− - name: X-Auth-Request-Email
83− values:
84− - claim: email
85− - name: X-Auth-Request-Groups
86− values:
87− - claim: groups
88−
89− server:
90− BindAddress: "0.0.0.0:4180"
91−
92−extraArgs:
93− cookie-domain: ".your-domain.com"
94− whitelist-domain: ".your-domain.com"
95− email-domain: "*" # Or restrict to your organization
96− skip-provider-button: true
97− reverse-proxy: true
98− pass-authorization-header: true
99− set-xauthrequest: true
100−
101−sessionStorage:
102− type: redis
103−
104−redis:
105− enabled: true
106− auth:
107− enabled: true
108−
109−ingress:
110− enabled: true
111− className: nginx
112− hosts:
113− - OAuth2 Proxy.your-domain.com
114− path: /oauth2
115− pathType: Prefix
116−```
117−
118−### Kubernetes Dashboard Ingress
119−
120−**Critical**: The Ingress must include `Authorization` in the `auth-response-headers` annotation:
121−
122−```yaml
123−apiVersion: networking.k8s.io/v1
124−kind: Ingress
125−metadata:
126− name: kubernetes-dashboard
127− namespace: kubernetes-dashboard
128− annotations:
129− nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
130− nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
131−
132− # OAuth2 Proxy authentication
133− nginx.ingress.kubernetes.io/auth-url: "https://OAuth2 Proxy.your-domain.com/oauth2/auth"
134− nginx.ingress.kubernetes.io/auth-signin: "https://OAuth2 Proxy.your-domain.com/oauth2/start?rd=$scheme://$best_http_host$request_uri"
135−
136− # Include Authorization header with bearer token
137− nginx.ingress.kubernetes.io/auth-response-headers: "Authorization, X-Auth-Request-User, X-Auth-Request-Email"
138−
139− # Buffer sizes for large tokens (Entra tokens can exceed 4KB)
140− nginx.ingress.kubernetes.io/proxy-buffer-size: "256k"
141− nginx.ingress.kubernetes.io/proxy-buffers-number: "4"
142− nginx.ingress.kubernetes.io/proxy-busy-buffers-size: "256k"
143−spec:
144− ingressClassName: nginx
145− tls:
146− - hosts:
147− - dashboard.your-domain.com
148− secretName: dashboard-tls
149− rules:
150− - host: dashboard.your-domain.com
151− http:
152− paths:
153− - path: /
154− pathType: Prefix
155− backend:
156− service:
157− name: kubernetes-dashboard-kong-proxy
158− port:
159− number: 443
160−```
161−
162−### RBAC Configuration
163−
164−Assign Kubernetes permissions to Entra ID users or groups.
165−
166−**User-based:**
167−```yaml
168−apiVersion: rbac.authorization.k8s.io/v1
169−kind: ClusterRoleBinding
170−metadata:
171− name: dashboard-user-admin
172−roleRef:
173− apiGroup: rbac.authorization.k8s.io
174− kind: ClusterRole
175− name: cluster-admin
176−subjects:
177− - kind: User
178− name: "user@your-domain.com" # Email from Entra ID token
179− apiGroup: rbac.authorization.k8s.io
180−```
181−
182−**Group-based (recommended):**
183−```yaml
184−apiVersion: rbac.authorization.k8s.io/v1
185−kind: ClusterRoleBinding
186−metadata:
187− name: dashboard-admins-group
188−roleRef:
189− apiGroup: rbac.authorization.k8s.io
190− kind: ClusterRole
191− name: cluster-admin
192−subjects:
193− - kind: Group
194− name: "YOUR_ENTRA_GROUP_OBJECT_ID" # Entra ID Group Object ID
195− apiGroup: rbac.authorization.k8s.io
196−```
197−
198−For production, create custom roles with limited permissions instead of using `cluster-admin`.
199−
200−### Troubleshooting
201−
202−**Dashboard still asks for token after authentication**
203−
204−Verify that:
205−1. `injectResponseHeaders` in alphaConfig includes Authorization header with id_token claim
206−2. Dashboard Ingress includes `Authorization` in `auth-response-headers` annotation
207−3. Buffer sizes are sufficient for large tokens (set to 256k as shown above)
208−4. Check OAuth2 Proxy logs for successful token generation: `kubectl logs -n OAuth2 Proxy <pod-name>`
209−
210−**"Unauthorized" or "Invalid token" errors**
211−
212−Common causes:
213−1. User/group not configured in Kubernetes RBAC
214− - Check: `kubectl get clusterrolebindings | grep <user-email>`
215−2. Token validation failed
216− - Verify AKS Entra ID integration is enabled
217− - Check Dashboard logs: `kubectl logs -n kubernetes-dashboard <pod-name>`
218−3. Incorrect OAuth2 Proxy configuration
219− - Ensure `reverse-proxy: true` is set
220− - Verify issuer URL matches your tenant
221−
222−**Groups not included in token**
223−
224−To include groups in the token:
225−1. In Entra ID App Registration, go to **Token configuration**
226−2. Add **groups claim** and select security groups
227−3. Or edit the manifest and add: `"groupMembershipClaims": "SecurityGroup"`
228−4. For 200+ groups, ensure scope includes `User.Read` for group overage handling
229−5. Verify groups appear in token: check OAuth2 Proxy logs
230−
231−**Session expires too quickly**
232−
233−Configure cookie expiration:
234−```yaml
235−extraArgs:
236− cookie-expire: "24h"
237− cookie-refresh: "1h"
238−```
239−
240−### Using Workload Identity (Passwordless)
241−
242−For production environments, use Workload Identity instead of client secrets:
243−
244−```yaml
245−config:
246− clientID: "YOUR_CLIENT_ID"
247− secretKeys: # Exclude client-secret
248− - client-id
249− - cookie-secret
250− cookieSecret: "YOUR_COOKIE_SECRET"
251−
252−serviceAccount:
253− annotations:
254− azure.workload.identity/client-id: YOUR_CLIENT_ID
255− azure.workload.identity/tenant-id: YOUR_TENANT_ID
256−
257−podLabels:
258− azure.workload.identity/use: "true"
259−
260−alphaConfig:
261− enabled: true
262− configData:
263− providers:
264− - id: azure-entra
265− provider: entra-id
266− clientID: YOUR_CLIENT_ID
267− oidcConfig:
268− issuerURL: https://login.microsoftonline.com/YOUR_TENANT_ID/v2.0
269− # ... other config
270− entraIdConfig:
271− federatedTokenAuth: true
272−```
273−
274−This requires:
275−- AKS with OIDC issuer and Workload Identity enabled
276−- Federated identity credential configured in Entra ID App Registration
277−- Service account annotated with `azure.workload.identity/client-id`
278−
279−For detailed Workload Identity setup instructions, see the [Workload Identity section](../providers/ms_entra_id.md#workload-identity) in the Microsoft Entra ID provider documentation.
280−
281−## Integration with Other Providers
282−
283−While this guide focuses on Azure Entra ID, Kubernetes Dashboard can be integrated with other OAuth2 providers supported by OAuth2 Proxy. The key requirements remain the same:
284−
285−1. **Authorization Header**: Pass the bearer token via the `Authorization` header
286−2. **RBAC Configuration**: Configure Kubernetes RBAC for your authentication provider's users/groups
287−3. **Buffer Sizes**: Ensure adequate buffer sizes for tokens (especially important for OIDC providers)
288−
289−For provider-specific configuration examples, see the [OAuth Provider Configuration](../providers/index.md) documentation.
docs/versioned_docs/version-7.15.x/configuration/integrations/nginx.mddeleted−174
@@ -1,174 +0,0 @@
1−---
2−id: nginx
3−title: Nginx
4−---
5−
6−Configure OAuth2 Proxy with Nginx using the `auth_request` directive. Includes examples for both standalone Nginx configurations and Kubernetes ingress-nginx with annotations.
7−
8−**Key features:**
9−- Support for `auth_request` directive
10−- Kubernetes Ingress annotations
11−- Multi-part cookie handling for large tokens
12−- Session refresh support
13−
14−## Configuring for use with the Nginx `auth_request` directive
15−
16−**This option requires `--reverse-proxy` option to be set.**
17−
18−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:
19−
20−```nginx
21−server {
22− listen 443 ssl;
23− server_name ...;
24− include ssl/ssl.conf;
25−
26− location /oauth2/ {
27− proxy_pass http://127.0.0.1:4180;
28− proxy_set_header Host $host;
29− proxy_set_header X-Real-IP $remote_addr;
30− proxy_set_header X-Auth-Request-Redirect $request_uri;
31− # or, if you are handling multiple domains:
32− # proxy_set_header X-Auth-Request-Redirect $scheme://$host$request_uri;
33− }
34− location = /oauth2/auth {
35− proxy_pass http://127.0.0.1:4180;
36− proxy_set_header Host $host;
37− proxy_set_header X-Real-IP $remote_addr;
38− proxy_set_header X-Forwarded-Uri $request_uri;
39− # nginx auth_request includes headers but not body
40− proxy_set_header Content-Length "";
41− proxy_pass_request_body off;
42− }
43−
44− location / {
45− auth_request /oauth2/auth;
46− error_page 401 = @oauth2_signin;
47−
48− # pass information via X-User and X-Email headers to backend,
49− # requires running with --set-xauthrequest flag
50− auth_request_set $user $upstream_http_x_auth_request_user;
51− auth_request_set $email $upstream_http_x_auth_request_email;
52− proxy_set_header X-User $user;
53− proxy_set_header X-Email $email;
54−
55− # if you enabled --pass-access-token, this will pass the token to the backend
56− auth_request_set $token $upstream_http_x_auth_request_access_token;
57− proxy_set_header X-Access-Token $token;
58−
59− # if you enabled --cookie-refresh, this is needed for it to work with auth_request
60− auth_request_set $auth_cookie $upstream_http_set_cookie;
61− add_header Set-Cookie $auth_cookie;
62−
63− # When using the --set-authorization-header flag, some provider's cookies can exceed the 4kb
64− # limit and so the OAuth2 Proxy splits these into multiple parts.
65− # Nginx normally only copies the first `Set-Cookie` header from the auth_request to the response,
66− # so if your cookies are larger than 4kb, you will need to extract additional cookies manually.
67− auth_request_set $auth_cookie_name_upstream_1 $upstream_cookie_auth_cookie_name_1;
68−
69− # Extract the Cookie attributes from the first Set-Cookie header and append them
70− # to the second part ($upstream_cookie_* variables only contain the raw cookie content)
71− if ($auth_cookie ~* "(; .*)") {
72− set $auth_cookie_name_0 $auth_cookie;
73− set $auth_cookie_name_1 "auth_cookie_name_1=$auth_cookie_name_upstream_1$1";
74− }
75−
76− # Send both Set-Cookie headers now if there was a second part
77− if ($auth_cookie_name_upstream_1) {
78− add_header Set-Cookie $auth_cookie_name_0;
79− add_header Set-Cookie $auth_cookie_name_1;
80− }
81−
82− proxy_pass http://backend/;
83− # or "root /path/to/site;" or "fastcgi_pass ..." etc
84− }
85−
86− # Named location for handling OAuth2 sign-in redirects
87− # This ensures the browser receives a proper 302 redirect that it will follow
88− location @oauth2_signin {
89− return 302 /oauth2/sign_in?rd=$scheme://$host$request_uri;
90− }
91−}
92−```
93−
94−### Understanding the `error_page` redirect pattern
95−
96−The `auth_request` directive expects the authentication endpoint (`/oauth2/auth`) to return:
97−- **2xx**: Request is authenticated, allow access
98−- **401 or 403**: Request is not authenticated, deny access
99−
100−When a 401 is returned, nginx triggers the `error_page` directive. The recommended pattern uses a **named location** (`@oauth2_signin`) that returns a proper **302 redirect**:
101−
102−```nginx
103−error_page 401 = @oauth2_signin;
104−
105−location @oauth2_signin {
106− return 302 /oauth2/sign_in?rd=$scheme://$host$request_uri;
107−}
108−```
109−
110−:::warning Avoid `error_page 401 =403` with sign_in
111−Some older configurations use `error_page 401 =403 /oauth2/sign_in`. While this works for displaying the sign-in page, it returns a **403 status code** with a `Location` header. Browsers do not automatically follow redirects on 403 responses, which can cause issues when using `--skip-provider-button=true` (users see a "Found." link instead of being automatically redirected).
112−
113−The named location pattern above ensures the browser receives a standard **302 redirect** that works correctly with all oauth2-proxy configurations.
114−:::
115−
116−### Browser vs API Routes
117−
118−:::important When to use redirects
119−Redirecting authentication failures (302 to `/oauth2/sign_in`) should **only be used for browser-facing routes**. API or machine clients should receive a plain 401/403 response without redirect.
120−:::
121−
122−#### Browser-facing routes (HTML, UI)
123−
124−For interactive browser routes where users should be redirected to sign in:
125−
126−```nginx
127−location / {
128− auth_request /oauth2/auth;
129− error_page 401 = @oauth2_signin;
130− proxy_pass http://backend/;
131−}
132−
133−location @oauth2_signin {
134− return 302 /oauth2/sign_in?rd=$scheme://$host$request_uri;
135−}
136−```
137−
138−#### API / Machine routes (no redirect)
139−
140−For API endpoints where clients expect a 401/403 status code (not a redirect):
141−
142−```nginx
143−location /api/ {
144− auth_request /oauth2/auth;
145− error_page 401 =401; # Pass through the 401 status
146− proxy_pass http://backend/;
147−}
148−```
149−
150−This ensures:
151−- ✅ Browsers get a redirect and smooth login flow
152−- ✅ API clients fail fast with appropriate HTTP status codes
153−- ✅ `/oauth2/auth` remains a pure boolean oracle (2xx/401)
154−
155−When you use ingress-nginx in Kubernetes, you can configure the same behavior with the following annotations on your Ingress resource:
156−
157−```yaml
158−nginx.ingress.kubernetes.io/auth-url: "https://<oauth2-proxy-fqdn>/oauth2/auth"
159−nginx.ingress.kubernetes.io/auth-signin: "https://<oauth2-proxy-fqdn>/oauth2/start?rd=$escaped_request_uri"
160−```
161−
162−This minimal configuration works for standard authentication flows. Lua/cookie handling is only needed for advanced scenarios (e.g., multi-part cookies, custom session logic). See the official ingress-nginx example: https://kubernetes.github.io/ingress-nginx/examples/auth/oauth-external-auth/.
163−
164−It is recommended to use `--session-store-type=redis` when expecting large sessions/OIDC tokens (_e.g._ with MS Azure).
165−
166−:::tip Kubernetes Dashboard with Azure Entra ID
167−For a complete example of integrating oauth2-proxy with Kubernetes Dashboard on AKS using Azure Entra ID, including RBAC configuration and troubleshooting, see the [Kubernetes Dashboard on AKS](../providers/ms_entra_id.md#kubernetes-dashboard-on-aks) section in the Microsoft Entra ID provider documentation.
168−:::
169−
170−You have to substitute *name* with the actual cookie name you configured via --cookie-name parameter. If you don't set a custom cookie name the variable should be "$upstream_cookie__oauth2_proxy_1" instead of "$upstream_cookie_name_1" and the new cookie-name should be "_oauth2_proxy_1=" instead of "name_1=".
171−
172−:::note
173−If you set up your OAuth2 provider to rotate your client secret, you can use the `client-secret-file` option to reload the secret when it is updated.
174−:::
docs/versioned_docs/version-7.15.x/configuration/integrations/traefik.mddeleted−192
@@ -1,192 +0,0 @@
1−---
2−id: traefik
3−title: Traefik
4−---
5−
6−Set up OAuth2 Proxy with Traefik v2 using the `ForwardAuth` middleware. Includes examples for both error-based redirects and static upstream configurations.
7−
8−**Key features:**
9−- ForwardAuth middleware integration
10−- Error middleware for 401 redirects
11−- Static upstream configuration (202 responses)
12−- Dynamic file configuration examples
13−
14−
15−## Configuring for use with the Traefik (v2) `ForwardAuth` middleware
16−
17−**This option requires `--reverse-proxy` option to be set.**
18−
19−### ForwardAuth with 401 errors middleware
20−
21−The [Traefik v2 `ForwardAuth` middleware](https://doc.traefik.io/traefik/middlewares/http/forwardauth/) allows Traefik to authenticate requests via the oauth2-proxy's `/oauth2/auth` endpoint on every request, which only returns a 202 Accepted response or a 401 Unauthorized response without proxying the whole request through. For example, on Dynamic File (YAML) Configuration:
22−
23−```yaml
24−http:
25− routers:
26− a-service:
27− rule: "Host(`a-service.example.com`)"
28− service: a-service-backend
29− middlewares:
30− - oauth-errors
31− - oauth-auth
32− tls:
33− certResolver: default
34− domains:
35− - main: "example.com"
36− sans:
37− - "*.example.com"
38− oauth:
39− rule: "Host(`a-service.example.com`, `oauth.example.com`) && PathPrefix(`/oauth2/`)"
40− middlewares:
41− - auth-headers
42− service: oauth-backend
43− tls:
44− certResolver: default
45− domains:
46− - main: "example.com"
47− sans:
48− - "*.example.com"
49−
50− services:
51− a-service-backend:
52− loadBalancer:
53− servers:
54− - url: http://172.16.0.2:7555
55− oauth-backend:
56− loadBalancer:
57− servers:
58− - url: http://172.16.0.1:4180
59−
60− middlewares:
61− auth-headers:
62− headers:
63− sslRedirect: true
64− stsSeconds: 315360000
65− browserXssFilter: true
66− contentTypeNosniff: true
67− forceSTSHeader: true
68− sslHost: example.com
69− stsIncludeSubdomains: true
70− stsPreload: true
71− frameDeny: true
72− oauth-auth:
73− forwardAuth:
74− address: https://oauth.example.com/oauth2/auth
75− trustForwardHeader: true
76− oauth-errors:
77− errors:
78− status:
79− - "401-403"
80− service: oauth-backend
81− query: "/oauth2/sign_in?rd={url}"
82− statusRewrites:
83− "401": 302
84−```
85−
86−:::caution Troubleshooting: Browser shows "Found." instead of redirecting
87−When using the Errors middleware without `statusRewrites`, the redirect response from oauth2-proxy can be served within the original 401/403 status context. This causes some browsers to display a "Found." link instead of automatically following the redirect to the identity provider.
88−
89−Adding `statusRewrites` to rewrite `401 -> 302` ensures the browser treats the response as a proper redirect and follows it automatically.
90−:::
91−
92−### ForwardAuth with static upstreams configuration
93−
94−Redirect to sign_in functionality provided without the use of `errors` middleware with [Traefik v2 `ForwardAuth` middleware](https://doc.traefik.io/traefik/middlewares/http/forwardauth/) pointing to oauth2-proxy service's `/` endpoint
95−
96−**Following options need to be set on `oauth2-proxy`:**
97−- `--upstream=static://202`: Configures a static response for authenticated sessions
98−- `--reverse-proxy=true`: Enables the use of `X-Forwarded-*` headers to determine redirects correctly
99−
100−```yaml
101−http:
102− routers:
103− a-service-route-1:
104− rule: "Host(`a-service.example.com`, `b-service.example.com`) && PathPrefix(`/`)"
105− service: a-service-backend
106− middlewares:
107− - oauth-auth-redirect # redirects all unauthenticated to oauth2 signin
108− tls:
109− certResolver: default
110− domains:
111− - main: "example.com"
112− sans:
113− - "*.example.com"
114− a-service-route-2:
115− rule: "Host(`a-service.example.com`) && PathPrefix(`/no-auto-redirect`)"
116− service: a-service-backend
117− middlewares:
118− - oauth-auth-wo-redirect # unauthenticated session will return a 401
119− tls:
120− certResolver: default
121− domains:
122− - main: "example.com"
123− sans:
124− - "*.example.com"
125− services-oauth2-route:
126− rule: "Host(`a-service.example.com`, `b-service.example.com`) && PathPrefix(`/oauth2/`)"
127− middlewares:
128− - auth-headers
129− service: oauth-backend
130− tls:
131− certResolver: default
132− domains:
133− - main: "example.com"
134− sans:
135− - "*.example.com"
136− oauth2-proxy-route:
137− rule: "Host(`oauth.example.com`) && PathPrefix(`/`)"
138− middlewares:
139− - auth-headers
140− service: oauth-backend
141− tls:
142− certResolver: default
143− domains:
144− - main: "example.com"
145− sans:
146− - "*.example.com"
147−
148− services:
149− a-service-backend:
150− loadBalancer:
151− servers:
152− - url: http://172.16.0.2:7555
153− b-service-backend:
154− loadBalancer:
155− servers:
156− - url: http://172.16.0.3:7555
157− oauth-backend:
158− loadBalancer:
159− servers:
160− - url: http://172.16.0.1:4180
161−
162− middlewares:
163− auth-headers:
164− headers:
165− sslRedirect: true
166− stsSeconds: 315360000
167− browserXssFilter: true
168− contentTypeNosniff: true
169− forceSTSHeader: true
170− sslHost: example.com
171− stsIncludeSubdomains: true
172− stsPreload: true
173− frameDeny: true
174− oauth-auth-redirect:
175− forwardAuth:
176− address: https://oauth.example.com/
177− trustForwardHeader: true
178− authResponseHeaders:
179− - X-Auth-Request-Access-Token
180− - Authorization
181− oauth-auth-wo-redirect:
182− forwardAuth:
183− address: https://oauth.example.com/oauth2/auth
184− trustForwardHeader: true
185− authResponseHeaders:
186− - X-Auth-Request-Access-Token
187− - Authorization
188−```
189−
190−:::note
191−If you set up your OAuth2 provider to rotate your client secret, you can use the `client-secret-file` option to reload the secret when it is updated.
192−:::
docs/versioned_docs/version-7.15.x/configuration/overview.mddeleted−451
@@ -1,451 +0,0 @@
1−---
2−id: overview
3−title: Overview
4−---
5−
6−`oauth2-proxy` can be configured via [command line options](#command-line-options), [environment variables](#environment-variables) or [config file](#config-file) (in decreasing order of precedence, i.e. command line options will overwrite environment variables and environment variables will overwrite configuration file settings).
7−
8−## Generating a Cookie Secret
9−
10−To generate a strong cookie secret use one of the below commands:
11−
12−import Tabs from '@theme/Tabs';
13−import TabItem from '@theme/TabItem';
14−
15−<Tabs defaultValue="python">
16− <TabItem value="python" label="Python">
17−
18−```shell
19−python -c 'import os,base64; print(base64.urlsafe_b64encode(os.urandom(32)).decode())'
20−```
21−
22− </TabItem>
23− <TabItem value="bash" label="Bash">
24−
25−```shell
26−dd if=/dev/urandom bs=32 count=1 2>/dev/null | base64 | tr -d -- '\n' | tr -- '+/' '-_' ; echo
27−```
28−
29− </TabItem>
30− <TabItem value="openssl" label="OpenSSL">
31−
32−```shell
33−openssl rand -base64 32 | tr -- '+/' '-_'
34−```
35−
36− </TabItem>
37− <TabItem value="powershell" label="PowerShell">
38−
39−```powershell
40−# Add System.Web assembly to session, just in case
41−Add-Type -AssemblyName System.Web
42−[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes([System.Web.Security.Membership]::GeneratePassword(32,4))).Replace("+","-").Replace("/","_")
43−```
44−
45− </TabItem>
46− <TabItem value="terraform" label="Terraform">
47−
48−```hcl
49−# Valid 32 Byte Base64 URL encoding set that will decode to 24 []byte AES-192 secret
50−resource "random_password" "cookie_secret" {
51− length = 32
52− override_special = "-_"
53−}
54−```
55−
56− </TabItem>
57−</Tabs>
58−
59−## Config File
60−
61−Every command line argument can be specified in a config file by replacing hyphens (-) with underscores (\_). If the argument can be specified multiple times, the config option should be plural (trailing s).
62−
63−An example [oauth2-proxy.cfg](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/contrib/oauth2-proxy.cfg.example) config file is in the contrib directory. It can be used by specifying `--config=/etc/oauth2-proxy.cfg`
64−
65−## Config Options
66−
67−### Command Line Options
68−
69−| Flag | Description |
70−| ---------------- | ------------------------------------------------------- |
71−| `--config` | path to config file |
72−| `--config-test` | test configuration and exit (for CI/CD validation) |
73−| `--version` | print version string |
74−
75−### General Provider Options
76−
77−Provider specific options can be found on their respective subpages.
78−
79−| Flag / Config Field | Type | Description | Default |
80−| --------------------------------------------------------------------------------------------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
81−| flag: `--acr-values`<br/>toml: `acr_values` | string | optional, see [docs](https://openid.net/specs/openid-connect-eap-acr-values-1_0.html#acrValues) | `""` |
82−| flag: `--allowed-group`<br/>toml: `allowed_groups` | string \| list | Restrict login to members of a group or list of groups. Furthermore, if you aren't setting the `scope` and use `allowed_groups` with the generic OIDC provider the scope `groups` gets added implicitly. | |
83−| flag: `--approval-prompt`<br/>toml: `approval_prompt` | string | OAuth approval_prompt | `"force"` |
84−| flag: `--backend-logout-url`<br/>toml: `backend_logout_url` | string | URL to perform backend logout, if you use `{id_token}` in the url it will be replaced by the actual `id_token` of the user session | |
85−| flag: `--client-id`<br/>toml: `client_id` | string | the OAuth Client ID, e.g. `"123456.apps.googleusercontent.com"` | |
86−| flag: `--client-secret-file`<br/>toml: `client_secret_file` | string | the file with OAuth Client Secret. The file must contain the secret only, with no trailing newline | |
87−| flag: `--client-secret`<br/>toml: `client_secret` | string | the OAuth Client Secret | |
88−| flag: `--code-challenge-method`<br/>toml: `code_challenge_method` | string | use PKCE code challenges with the specified method. Either 'plain' or 'S256' (recommended) | |
89−| flag: `--insecure-oidc-allow-unverified-email`<br/>toml: `insecure_oidc_allow_unverified_email` | bool | don't fail if an email address in an id_token is not verified | false |
90−| flag: `--insecure-oidc-skip-issuer-verification`<br/>toml: `insecure_oidc_skip_issuer_verification` | bool | allow the OIDC issuer URL to differ from the expected (currently required for Azure multi-tenant compatibility) | false |
91−| flag: `--insecure-oidc-skip-nonce`<br/>toml: `insecure_oidc_skip_nonce` | bool | skip verifying the OIDC ID Token's nonce claim | true |
92−| flag: `--jwt-key-file`<br/>toml: `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 | |
93−| flag: `--jwt-key`<br/>toml: `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 | |
94−| flag: `--login-url`<br/>toml: `login_url` | string | Authentication endpoint | |
95−| flag: `--auth-request-response-mode`<br/>toml: `auth-request-response-mode` | string | Response mode to ask for during authentication request | |
96−| flag: `--oidc-audience-claim`<br/>toml: `oidc_audience_claims` | string | which OIDC claim contains the audience | `"aud"` |
97−| flag: `--oidc-email-claim`<br/>toml: `oidc_email_claim` | string | which OIDC claim contains the user's email | `"email"` |
98−| flag: `--oidc-extra-audience`<br/>toml: `oidc_extra_audiences` | string \| list | additional audiences which are allowed to pass verification | `"[]"` |
99−| flag: `--oidc-groups-claim`<br/>toml: `oidc_groups_claim` | string | which OIDC claim contains the user groups | `"groups"` |
100−| flag: `--oidc-issuer-url`<br/>toml: `oidc_issuer_url` | string | the OpenID Connect issuer URL, e.g. `"https://accounts.google.com"` | |
101−| flag: `--oidc-jwks-url`<br/>toml: `oidc_jwks_url` | string | OIDC JWKS URI for token verification; required if OIDC discovery is disabled and public key files are not provided | |
102−| flag: `--oidc-public-key-file`<br/>toml: `oidc_public_key_files` | string | Path to public key file in PEM format to use for verifying JWT tokens (may be given multiple times). Required if OIDC discovery is disabled na JWKS URL isn't provided | |
103−| flag: `--oidc-enabled-signing-alg`<br/>toml: `oidc_enabled_signing_algs` | string \| list | List of allowed JWT signing algorithms. When oidc discovery is enabled, the effective set is the intersection between this list and the provider's discovered supported algorithms. | |
104−| flag: `--profile-url`<br/>toml: `profile_url` | string | Profile access endpoint | |
105−| flag: `--prompt`<br/>toml: `prompt` | string | [OIDC prompt](https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest); if present, `approval-prompt` is ignored | `""` |
106−| flag: `--provider-ca-file`<br/>toml: `provider_ca_files` | string \| list | Paths to CA certificates that should be used when connecting to the provider. If not specified, the default Go trust sources are used instead. | |
107−| flag: `--provider-display-name`<br/>toml: `provider_display_name` | string | Override the provider's name with the given string; used for the sign-in page | (depends on provider) |
108−| flag: `--provider`<br/>toml: `provider` | string | OAuth provider | google |
109−| flag: `--pubjwk-url`<br/>toml: `pubjwk_url` | string | JWK pubkey access endpoint: required by login.gov | |
110−| flag: `--redeem-url`<br/>toml: `redeem_url` | string | Token redemption endpoint | |
111−| flag: `--scope`<br/>toml:`scope` | string | OAuth scope specification. Every provider has a default list of scopes which will be used in case no scope is configured. | |
112−| flag: `--skip-claims-from-profile-url`<br/>toml: `skip_claims_from_profile_url` | bool | skip request to Profile URL for resolving claims not present in id_token | false |
113−| flag: `--skip-oidc-discovery`<br/>toml: `skip_oidc_discovery` | bool | bypass OIDC endpoint discovery. `--login-url`, `--redeem-url` and `--oidc-jwks-url` must be configured in this case | false |
114−| flag: `--use-system-trust-store`<br/>toml: `use_system_trust_store` | bool | Determines if `provider-ca-file` files and the system trust store are used. If set to true, your custom CA files and the system trust store are used otherwise only your custom CA files. | false |
115−| flag: `--validate-url`<br/>toml: `validate_url` | string | Access token validation endpoint | |
116−
117−### Cookie Options
118−
119−| Flag / Config Field | Type | Description | Default |
120−| --------------------------------------------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
121−| flag: `--cookie-csrf-expire`<br/>toml: `cookie_csrf_expire` | duration | expire timeframe for CSRF cookie | 15m |
122−| flag: `--cookie-csrf-per-request`<br/>toml:`cookie_csrf_per_request` | bool | Enable having different CSRF cookies per request, making it possible to have parallel requests. | false |
123−| flag: `--cookie-csrf-per-request-limit`<br/>toml: `cookie_csrf_per_request_limit` | int | Sets a limit on the number of CSRF requests cookies that oauth2-proxy will create. The oldest cookie will be removed. Useful if users end up with 431 Request headers too large status codes. Only effective if --cookie-csrf-per-request is true | "infinite" |
124−| flag: `--cookie-csrf-samesite`<br/>toml: `cookie_csrf_samesite` | string | set SameSite CSRF cookie attribute (`"lax"`, `"strict"`, `"none"`, or `""`). When using the default setting, the CSRF cookie samesite value is taken from the session cookie configuration. | `""` |
125−| flag: `--cookie-domain`<br/>toml: `cookie_domains` | string \| list | Optional cookie domains to force cookies to (e.g. `.yourcompany.com`). The longest domain matching the request's host will be used (or the shortest cookie domain if there is no match). | |
126−| flag: `--cookie-expire`<br/>toml: `cookie_expire` | duration | expire timeframe for cookie. If set to 0, cookie becomes a session-cookie which will expire when the browser is closed. | 168h0m0s |
127−| flag: `--cookie-httponly`<br/>toml: `cookie_httponly` | bool | set HttpOnly cookie flag | true |
128−| flag: `--cookie-name`<br/>toml: `cookie_name` | string | the name of the cookie that the oauth_proxy creates. Should be changed to use a [cookie prefix](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#cookie_prefixes) (`__Host-` or `__Secure-`) if `--cookie-secure` is set. | `"_oauth2_proxy"` |
129−| flag: `--cookie-path`<br/>toml: `cookie_path` | string | an optional cookie path to force cookies to (e.g. `/poc/`) | `"/"` |
130−| flag: `--cookie-refresh`<br/>toml: `cookie_refresh` | duration | refresh the cookie after this duration; `0` to disable; not supported by all providers&nbsp;[^1] | |
131−| flag: `--cookie-samesite`<br/>toml: `cookie_samesite` | string | set SameSite cookie attribute (`"lax"`, `"strict"`, `"none"`, or `""`). | `""` |
132−| flag: `--cookie-secret`<br/>toml: `cookie_secret` | string | the seed string for secure cookies (optionally base64 encoded) | |
133−| flag: `--cookie-secret-file`<br/>toml: `cookie_secret_file` | string | File containing the cookie secret (must be raw binary, exactly 16, 24, or 32 bytes). Use dd if=/dev/urandom bs=32 count=1 > cookie.secret to generate | |
134−| flag: `--cookie-secure`<br/>toml: `cookie_secure` | bool | set [secure (HTTPS only) cookie flag](https://owasp.org/www-community/controls/SecureFlag) | true |
135−
136−[^1]: The following providers support `--cookie-refresh`: ADFS, Azure, GitLab, Google, Keycloak and all other Identity Providers which support the full [OIDC specification](https://openid.net/specs/openid-connect-core-1_0.html#RefreshTokens)
137−
138−### Header Options
139−
140−| Flag / Config Field | Type | Description | Default |
141−| ------------------------------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
142−| flag: `--basic-auth-password`<br/>toml: `basic_auth_password` | string | the password to set when passing the HTTP Basic Auth header | |
143−| flag: `--set-xauthrequest`<br/>toml: `set_xauthrequest` | bool | set X-Auth-Request-User, X-Auth-Request-Groups, X-Auth-Request-Email and X-Auth-Request-Preferred-Username response headers (useful in Nginx auth_request mode). When used with `--pass-access-token`, X-Auth-Request-Access-Token is added to response headers. | false |
144−| flag: `--set-authorization-header`<br/>toml: `set_authorization_header` | bool | set Authorization Bearer response header (useful in Nginx auth_request mode) | false |
145−| flag: `--set-basic-auth`<br/>toml: `set_basic_auth` | bool | set HTTP Basic Auth information in response (useful in Nginx auth_request mode) | false |
146−| flag: `--skip-auth-strip-headers`<br/>toml: `skip_auth_strip_headers` | bool | strips `X-Forwarded-*` style authentication headers & `Authorization` header if they would be set by oauth2-proxy | true |
147−| flag: `--pass-access-token`<br/>toml: `pass_access_token` | bool | pass OAuth access_token to upstream via X-Forwarded-Access-Token header. When used with `--set-xauthrequest` this adds the X-Auth-Request-Access-Token header to the response | false |
148−| flag: `--pass-authorization-header`<br/>toml: `pass_authorization_header` | bool | pass OIDC IDToken to upstream via Authorization Bearer header | false |
149−| flag: `--pass-basic-auth`<br/>toml: `pass_basic_auth` | bool | pass HTTP Basic Auth, X-Forwarded-User, X-Forwarded-Email and X-Forwarded-Preferred-Username information to upstream | true |
150−| flag: `--prefer-email-to-user`<br/>toml: `prefer_email_to_user` | bool | Prefer to use the Email address as the Username when passing information to upstream. Will only use Username if Email is unavailable, e.g. htaccess authentication. Used in conjunction with `--pass-basic-auth` and `--pass-user-headers` | false |
151−| flag: `--pass-user-headers`<br/>toml: `pass_user_headers` | bool | pass X-Forwarded-User, X-Forwarded-Groups, X-Forwarded-Email and X-Forwarded-Preferred-Username information to upstream | true |
152−
153−### Logging Options
154−
155−| Flag / Config Field | Type | Description | Default |
156−| --------------------------------------------------------------------- | ------ | ---------------------------------------------------------------------------- | --------------------------------------------------- |
157−| flag: `--auth-logging-format`<br/>toml: `auth_logging_format` | string | Template for authentication log lines | see [Logging Configuration](#logging-configuration) |
158−| flag: `--auth-logging`<br/>toml: `auth_logging` | bool | Log authentication attempts | true |
159−| flag: `--errors-to-info-log`<br/>toml: `errors_to_info_log` | bool | redirects error-level logging to default log channel instead of stderr | false |
160−| flag: `--exclude-logging-path`<br/>toml: `exclude_logging_paths` | string | comma separated list of paths to exclude from logging, e.g. `"/ping,/path2"` | `""` (no paths excluded) |
161−| flag: `--logging-compress`<br/>toml: `logging_compress` | bool | Should rotated log files be compressed using gzip | false |
162−| flag: `--logging-filename`<br/>toml: `logging_filename` | string | File to log requests to, empty for `stdout` | `""` (stdout) |
163−| flag: `--logging-local-time`<br/>toml: `logging_local_time` | bool | Use local time in log files and backup filenames instead of UTC | true (local time) |
164−| flag: `--logging-max-age`<br/>toml: `logging_max_age` | int | Maximum number of days to retain old log files | 7 |
165−| flag: `--logging-max-backups`<br/>toml: `logging_max_backups` | int | Maximum number of old log files to retain; 0 to disable | 0 |
166−| flag: `--logging-max-size`<br/>toml: `logging_max_size` | int | Maximum size in megabytes of the log file before rotation | 100 |
167−| flag: `--request-id-header`<br/>toml: `request_id_header` | string | Request header to use as the request ID in logging | X-Request-Id |
168−| flag: `--request-logging-format`<br/>toml: `request_logging_format` | string | Template for request log lines | see [Logging Configuration](#logging-configuration) |
169−| flag: `--request-logging`<br/>toml: `request_logging` | bool | Log requests | true |
170−| flag: `--silence-ping-logging`<br/>toml: `silence_ping_logging` | bool | disable logging of requests to ping & ready endpoints | false |
171−| flag: `--standard-logging-format`<br/>toml: `standard_logging_format` | string | Template for standard log lines | see [Logging Configuration](#logging-configuration) |
172−| flag: `--standard-logging`<br/>toml: `standard_logging` | bool | Log standard runtime information | true |
173−
174−### Page Template Options
175−
176−| Flag / Config Field | Type | Description | Default |
177−| ----------------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------- | ------- |
178−| flag: `--banner`<br/>toml: `banner` | string | custom (html) banner string. Use `"-"` to disable default banner. | |
179−| flag: `--custom-sign-in-logo`<br/>toml: `custom_sign_in_logo` | string | path or a URL to an custom image for the sign_in page logo. Use `"-"` to disable default logo. | |
180−| flag: `--custom-templates-dir`<br/>toml: `custom_templates_dir` | string | path to custom html templates | |
181−| flag: `--display-htpasswd-form`<br/>toml: `display_htpasswd_form` | bool | display username / password login form if an htpasswd file is provided | true |
182−| flag: `--footer`<br/>toml: `footer` | string | custom (html) footer string. Use `"-"` to disable default footer. (Can be used to obfuscate the version) | |
183−| flag: `--show-debug-on-error`<br/>toml: `show_debug_on_error` | bool | show detailed error information on error pages (WARNING: this may contain sensitive information - do not use in production) | false |
184−
185−### Probe Options
186−
187−| Flag / Config Field | Type | Description | Default |
188−| ------------------------------------------------------- | ------ | ---------------------------------------------------------- | ----------------------------- |
189−| flag: `--ping-path`<br/>toml: `ping_path` | string | the ping endpoint that can be used for basic health checks | `"/ping"` |
190−| flag: `--ping-user-agent`<br/>toml: `ping_user_agent` | string | a User-Agent that can be used for basic health checks | `""` (don't check user agent) |
191−| flag: `--ready-path`<br/>toml: `ready_path` | string | the ready endpoint that can be used for deep health checks | `"/ready"` |
192−| flag: `--gcp-healthchecks`<br/>toml: `gcp_healthchecks` | bool | Enable GCP/GKE healthcheck endpoints (deprecated) | false |
193−
194−### Proxy Options
195−
196−:::warning
197−When `--reverse-proxy` is enabled, configure `--trusted-proxy-ip` to the IPs or CIDR ranges of the reverse proxies that are allowed to send `X-Forwarded-*` headers. If you leave it unset, OAuth2 Proxy currently trusts all source IPs for backwards compatibility, which means a client that can reach OAuth2 Proxy directly may be able to spoof forwarded headers.
198−:::
199−
200−| Flag / Config Field | Type | Description | Default |
201−| ----------------------------------------------------------------------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
202−| flag: `--allow-query-semicolons`<br/>toml: `allow_query_semicolons` | bool | allow the use of semicolons in query args ([required for some legacy applications](https://github.com/golang/go/issues/25192)) | `false` |
203−| flag: `--api-route`<br/>toml: `api_routes` | string \| list | Requests to these paths must already be authenticated with a cookie, or a JWT if `--skip-jwt-bearer-tokens` is set. No redirect to login will be done. Return 401 if not. Format: path_regex | |
204−| flag: `--authenticated-emails-file`<br/>toml: `authenticated_emails_file` | string | authenticate against emails via file (one per line) | |
205−| flag: `--bearer-token-login-fallback`<br/>toml: `bearer_token_login_fallback` | bool | if `--skip-jwt-bearer-tokens` is set, if a request includes an invalid JWT (expired, malformed, missing required audiences, etc), fall back to normal login redirect as if the token were not sent at all. If false, respond 403 | true |
206−| flag: `--email-domain`<br/>toml: `email_domains` | string \| list | authenticate emails with the specified domain (may be given multiple times). Use `*` to authenticate any email | |
207−| flag: `--encode-state`<br/>toml: `encode_state` | bool | encode the state parameter as UrlEncodedBase64 | false |
208−| flag: `--extra-jwt-issuers`<br/>toml: `extra_jwt_issuers` | string | if `--skip-jwt-bearer-tokens` is set, a list of extra JWT `issuer=audience` (see a token's `iss`, `aud` fields) pairs (where the issuer URL has a `.well-known/openid-configuration` or a `.well-known/jwks.json`) | |
209−| flag: `--force-https`<br/>toml: `force_https` | bool | enforce https redirect | `false` |
210−| flag: `--force-json-errors`<br/>toml: `force_json_errors` | bool | force JSON errors instead of HTTP error pages or redirects | `false` |
211−| flag: `--htpasswd-file`<br/>toml: `htpasswd_file` | string | additionally authenticate against a htpasswd file. Entries must be created with `htpasswd -B` for bcrypt encryption | |
212−| flag: `--htpasswd-user-group`<br/>toml: `htpasswd_user_groups` | string \| list | the groups to be set on sessions for htpasswd users | |
213−| flag: `--proxy-prefix`<br/>toml: `proxy_prefix` | string | the url root path that this proxy should be nested under (e.g. /`<oauth2>/sign_in`) | `"/oauth2"` |
214−| flag: `--real-client-ip-header`<br/>toml: `real_client_ip_header` | string | Header used to determine the real IP of the client, requires `--reverse-proxy` to be set (one of: X-Forwarded-For, X-Real-IP, X-ProxyUser-IP, X-Envoy-External-Address, or CF-Connecting-IP) | X-Real-IP |
215−| flag: `--redirect-url`<br/>toml: `redirect_url` | string | the OAuth Redirect URL, e.g. `"https://internalapp.yourcompany.com/oauth2/callback"` | |
216−| flag: `--relative-redirect-url`<br/>toml: `relative_redirect_url` | bool | allow relative OAuth Redirect URL.` | false |
217−| flag: `--reverse-proxy`<br/>toml: `reverse_proxy` | bool | are we running behind a reverse proxy, controls whether headers like X-Real-IP are accepted and allows X-Forwarded-\{Proto,Host,Uri\} headers to be used on redirect selection | false |
218−| flag: `--trusted-proxy-ip`<br/>toml: `trusted_proxy_ips` | string \| list | list of IPs or CIDR ranges allowed to supply `X-Forwarded-*` headers when `--reverse-proxy` is enabled. If not set, OAuth2 Proxy preserves backwards compatibility by trusting all source IPs (`0.0.0.0/0`, `::/0`) and logs a warning at startup. Configure this to your reverse proxy addresses to prevent forwarded header spoofing. | `"0.0.0.0/0", "::/0"` |
219−| flag: `--signature-key`<br/>toml: `signature_key` | string | GAP-Signature request signature key (algorithm:secretkey) | |
220−| flag: `--skip-auth-preflight`<br/>toml: `skip_auth_preflight` | bool | will skip authentication for OPTIONS requests | false |
221−| flag: `--skip-auth-regex`<br/>toml: `skip_auth_regex` | string \| list | (DEPRECATED for `--skip-auth-route`) bypass authentication for requests paths that match (may be given multiple times) | |
222−| flag: `--skip-auth-route`<br/>toml: `skip_auth_routes` | string \| list | bypass authentication for requests that match the method & path. Format: method=path_regex OR method!=path_regex. For all methods: path_regex OR !=path_regex | |
223−| flag: `--skip-jwt-bearer-tokens`<br/>toml: `skip_jwt_bearer_tokens` | bool | will skip requests that have verified JWT bearer tokens (the token must have [`aud`](https://en.wikipedia.org/wiki/JSON_Web_Token#Standard_fields) that matches this client id or one of the extras from `extra-jwt-issuers`) | false |
224−| flag: `--skip-provider-button`<br/>toml: `skip_provider_button` | bool | will skip sign-in-page to directly reach the next step: oauth/start | false |
225−| flag: `--ssl-insecure-skip-verify`<br/>toml: `ssl_insecure_skip_verify` | bool | skip validation of certificates presented when using HTTPS providers | false |
226−| flag: `--trusted-ip`<br/>toml: `trusted_ips` | string \| list | list of IPs or CIDR ranges to allow to bypass authentication (may be given multiple times). When combined with `--reverse-proxy` and optionally `--real-client-ip-header` this will evaluate the trust of the IP stored in an HTTP header by a reverse proxy rather than the layer-3/4 remote address. WARNING: trusting IPs has inherent security flaws, especially when obtaining the IP address from an HTTP header (reverse-proxy mode). Use this option only if you understand the risks and how to manage them. | |
227−| flag: `--whitelist-domain`<br/>toml: `whitelist_domains` | string \| list | allowed domains for redirection after authentication. Prefix domain with a `.` or a `*.` to allow subdomains (e.g. `.example.com`, `*.example.com`)&nbsp;[^2] | |
228−
229−[^2]: When using the `whitelist-domain` option, any domain prefixed with a `.` or a `*.` will allow any subdomain of the specified domain as a valid redirect URL. By default, only empty ports are allowed. This translates to allowing the default port of the URL's protocol (80 for HTTP, 443 for HTTPS, etc.) since browsers omit them. To allow only a specific port, add it to the whitelisted domain: `example.com:8080`. To allow any port, use `*`: `example.com:*`.
230−
231−### Server Options
232−
233−| Flag / Config Field | Type | Description | Default |
234−| ------------------------------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
235−| flag: `--http-address`<br/>toml: `http_address` | string | `[http://]<addr>:<port>` or `unix://<path>` or `fd:<int>` (case insensitive) to listen on for HTTP clients. Unix sockets are created with default system umask mode, which can be overridden, e.g. `unix://my-socket,mode=0777`. Square brackets are required for ipv6 address, e.g. `http://[::1]:4180` | `"127.0.0.1:4180"` |
236−| flag: `--https-address`<br/>toml: `https_address` | string | `[https://]<addr>:<port>` to listen on for HTTPS clients. Square brackets are required for ipv6 address, e.g. `https://[::1]:443` | `":443"` |
237−| flag: `--metrics-address`<br/>toml: `metrics_address` | string | the address prometheus metrics will be scraped from | `""` |
238−| flag: `--metrics-secure-address`<br/>toml: `metrics_secure_address` | string | the address prometheus metrics will be scraped from if using HTTPS | `""` |
239−| flag: `--metrics-tls-cert-file`<br/>toml: `metrics_tls_cert_file` | string | path to certificate file for secure metrics server | `""` |
240−| flag: `--metrics-tls-key-file`<br/>toml: `metrics_tls_key_file` | string | path to private key file for secure metrics server | `""` |
241−| flag: `--tls-cert-file`<br/>toml: `tls_cert_file` | string | path to certificate file | |
242−| flag: `--tls-key-file`<br/>toml: `tls_key_file` | string | path to private key file | |
243−| flag: `--tls-cipher-suite`<br/>toml: `tls_cipher_suites` | string \| list | Restricts TLS cipher suites used by server to those listed (e.g. TLS_RSA_WITH_RC4_128_SHA) (may be given multiple times). If not specified, the default Go safe cipher list is used. List of valid cipher suites can be found in the [crypto/tls documentation](https://pkg.go.dev/crypto/tls#pkg-constants). | |
244−| flag: `--tls-min-version`<br/>toml: `tls_min_version` | string | minimum TLS version that is acceptable, either `"TLS1.2"` or `"TLS1.3"` | `"TLS1.2"` |
245−
246−### Session Options
247−
248−| Flag / Config Field | Type | Description | Default |
249−| ----------------------------------------------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
250−| flag: `--session-cookie-minimal`<br/>toml: `session_cookie_minimal` | bool | strip OAuth tokens from cookie session stores if they aren't needed (cookie session store only) | false |
251−| flag: `--session-store-type`<br/>toml: `session_store_type` | string | [Session data storage backend](sessions.md); redis or cookie | cookie |
252−| flag: `--redis-cluster-connection-urls`<br/>toml: `redis_cluster_connection_urls` | string \| list | List of Redis cluster connection URLs (e.g. `redis://HOST[:PORT]`). Used in conjunction with `--redis-use-cluster` | |
253−| flag: `--redis-connection-url`<br/>toml: `redis_connection_url` | string | URL of redis server for redis session storage (e.g. `redis://HOST[:PORT]`) | |
254−| flag: `--redis-ca-path`<br/>toml: `redis_ca_path` | string | Path to a CA certificates file that should be used when connecting to redis. If not specified, the system cert pool is used instead. | |
255−| flag: `--redis-insecure-skip-tls-verify`<br/>toml: `redis_insecure_skip_tls_verify` | bool | skip TLS verification when connecting to Redis | false |
256−| flag: `--redis-password`<br/>toml: `redis_password` | string | Redis password. Applicable for all Redis configurations. Will override any password set in `--redis-connection-url` | |
257−| flag: `--redis-sentinel-password`<br/>toml: `redis_sentinel_password` | string | Redis sentinel password. Used only for sentinel connection; any redis node passwords need to use `--redis-password` | |
258−| flag: `--redis-sentinel-master-name`<br/>toml: `redis_sentinel_master_name` | string | Redis sentinel master name. Used in conjunction with `--redis-use-sentinel` | |
259−| flag: `--redis-sentinel-connection-urls`<br/>toml: `redis_sentinel_connection_urls` | string \| list | List of Redis sentinel connection URLs (e.g. `redis://HOST[:PORT]`). Used in conjunction with `--redis-use-sentinel` | |
260−| flag: `--redis-use-cluster`<br/>toml: `redis_use_cluster` | bool | Connect to redis cluster. Must set `--redis-cluster-connection-urls` to use this feature | false |
261−| flag: `--redis-use-sentinel`<br/>toml: `redis_use_sentinel` | bool | Connect to redis via sentinels. Must set `--redis-sentinel-master-name` and `--redis-sentinel-connection-urls` to use this feature | false |
262−| flag: `--redis-connection-idle-timeout`<br/>toml: `redis_connection_idle_timeout` | int | Redis connection idle timeout seconds. If Redis [timeout](https://redis.io/docs/reference/clients/#client-timeouts) option is set to non-zero, the `--redis-connection-idle-timeout` must be less than Redis timeout option. Example: if either redis.conf includes `timeout 15` or using `CONFIG SET timeout 15` the `--redis-connection-idle-timeout` must be at least `--redis-connection-idle-timeout=14` | 0 |
263−
264−### Upstream Options
265−
266−| Flag / Config Field | Type | Description | Default |
267−| ----------------------------------------------------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------- |
268−| flag: `--flush-interval`<br/>toml: `flush_interval` | duration | period between flushing response buffers when streaming responses | `"1s"` |
269−| flag: `--pass-host-header`<br/>toml: `pass_host_header` | bool | pass the request Host Header to upstream | true |
270−| flag: `--proxy-websockets`<br/>toml: `proxy_websockets` | bool | enables WebSocket proxying | true |
271−| flag: `--ssl-upstream-insecure-skip-verify`<br/>toml: `ssl_upstream_insecure_skip_verify` | bool | skip validation of certificates presented when using HTTPS upstreams | false |
272−| flag: `--disable-keep-alives`<br/>toml: `disable_keep_alives` | bool | disable HTTP keep-alive connections to the upstream server | false |
273−| flag: `--upstream-timeout`<br/>toml: `upstream_timeout` | duration | maximum amount of time the server will wait for a response from the upstream | 30s |
274−| flag: `--upstream`<br/>toml: `upstreams` | string \| list | the http url(s) of the upstream endpoint, file:// paths for static files or `static://<status_code>` for static response. Routing is based on the path | |
275−
276−## Configuration Validation
277−
278−The `--config-test` flag validates your configuration file without starting the proxy server. This is useful for:
279−- **CI/CD pipelines**: Pre-deployment validation
280−- **Configuration management**: Testing before applying changes
281−- **Debugging**: Verifying syntax and required fields
282−
283−### Usage
284−
285−```bash
286−# Test legacy config
287−oauth2-proxy --config /etc/oauth2-proxy.cfg --config-test
288−
289−# Test alpha config
290−oauth2-proxy --config /etc/core.cfg --alpha-config /etc/alpha.yaml --config-test
291−
292−# CI/CD pre-deployment check
293−# Returns with exit code 1 if any validation errors occur
294−oauth2-proxy --config new-config.cfg --config-test
295−```
296−
297−### Exit Codes
298−
299−- **0**: Configuration is valid ✅
300−- **1**: Configuration is invalid (errors printed to stderr) ❌
301−
302−### Validation Coverage
303−
304−The `--config-test` flag performs the **same comprehensive validation** as normal startup, including:
305−- Required fields (client ID, client secret, cookie secret, etc.)
306−- Syntax validation (TOML/YAML parsing)
307−- Provider configuration
308−- Upstream server definitions
309−- Session store connectivity (e.g., Redis network checks if configured)
310−
311−**Note**: Cannot be combined with `--convert-config-to-alpha`.
312−
313−## Upstreams Configuration
314−
315−`oauth2-proxy` supports having multiple upstreams, and has the option to pass requests on to HTTP(S) servers, unix socket or serve static files from the file system.
316−
317−To configure **HTTP and HTTPS upstreams**, provide such a URL in `--upstream=URL`. The scheme+host portion and the path portion are extracted to configure proxying behavior. When processing incoming requests, the path portion becomes a lookup key for selecting the destination server of the proxied request.
318−
319−* Upstream URLs *without a trailing slash,* like in `--upstream=http://service2.internal/foo`, will match an incoming request exactly to `/foo` in `https://this.o2p.example.com/foo`, and forward the request on to service2.internal, but not match a request to `https://this.o2p.example.com/foo/more` nor ...`.com/food`.
320−* Upstream URLs *with a trailing slash,* like in `--upstream=http://service1.internal/foo/`, will match any incoming request to any incoming requests's path *starting with* `/foo/`, like `/foo/` and `/foo/more` and `/foo/lots/more?etc`.
321−
322−If multiple `--upstream` URLs' paths match an incoming request, the one with the longest matching path (the most specific match) takes priority over shorter (less specific) ones.
323−
324−**Unix socket upstreams** are configured as `unix:///path/to/unix.sock`.
325−
326−**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, e.g. `file:///var/www/static/#/static/` will make `/var/www/static/` available at `http://[oauth2-proxy url]/static/`.
327−
328−Multiple upstreams can either be configured by supplying a comma separated list to the `--upstream` parameter, supplying the parameter multiple times or providing 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.
329−
330−## Environment variables
331−
332−Every command line argument can be specified as an environment variable by
333−prefixing it with `OAUTH2_PROXY_`, capitalising it, and replacing hyphens (`-`)
334−with underscores (`_`). If the argument can be specified multiple times, the
335−environment variable should be plural (trailing `S`).
336−
337−This is particularly useful for storing secrets outside a configuration file
338−or the command line.
339−
340−For example, the `--cookie-secret` flag becomes `OAUTH2_PROXY_COOKIE_SECRET`.
341−If a flag has the type `string | list` like the `--email-domain` flag it is
342−available as an environment variable in plural form e.g. `OAUTH2_PROXY_EMAIL_DOMAINS`
343−
344−Values for type `string | list` usually have a plural environment variable name
345−and need to be seperated by `,` e.g.
346−`OAUTH2_PROXY_SKIP_AUTH_ROUTES="GET=^/api/status,POST=^/api/saved_objects/_import"`
347−
348−Please check the type for each [config option](#config-options) first.
349−
350−## Logging Configuration
351−
352−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.
353−
354−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`).
355−
356−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`.
357−
358−Each type of logging has its own configurable format and variables. By default, these formats are similar to the Apache Combined Log.
359−
360−Logging of requests to the `/ping` endpoint (or using `--ping-user-agent`) and the `/ready` endpoint can be disabled with `--silence-ping-logging` reducing log volume.
361−
362−## Auth Log Format
363−
364−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:
365−
366−```
367−<REMOTE_ADDRESS> - <REQUEST ID> - <user@domain.com> [2015/03/19 17:20:19] [<STATUS>] <MESSAGE>
368−```
369−
370−The status block will contain one of the below strings:
371−
372−- `AuthSuccess` If a user has authenticated successfully by any method
373−- `AuthFailure` If the user failed to authenticate explicitly
374−- `AuthError` If there was an unexpected error during authentication
375−
376−If you require a different format than that, you can configure it with the `--auth-logging-format` flag.
377−The default format is configured as follows:
378−
379−```
380−{{.Client}} - {{.RequestID}} - {{.Username}} [{{.Timestamp}}] [{{.Status}}] {{.Message}}
381−```
382−
383−Available variables for auth logging:
384−
385−| Variable | Example | Description |
386−| ------------- | ------------------------------------ | -------------------------------------------------------------------------------------------------------- |
387−| Client | 74.125.224.72 | The client/remote IP address. Will use the X-Real-IP header it if exists & reverse-proxy is set to true. |
388−| Host | domain.com | The value of the Host header. |
389−| Message | Authenticated via OAuth2 | The details of the auth attempt. |
390−| Protocol | HTTP/1.0 | The request protocol. |
391−| RequestID | 00010203-0405-4607-8809-0a0b0c0d0e0f | The request ID pulled from the `--request-id-header`. Random UUID if empty |
392−| RequestMethod | GET | The request method. |
393−| Timestamp | 2015/03/19 17:20:19 | The date and time of the logging event. |
394−| UserAgent | - | The full user agent as reported by the requesting client. |
395−| Username | username@email.com | The email or username of the auth request. |
396−| Status | AuthSuccess | The status of the auth request. See above for details. |
397−
398−## Request Log Format
399−
400−HTTP request logs will output by default in the below format:
401−
402−```
403−<REMOTE_ADDRESS> - <REQUEST ID> - <user@domain.com> [2015/03/19 17:20:19] <HOST_HEADER> GET <UPSTREAM_HOST> "/path/" HTTP/1.1 "<USER_AGENT>" <RESPONSE_CODE> <RESPONSE_BYTES> <REQUEST_DURATION>
404−```
405−
406−If you require a different format than that, you can configure it with the `--request-logging-format` flag.
407−The default format is configured as follows:
408−
409−```
410−{{.Client}} - {{.RequestID}} - {{.Username}} [{{.Timestamp}}] {{.Host}} {{.RequestMethod}} {{.Upstream}} {{.RequestURI}} {{.Protocol}} {{.UserAgent}} {{.StatusCode}} {{.ResponseSize}} {{.RequestDuration}}
411−```
412−
413−Available variables for request logging:
414−
415−| Variable | Example | Description |
416−| --------------- | ------------------------------------ | -------------------------------------------------------------------------------------------------------- |
417−| Client | 74.125.224.72 | The client/remote IP address. Will use the X-Real-IP header it if exists & reverse-proxy is set to true. |
418−| Host | domain.com | The value of the Host header. |
419−| Protocol | HTTP/1.0 | The request protocol. |
420−| RequestDuration | 0.001 | The time in seconds that a request took to process. |
421−| RequestID | 00010203-0405-4607-8809-0a0b0c0d0e0f | The request ID pulled from the `--request-id-header`. Random UUID if empty |
422−| RequestMethod | GET | The request method. |
423−| RequestURI | "/oauth2/auth" | The URI path of the request. |
424−| ResponseSize | 12 | The size in bytes of the response. |
425−| StatusCode | 200 | The HTTP status code of the response. |
426−| Timestamp | 2015/03/19 17:20:19 | The date and time of the logging event. |
427−| Upstream | - | The upstream data of the HTTP request. |
428−| UserAgent | - | The full user agent as reported by the requesting client. |
429−| Username | username@email.com | The email or username of the auth request. |
430−
431−## Standard Log Format
432−
433−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:
434−
435−```
436−[2015/03/19 17:20:19] [main.go:40] <MESSAGE>
437−```
438−
439−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:
440−
441−```
442−[{{.Timestamp}}] [{{.File}}] {{.Message}}
443−```
444−
445−Available variables for standard logging:
446−
447−| Variable | Example | Description |
448−| --------- | --------------------------------- | -------------------------------------------------- |
449−| Timestamp | 2015/03/19 17:20:19 | The date and time of the logging event. |
450−| File | main.go:40 | The file and line number of the logging statement. |
451−| Message | HTTP: listening on 127.0.0.1:4180 | The details of the log statement. |
docs/versioned_docs/version-7.15.x/configuration/providers/adfs.mddeleted−19
@@ -1,19 +0,0 @@
1−---
2−id: adfs
3−title: ADFS
4−---
5−
6−1. Open the ADFS administration console on your Windows Server and add a new Application Group
7−2. Provide a name for the integration, select Server Application from the Standalone applications section and click Next
8−3. Follow the wizard to get the client-id, client-secret and configure the application credentials
9−4. Configure the proxy with
10−
11−```
12− --provider=adfs
13− --client-id=<application ID from step 3>
14− --client-secret=<value from step 3>
15−```
16−
17−Note: When using the ADFS Auth provider with nginx and the cookie session store you may find the cookie is too large and
18−doesn't get passed through correctly. Increasing the proxy_buffer_size in nginx or implementing the
19−[redis session storage](../sessions.md#redis-storage) should resolve this.
docs/versioned_docs/version-7.15.x/configuration/providers/bitbucket.mddeleted−25
@@ -1,25 +0,0 @@
1−---
2−id: bitbucket
3−title: BitBucket
4−---
5−
6−1. [Add a new OAuth consumer](https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html)
7− * In "Callback URL" use `https://<oauth2-proxy>/oauth2/callback`, substituting `<oauth2-proxy>` with the actual
8− hostname that oauth2-proxy is running on.
9− * In Permissions section select:
10− * Account -> Email
11− * Team membership -> Read
12− * Repositories -> Read
13−2. Note the Client ID and Client Secret.
14−
15−To use the provider, pass the following options:
16−
17−```
18− --provider=bitbucket
19− --client-id=<Client ID>
20− --client-secret=<Client Secret>
21−```
22−
23−The default configuration allows everyone with Bitbucket account to authenticate. To restrict the access to the team
24−members use additional configuration option: `--bitbucket-team=<Team name>`. To restrict the access to only these users
25−who have access to one selected repository use `--bitbucket-repository=<Repository name>`.
docs/versioned_docs/version-7.15.x/configuration/providers/cidaas.mddeleted−37
@@ -1,37 +0,0 @@
1−---
2−id: cidaas
3−title: Cidaas
4−---
5−
6−[Cidaas](https://www.cidaas.com/) is an Identity as a Service (IDaaS) solution that provides authentication and authorization services.
7−It supports various protocols including OpenID Connect, OAuth 2.0, and SAML.
8−
9−However, Cidaas provides groups and their roles as hierarchical claims, which are not supported by oauth2-proxy yet.
10−The Cidaas provider transforms the hierarchical claims into a flat list of groups, which can be used by oauth2-proxy.
11−
12−Example of groups and roles in Cidaas:
13−
14−```json
15−{
16− "groups": [
17− {
18− "groupId": "group1",
19− "roles": ["role1", "role2"]
20− },
21− {
22− "groupId": "group2",
23− "roles": ["role3"]
24− }
25− ]
26−}
27−```
28−
29−This will be transformed into a flat list of groups:
30−
31−```json
32−{
33− "groups": ["group1:role1", "group2:role2", "group2:role3"]
34−}
35−```
36−
37−Apart from that the Cidaas provider inherits all the features of the [OpenID Connect provider](openid_connect.md).
docs/versioned_docs/version-7.15.x/configuration/providers/cisco_duo.mddeleted−44
@@ -1,44 +0,0 @@
1−---
2−id: cisco_duo
3−title: Cisco Duo
4−---
5−
6−Cisco Duo SSO can be configured with OAuth2 Proxy using the OIDC provider.
7−
8−1. Create a new **Generic OIDC Relying Party - Single Sign-On** application in the Duo Admin Portal
9−2. Configure OAuth2 Proxy with the following options:
10−
11−```
12−provider = "oidc"
13−provider_display_name = "Duo SSO"
14−scope = "openid email profile"
15−pass_access_token = true
16−code_challenge_method = "S256"
17−```
18−
19−3. Configure Provider endpoints. Copy the following values from the corresponding fields in the Duo Admin Portal:
20−
21−```
22−# Copy from "Client ID" field
23−client_id = "XXXXXXXX"
24−
25−# Copy from "Client Secret" field
26−client_secret = "XXXXXXXX"
27−
28−# Copy from "Issuer" field
29−oidc_issuer_url = "https://sso-xxxxxxxx.sso.duosecurity.com/oidc/xxxxxxxx"
30−
31−# Copy from "JWKS URL" field
32−oidc_jwks_url = "https://sso-xxxxxxxx.sso.duosecurity.com/oidc/xxxxxxxx/jwks"
33−
34−# Copy from "Token Introspection URL" field
35−validate_url = "https://sso-xxxxxxxx.sso.duosecurity.com/oidc/xxxxxxxx/token_introspection"
36−
37−# Copy from "UserInfo" field
38−profile_url = "https://sso-xxxxxxxx.sso.duosecurity.com/oidc/xxxxxxxx/userinfo"
39−
40−# Copy from "Token URL" field
41−redeem_url = "https://sso-xxxxxxxx.sso.duosecurity.com/oidc/xxxxxxxx/token"
42−```
43−
44−4. Complete Configuration by filling in any remaining required fields and save your configuration.
docs/versioned_docs/version-7.15.x/configuration/providers/digitalocean.mddeleted−21
@@ -1,21 +0,0 @@
1−---
2−id: digitalocean
3−title: DigitalOcean
4−---
5−
6−1. [Create a new OAuth application](https://cloud.digitalocean.com/account/api/applications)
7− * You can fill in the name, homepage, and description however you wish.
8− * In the "Application callback URL" field, enter: `https://oauth-proxy/oauth2/callback`, substituting `oauth2-proxy`
9− with the actual hostname that oauth2-proxy is running on. The URL must match oauth2-proxy's configured redirect URL.
10−2. Note the Client ID and Client Secret.
11−
12−To use the provider, pass the following options:
13−
14−```
15− --provider=digitalocean
16− --client-id=<Client ID>
17− --client-secret=<Client Secret>
18−```
19−
20−Alternatively, set the equivalent options in the config file. The redirect URL defaults to
21−`https://<requested host header>/oauth2/callback`. If you need to change it, you can use the `--redirect-url` command-line option.
docs/versioned_docs/version-7.15.x/configuration/providers/facebook.mddeleted−7
@@ -1,7 +0,0 @@
1−---
2−id: facebook
3−title: Facebook
4−---
5−
6−1. Create a new FB App from https://developers.facebook.com/
7−2. Under FB Login, set your Valid OAuth redirect URIs to `https://internal.yourcompany.com/oauth2/callback`
docs/versioned_docs/version-7.15.x/configuration/providers/gitea.mddeleted−24
@@ -1,24 +0,0 @@
1−---
2−id: gitea
3−title: Gitea / Forgejo
4−---
5−
6−:::note
7−This is not actually a fully serparate provider. For more details and options please refer to the [GitHub Provider Options](github.md)
8−:::
9−
10−1. Create a new application: `https://< your gitea host >/user/settings/applications`
11−2. Under `Redirect URI` enter the correct URL i.e. `https://<proxied host>/oauth2/callback`
12−3. Note the Client ID and Client Secret.
13−4. Pass the following options to the proxy:
14−
15−```
16− --provider="github"
17− --redirect-url="https://<proxied host>/oauth2/callback"
18− --provider-display-name="Gitea"
19− --client-id="< client_id as generated by Gitea >"
20− --client-secret="< client_secret as generated by Gitea >"
21− --login-url="https://< your gitea host >/login/oauth/authorize"
22− --redeem-url="https://< your gitea host >/login/oauth/access_token"
23− --validate-url="https://< your gitea host >/api/v1/user/emails"
24−```
docs/versioned_docs/version-7.15.x/configuration/providers/github.mddeleted−81
@@ -1,81 +0,0 @@
1−---
2−id: github
3−title: GitHub
4−---
5−
6−## Config Options
7−
8−| Flag | Toml Field | Type | Description | Default |
9−| ---------------- | -------------- | -------------- | ------------------------------------------------------------------------------------------------------------- | ------- |
10−| `--github-org` | `github_org` | string | restrict logins to members of this organisation | |
11−| `--github-team` | `github_team` | string | restrict logins to members of any of these teams (slug) or (org:team), comma separated | |
12−| `--github-repo` | `github_repo` | string | restrict logins to collaborators of this repository formatted as `orgname/repo` | |
13−| `--github-token` | `github_token` | string | the token to use when verifying repository collaborators (must have push access to the repository) | |
14−| `--github-user` | `github_users` | string \| list | To allow users to login by username even if they do not belong to the specified org and team or collaborators | |
15−
16−## Usage
17−
18−1. Create a new project: https://github.com/settings/developers
19−2. Under `Authorization callback URL` enter the correct url ie `https://internal.yourcompany.com/oauth2/callback`
20−
21−The GitHub auth provider supports two additional ways to restrict authentication to either organization and optional
22−team level access, or to collaborators of a repository. Restricting by these options is normally accompanied with `--email-domain=*`. Additionally, all the organizations and teams a user belongs to are set as part of the `X-Forwarded-Groups` header. e.g. `org1:team1,org1:team2,org2:team1`
23−
24−NOTE: When `--github-user` is set, the specified users are allowed to log in even if they do not belong to the specified
25−org and team or collaborators.
26−
27−To restrict access to your organization:
28−
29−```shell
30− # restrict logins to members of this organisation
31− --github-org="your-org"
32−```
33−
34−To restrict access to specific teams within an organization:
35−
36−```shell
37− --github-org="your-org"
38− # restrict logins to members of any of these teams (slug), comma separated
39− --github-team="team1,team2,team3"
40−```
41−
42−To restrict to teams within different organizations, keep the organization flag empty and use `--github-team` like so:
43−
44−```shell
45− # keep empty
46− --github-org=""
47− # restrict logins to members to any of the following teams (format <org>:<slug>, like octo:team1), comma separated
48− --github-team="org1:team1,org2:team1,org3:team42,octo:cat"
49−```
50−
51−If you would rather restrict access to collaborators of a repository, those users must either have push access to a
52−public repository or any access to a private repository:
53−
54−```shell
55− # restrict logins to collaborators of this repository formatted as orgname/repo
56− --github-repo=""
57−```
58−
59−If you'd like to allow access to users with **read only** access to a **public** repository you will need to provide a
60−[token](https://github.com/settings/tokens) for a user that has write access to the repository. The token must be
61−created with at least the `public_repo` scope:
62−
63−```shell
64− # the token to use when verifying repository collaborators
65− --github-token=""
66−```
67−
68−To allow a user to log in with their username even if they do not belong to the specified org and team or collaborators:
69−
70−```shell
71− # allow logins by username, comma separated
72− --github-user=""
73−```
74−
75−If you are using GitHub enterprise, make sure you set the following to the appropriate url:
76−
77−```shell
78− --login-url="http(s)://<enterprise github host>/login/oauth/authorize"
79− --redeem-url="http(s)://<enterprise github host>/login/oauth/access_token"
80− --validate-url="http(s)://<enterprise github host>/api/v3"
81−```
docs/versioned_docs/version-7.15.x/configuration/providers/gitlab.mddeleted−49
@@ -1,49 +0,0 @@
1−---
2−id: gitlab
3−title: GitLab
4−---
5−
6−## Config Options
7−
8−| Flag | Toml Field | Type | Description | Default |
9−| ------------------- | ----------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
10−| `--gitlab-group` | `gitlab_groups` | string \| list | restrict logins to members of any of these groups (slug), separated by a comma | |
11−| `--gitlab-project` | `gitlab_projects` | string \| list | restrict logins to members of any of these projects (may be given multiple times) formatted as `orgname/repo=accesslevel`. Access level should be a value matching [Gitlab access levels](https://docs.gitlab.com/ee/api/members.html#valid-access-levels), defaulted to 20 if absent | |
12−
13−## Usage
14−
15−This auth provider has been tested against Gitlab version 12.X. Due to Gitlab API changes, it may not work for version
16−prior to 12.X (see [994](https://github.com/oauth2-proxy/oauth2-proxy/issues/994)).
17−
18−Whether you are using GitLab.com or self-hosting GitLab, follow
19−[these steps to add an application](https://docs.gitlab.com/integration/oauth_provider/). Make sure to enable at
20−least the `openid`, `profile` and `email` scopes, and set the redirect url to your application url e.g.
21−https://myapp.com/oauth2/callback.
22−
23−If you need projects filtering, add the extra `read_api` scope to your application.
24−
25−The following config should be set to ensure that the oauth will work properly. To get a cookie secret follow
26−[these steps](../overview.md#generating-a-cookie-secret)
27−
28−```
29− --provider="gitlab"
30− --redirect-url="https://myapp.com/oauth2/callback" // Should be the same as the redirect url for the application in gitlab
31− --client-id=GITLAB_CLIENT_ID
32− --client-secret=GITLAB_CLIENT_SECRET
33− --cookie-secret=COOKIE_SECRET
34−```
35−
36−Restricting by group membership is possible with the following option:
37−
38−```shell
39− --gitlab-group="mygroup,myothergroup" # restrict logins to members of any of these groups (slug), separated by a comma
40−```
41−
42−If you are using self-hosted GitLab, make sure you set the following to the appropriate URL:
43−
44−```shell
45− --oidc-issuer-url="<your gitlab url>"
46−```
47−
48−If your self-hosted GitLab is on a subdirectory (e.g. domain.tld/gitlab), as opposed to its own subdomain
49−(e.g. gitlab.domain.tld), you may need to add a redirect from domain.tld/oauth pointing at e.g. domain.tld/gitlab/oauth.
docs/versioned_docs/version-7.15.x/configuration/providers/google.mddeleted−84
@@ -1,84 +0,0 @@
1−---
2−id: google
3−title: Google (default)
4−---
5−
6−## Config Options
7−
8−| Flag | Toml Field | Type | Description | Default |
9−|-------------------------------------------------|----------------------------------------------| ------ |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------|
10−| `--google-admin-email` | `google_admin_email` | string | the google admin to impersonate for api calls | |
11−| `--google-group` | `google_groups` | string | restrict logins to members of this google group (may be given multiple times). If not specified and service account or default credentials are configured, all user groups will be allowed. | |
12−| `--google-service-account-json` | `google_service_account_json` | string | the path to the service account json credentials | |
13−| `--google-use-application-default-credentials` | `google_use_application_default_credentials` | bool | use application default credentials instead of service account json (i.e. GKE Workload Identity) | |
14−| `--google-target-principal` | `google_target_principal` | bool | the target principal to impersonate when using ADC | defaults to the service account configured for ADC |
15−| `--google-use-organization-id` | `google_use_organization_id` | bool | use organization id as preferred username | false |
16−| `--google-admin-api-user-scope` | `google_admin_api_user_scope` | string | the OAuth scope to use when querying the Google Admin SDK for organization id, can be 'readonly', 'user' or 'cloud'<br/> | `readonly` |
17−
18−## Usage
19−
20−For Google, the registration steps are:
21−
22−1. Create a new project: https://console.developers.google.com/project
23−2. Choose the new project from the top right project dropdown (only if another project is selected)
24−3. In the project Dashboard center pane, choose **"APIs & Services"**
25−4. In the left Nav pane, choose **"Credentials"**
26−5. In the center pane, choose **"OAuth consent screen"** tab. Fill in **"Product name shown to users"** and hit save.
27−6. In the center pane, choose **"Credentials"** tab.
28− - Open the **"New credentials"** drop down
29− - Choose **"OAuth client ID"**
30− - Choose **"Web application"**
31− - Application name is freeform, choose something appropriate
32− - Authorized JavaScript origins is your domain ex: `https://internal.yourcompany.com`
33− - Authorized redirect URIs is the location of oauth2/callback ex: `https://internal.yourcompany.com/oauth2/callback`
34− - Choose **"Create"**
35−7. Take note of the **Client ID** and **Client Secret**
36−
37−It's recommended to refresh sessions on a short interval (1h) with `cookie-refresh` setting which validates that the
38−account is still authorized.
39−
40−#### Restrict auth to specific Google groups on your domain. (optional)
41−
42−1. Create a [service account](https://developers.google.com/identity/protocols/oauth2/service-account) and configure it
43− to use [Application Default Credentials / Workload Identity / Workload Identity Federation (recommended)](#using-application-default-credentials-adc--workload-identity--workload-identity-federation-recommended) or,
44− alternatively download the JSON.
45−2. Make note of the Client ID for a future step.
46−3. Under "APIs & Auth", choose APIs.
47−4. Click on Admin SDK and then Enable API.
48−5. Follow the steps on [Set up domain-wide delegation for a service account](https://developers.google.com/workspace/guides/create-credentials#optional_set_up_domain-wide_delegation_for_a_service_account)
49− and give the client id from step 2 the following oauth scopes:
50−
51− ```
52− https://www.googleapis.com/auth/admin.directory.group.member.readonly
53− ```
54−
55−6. Follow the steps on https://support.google.com/a/answer/60757 to enable Admin API access.
56−7. Create or choose an existing administrative email address on the Gmail domain to assign to the `google-admin-email`
57− flag. This email will be impersonated by this client to make calls to the Admin SDK. See the note on the link from
58− step 5 for the reason why.
59−8. Create or choose an existing email group and set that email to the `google-group` flag. You can pass multiple instances
60− of this flag with different groups and the user will be checked against all the provided groups.
61−
62−(Only if using a JSON file (see step 1))
63−
64−9. Lock down the permissions on the json file downloaded from step 1 so only oauth2-proxy is able to read the file and
65− set the path to the file in the `google-service-account-json` flag.
66−10. Restart oauth2-proxy.
67−
68−Note: The user is checked against the group members list on initial authentication and every time the token is
69−refreshed ( about once an hour ).
70−
71−##### Using Application Default Credentials (ADC) / Workload Identity / Workload Identity Federation (recommended)
72−oauth2-proxy can make use of [Application Default Credentials](https://cloud.google.com/docs/authentication/application-default-credentials).
73−When deployed within GCP, this means that it can automatically use the service account attached to the resource. When deployed to GKE, ADC
74−can be leveraged through a feature called Workload Identity. Follow Google's [guide](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity)
75−to set up Workload Identity.
76−
77−When deployed outside of GCP, [Workload Identity Federation](https://cloud.google.com/docs/authentication/provide-credentials-adc#wlif) might be an option.
78−
79−##### Using Organization ID as Preferred Username (optional)
80−By default, the google provider uses the google id as username. If you would like to use an organization id instead, you can set the `google-use-organization-id` flag to true.
81−This requires that the service account used to query the Google Admin SDK has one of the following scopes granted in step 5 above:
82−- `https://www.googleapis.com/auth/admin.directory.user.readonly`,
83−- `https://www.googleapis.com/auth/admin.directory.user`
84−- `https://www.googleapis.com/auth/cloud-platform`
docs/versioned_docs/version-7.15.x/configuration/providers/index.mddeleted−46
@@ -1,46 +0,0 @@
1−---
2−id: index
3−title: OAuth Provider Configuration
4−---
5−
6−You will need to register an OAuth application with a Provider (Google, GitHub or another provider), and configure it
7−with Redirect URI(s) for the domain you intend to run `oauth2-proxy` on.
8−
9−Valid providers are :
10−
11−- [ADFS](adfs.md)
12−- [Bitbucket](bitbucket.md)
13−- [Cidaas](cidaas.md)
14−- [CiscoDuo](cisco_duo.md)
15−- [DigitalOcean](digitalocean.md)
16−- [Facebook](facebook.md)
17−- [Gitea](gitea.md)
18−- [GitHub](github.md)
19−- [GitLab](gitlab.md)
20−- [Google](google.md) _default_
21−- [Keycloak](keycloak.md) (Deprecated)
22−- [Keycloak OIDC](keycloak_oidc.md)
23−- [LinkedIn](linkedin.md)
24−- [login.gov](login_gov.md)
25−- [Microsoft Azure](ms_azure_ad.md) (Deprecated)
26−- [Microsoft Entra ID](ms_entra_id.md)
27−- [Nextcloud](nextcloud.md)
28−- [OpenID Connect](openid_connect.md)
29−- [SourceHut](sourcehut.md)
30−
31−The provider can be selected using the `provider` configuration value, or set in the [`providers` array using AlphaConfig](https://oauth2-proxy.github.io/oauth2-proxy/configuration/alpha-config#providers). However, [**the feature to implement multiple providers is not complete**](https://github.com/oauth2-proxy/oauth2-proxy/issues/926).
32−
33−Please note that not all providers support all claims. The `preferred_username` claim is currently only supported by the
34−OpenID Connect provider.
35−
36−## Email Authentication
37−
38−To authorize a specific email-domain use `--email-domain=yourcompany.com`. To authorize individual email addresses use
39−`--authenticated-emails-file=/path/to/file` with one email per line. To authorize all email addresses use `--email-domain=*`.
40−
41−## Adding a new Provider
42−
43−Follow the examples in the [`providers` package](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/providers/) to define a new
44−`Provider` instance. Add a new `case` to
45−[`providers.New()`](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/providers/providers.go) to allow `oauth2-proxy` to use the
46−new `Provider`.
docs/versioned_docs/version-7.15.x/configuration/providers/keycloak.mddeleted−36
@@ -1,36 +0,0 @@
1−---
2−id: keycloak
3−title: Keycloak (Deprecated)
4−---
5−
6−:::note
7−This is the legacy and deprecated provider for Keycloak, use [Keycloak OIDC Auth Provider](keycloak_oidc.md) if possible.
8−:::
9−
10−1. Create new client in your Keycloak realm with **Access Type** 'confidential' and **Valid Redirect URIs** 'https://internal.yourcompany.com/oauth2/callback'
11−2. Take note of the Secret in the credential tab of the client
12−3. Create a mapper with **Mapper Type** 'Group Membership' and **Token Claim Name** 'groups'.
13−
14−Make sure you set the following to the appropriate url:
15−
16−```
17− --provider=keycloak
18− --client-id=<client you have created>
19− --client-secret=<your client's secret>
20− --login-url="http(s)://<keycloak host>/auth/realms/<your realm>/protocol/openid-connect/auth"
21− --redeem-url="http(s)://<keycloak host>/auth/realms/<your realm>/protocol/openid-connect/token"
22− --profile-url="http(s)://<keycloak host>/auth/realms/<your realm>/protocol/openid-connect/userinfo"
23− --validate-url="http(s)://<keycloak host>/auth/realms/<your realm>/protocol/openid-connect/userinfo"
24− --keycloak-group=<first_allowed_user_group>
25− --keycloak-group=<second_allowed_user_group>
26−```
27−
28−For group based authorization, the optional `--keycloak-group` (legacy) or `--allowed-group` (global standard)
29−flags can be used to specify which groups to limit access to.
30−
31−If these are unset but a `groups` mapper is set up above in step (3), the provider will still
32−populate the `X-Forwarded-Groups` header to your upstream server with the `groups` data in the
33−Keycloak userinfo endpoint response.
34−
35−The group management in keycloak is using a tree. If you create a group named admin in keycloak
36−you should define the 'keycloak-group' value to /admin.
docs/versioned_docs/version-7.15.x/configuration/providers/keycloak_oidc.mddeleted−151
@@ -1,151 +0,0 @@
1−---
2−id: keycloak_oidc
3−title: Keycloak OIDC
4−---
5−
6−## Config Options
7−
8−| Flag | Toml Field | Type | Description | Default |
9−| ---------------- | --------------- | -------------- | ------------------------------------------------------------------------------------------------------------------ | ------- |
10−| `--allowed-role` | `allowed_roles` | string \| list | restrict logins to users with this role (may be given multiple times). Only works with the keycloak-oidc provider. | |
11−
12−## Usage
13−
14−```
15− --provider=keycloak-oidc
16− --client-id=<your client's id>
17− --client-secret=<your client's secret>
18− --redirect-url=https://internal.yourcompany.com/oauth2/callback
19− --oidc-issuer-url=https://<keycloak host>/realms/<your realm> // For Keycloak versions <17: --oidc-issuer-url=https://<keycloak host>/auth/realms/<your realm>
20− --email-domain=<yourcompany.com> // Validate email domain for users, see option documentation
21− --allowed-role=<realm role name> // Optional, required realm role
22− --allowed-role=<client id>:<client role name> // Optional, required client role
23− --allowed-group=</group name> // Optional, requires group client scope
24− --code-challenge-method=S256 // PKCE
25−```
26−
27−:::note
28−Keycloak has updated its admin console and as of version 19.0.0, the new admin console is enabled by default. The
29−legacy admin console has been announced for removal with the release of version 21.0.0.
30−:::
31−
32−**Keycloak legacy admin console**
33−
34−1. Create new client in your Keycloak realm with **Access Type** 'confidential', **Client protocol** 'openid-connect'
35− and **Valid Redirect URIs** 'https://internal.yourcompany.com/oauth2/callback'
36−2. Take note of the Secret in the credential tab of the client
37−3. Create a mapper with **Mapper Type** 'Group Membership' and **Token Claim Name** 'groups'.
38−4. Create a mapper with **Mapper Type** 'Audience' and **Included Client Audience** and **Included Custom Audience** set
39− to your client name.
40−
41−**Keycloak new admin console (default as of v19.0.0)**
42−
43−The following example shows how to create a simple OIDC client using the new Keycloak admin2 console. However, for best
44−practices, it is recommended to consult the Keycloak documentation.
45−
46−The OIDC client must be configured with an _audience mapper_ to include the client's name in the `aud` claim of the JWT token.
47−The `aud` claim specifies the intended recipient of the token, and OAuth2 Proxy expects a match against the values of
48−either `--client-id` or `--oidc-extra-audience`.
49−
50−_In Keycloak, claims are added to JWT tokens through the use of mappers at either the realm level using "client scopes" or
51−through "dedicated" client mappers._
52−
53−**Creating the client**
54−
55−1. Create a new OIDC client in your Keycloak realm by navigating to:
56− **Clients** -> **Create client**
57− * **Client Type** 'OpenID Connect'
58− * **Client ID** `<your client's id>`, please complete the remaining fields as appropriate and click **Next**.
59− * **Client authentication** 'On'
60− * **Authentication flow**
61− * **Standard flow** 'selected'
62− * **Direct access grants** 'deselect'
63− * _Save the configuration._
64− * **Settings / Access settings**:
65− * **Valid redirect URIs** `https://internal.yourcompany.com/oauth2/callback`
66− * _Save the configuration._
67− * Under the **Credentials** tab you will now be able to locate `<your client's secret>`.
68−2. Configure a dedicated *audience mapper* for your client by navigating to **Clients** -> **\<your client's id\>** -> **Client scopes**.
69−* Access the dedicated mappers pane by clicking **\<your client's id\>-dedicated**, located under *Assigned client scope*.
70− _(It should have a description of "Dedicated scope and mappers for this client")_
71− * Click **Configure a new mapper** and select **Audience**
72− * **Name** 'aud-mapper-\<your client's id\>'
73− * **Included Client Audience** select `<your client's id>` from the dropdown.
74− * _OAuth2 proxy can be set up to pass both the access and ID JWT tokens to your upstream services.
75− If you require additional audience entries, you can use the **Included Custom Audience** field in addition
76− to the "Included Client Audience" dropdown. Note that the "aud" claim of a JWT token should be limited and
77− only specify its intended recipients._
78− * **Add to ID token** 'On'
79− * **Add to access token** 'On' - [#1916](https://github.com/oauth2-proxy/oauth2-proxy/pull/1916)
80− * _Save the configuration._
81−* Any subsequent dedicated client mappers can be defined by clicking **Dedicated scopes** -> **Add mapper** ->
82− **By configuration** -> *Select mapper*
83−
84−You should now be able to create a test user in Keycloak and get access to the OAuth2 Proxy instance, make sure to set
85−an email address matching `<yourcompany.com>` and select _Email verified_.
86−
87−**Authorization**
88−
89−_OAuth2 Proxy will perform authorization by requiring a valid user, this authorization can be extended to take into
90−account a user's membership in Keycloak `groups`, `realm roles`, and `client roles` using the keycloak-oidc provider options
91−`--allowed-role` or `--allowed-group`_
92−
93−**Roles**
94−
95−_A standard Keycloak installation comes with the required mappers for **realm roles** and **client roles** through the
96−pre-defined client scope "roles". This ensures that any roles assigned to a user are included in the `JWT` tokens when
97−using an OIDC client that has the "Full scope allowed" feature activated, the feature is enabled by default._
98−
99−_Creating a realm role_
100−* Navigate to **Realm roles** -> **Create role**
101− * **Role name**, *`<realm role name>`* -> **save**
102−
103−_Creating a client role_
104−* Navigate to **Clients** -> `<your client's id>` -> **Roles** -> **Create role**
105− * **Role name**, *`<client role name>`* -> **save**
106−
107−
108−_Assign a role to a user_
109−
110−**Users** -> _Username_ -> **Role mapping** -> **Assign role** -> _filter by roles or clients and select_ -> **Assign**.
111−
112−Keycloak "realm roles" can be authorized using the `--allowed-role=<realm role name>` option, while "client roles" can be
113−evaluated using `--allowed-role=<your client's id>:<client role name>`.
114−
115−You may limit the _realm roles_ included in the JWT tokens for any given client by navigating to:
116−**Clients** -> `<your client's id>` -> **Client scopes** -> _\<your client's id\>-dedicated_ -> **Scope**
117−Disabling **Full scope allowed** activates the **Assign role** option, allowing you to select which roles, if assigned
118−to a user, will be included in the user's JWT tokens. This can be useful when a user has many associated roles, and you
119−want to reduce the size and impact of the JWT token.
120−
121−
122−**Groups**
123−
124−You may also do authorization on group memberships by using the OAuth2 Proxy option `--allowed-group`.
125−We will only do a brief description of creating the required _client scope_ **groups** and refer you to read the Keycloak
126−documentation.
127−
128−To summarize, the steps required to authorize Keycloak group membership with OAuth2 Proxy are as follows:
129−
130−* Create a new Client Scope with the name **groups** in Keycloak.
131− * Include a mapper of type **Group Membership**.
132− * Set the "Token Claim Name" to **groups** or customize by matching it to the `--oidc-groups-claim` option of OAuth2 Proxy.
133− * If the "Full group path" option is selected, you need to include a "/" separator in the group names defined in the
134− `--allowed-group` option of OAuth2 Proxy. Example: "/groupname" or "/groupname/child_group".
135−
136−After creating the _Client Scope_ named _groups_ you will need to attach it to your client.
137−**Clients** -> `<your client's id>` -> **Client scopes** -> **Add client scope** -> Select **groups** and choose Optional
138−and you should now have a client that maps group memberships into the JWT tokens so that Oauth2 Proxy may evaluate them.
139−
140−Create a group by navigating to **Groups** -> **Create group** and _add_ your test user as a member.
141−
142−The OAuth2 Proxy option `--allowed-group=/groupname` will now allow you to filter on group membership
143−
144−Keycloak also has the option of attaching roles to groups, please refer to the Keycloak documentation for more information.
145−
146−**Tip**
147−
148−To check if roles or groups are added to JWT tokens, you can preview a users token in the Keycloak console by following
149−these steps: **Clients** -> `<your client's id>` -> **Client scopes** -> **Evaluate**.
150−Select a _realm user_ and optional _scope parameters_ such as groups, and generate the JSON representation of an access
151−or id token to examine its contents.
docs/versioned_docs/version-7.15.x/configuration/providers/linkedin.mddeleted−13
@@ -1,13 +0,0 @@
1−---
2−id: linkedin
3−title: LinkedIn
4−---
5−
6−For LinkedIn, the registration steps are:
7−
8−1. Create a new project: https://www.linkedin.com/secure/developer
9−2. In the OAuth User Agreement section:
10− - In default scope, select r_basicprofile and r_emailaddress.
11− - In "OAuth 2.0 Redirect URLs", enter `https://internal.yourcompany.com/oauth2/callback`
12−3. Fill in the remaining required fields and Save.
13−4. Take note of the **Consumer Key / API Key** and **Consumer Secret / Secret Key**
docs/versioned_docs/version-7.15.x/configuration/providers/login_gov.mddeleted−79
@@ -1,79 +0,0 @@
1−---
2−id: login_gov
3−title: Login.gov
4−---
5−
6−login.gov is an OIDC provider for the US Government.
7−If you are a US Government agency, you can contact the login.gov team through the contact information
8−that you can find on https://login.gov/developers/ and work with them to understand how to get login.gov
9−accounts for integration/test and production access.
10−
11−A developer guide is available here: https://developers.login.gov/, though this proxy handles everything
12−but the data you need to create to register your application in the login.gov dashboard.
13−
14−As a demo, we will assume that you are running your application that you want to secure locally on
15−http://localhost:3000/, that you will be starting your proxy up on http://localhost:4180/, and that
16−you have an agency integration account for testing.
17−
18−First, register your application in the dashboard. The important bits are:
19−* Identity protocol: make this `Openid connect`
20−* Issuer: do what they say for OpenID Connect. We will refer to this string as `${LOGINGOV_ISSUER}`.
21−* Public key: This is a self-signed certificate in .pem format generated from a 2048-bit RSA private key.
22− A quick way to do this is
23− `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'`.
24− The contents of the `key.pem` shall be referred to as `${OAUTH2_PROXY_JWT_KEY}`.
25−* Return to App URL: Make this be `http://localhost:4180/`
26−* Redirect URIs: Make this be `http://localhost:4180/oauth2/callback`.
27−* Attribute Bundle: Make sure that email is selected.
28−
29−Now start the proxy up with the following options:
30−```
31−./oauth2-proxy -provider login.gov \
32− -client-id=${LOGINGOV_ISSUER} \
33− -redirect-url=http://localhost:4180/oauth2/callback \
34− -oidc-issuer-url=https://idp.int.identitysandbox.gov/ \
35− -cookie-secure=false \
36− -email-domain=gsa.gov \
37− -upstream=http://localhost:3000/ \
38− -cookie-secret=somerandomstring12341234567890AB \
39− -cookie-domain=localhost \
40− -skip-provider-button=true \
41− -pubjwk-url=https://idp.int.identitysandbox.gov/api/openid_connect/certs \
42− -profile-url=https://idp.int.identitysandbox.gov/api/openid_connect/userinfo \
43− -jwt-key="${OAUTH2_PROXY_JWT_KEY}"
44−```
45−You can also set all these options with environment variables, for use in cloud/docker environments.
46−One tricky thing that you may encounter is that some cloud environments will pass in environment
47−variables in a docker env-file, which does not allow multiline variables like a PEM file.
48−If you encounter this, then you can create a `jwt_signing_key.pem` file in the top level
49−directory of the repo which contains the key in PEM format and then do your docker build.
50−The docker build process will copy that file into your image which you can then access by
51−setting the `OAUTH2_PROXY_JWT_KEY_FILE=/etc/ssl/private/jwt_signing_key.pem`
52−environment variable, or by setting `--jwt-key-file=/etc/ssl/private/jwt_signing_key.pem` on the commandline.
53−
54−Once it is running, you should be able to go to `http://localhost:4180/` in your browser,
55−get authenticated by the login.gov integration server, and then get proxied on to your
56−application running on `http://localhost:3000/`. In a real deployment, you would secure
57−your application with a firewall or something so that it was only accessible from the
58−proxy, and you would use real hostnames everywhere.
59−
60−#### Skip OIDC discovery
61−
62−Some providers do not support OIDC discovery via their issuer URL, so oauth2-proxy cannot simply grab the authorization,
63−token and jwks URI endpoints from the provider's metadata.
64−
65−In this case, you can set the `--skip-oidc-discovery` option, and supply those required endpoints manually:
66−
67−```
68− -provider oidc
69− -client-id oauth2-proxy
70− -client-secret proxy
71− -redirect-url http://127.0.0.1:4180/oauth2/callback
72− -oidc-issuer-url http://127.0.0.1:5556
73− -skip-oidc-discovery
74− -login-url http://127.0.0.1:5556/authorize
75− -redeem-url http://127.0.0.1:5556/token
76− -oidc-jwks-url http://127.0.0.1:5556/keys
77− -cookie-secure=false
78− -email-domain example.com
79−```
docs/versioned_docs/version-7.15.x/configuration/providers/ms_azure_ad.mddeleted−59
@@ -1,59 +0,0 @@
1−---
2−id: azure
3−title: Azure (Deprecated)
4−---
5−
6−:::note
7−This is the legacy and deprecated provider for Azure, use [Microsoft Entra ID](ms_entra_id.md) if possible.
8−:::
9−
10−## Config Options
11−
12−| Flag | Toml Field | Type | Description | Default |
13−| ---------------- | -------------- | ------ | ---------------------------------------------------------------- | ---------- |
14−| `--azure-tenant` | `azure_tenant` | string | go to a tenant-specific or common (tenant-independent) endpoint. | `"common"` |
15−| `--resource` | `resource` | string | The resource that is protected (Azure AD only) | |
16−
17−## Usage
18−
19−1. Add an application: go to [https://portal.azure.com](https://portal.azure.com), choose **Azure Active Directory**, select
20− **App registrations** and then click on **New registration**.
21−2. Pick a name, check the supported account type(single-tenant, multi-tenant, etc). In the **Redirect URI** section create a new
22− **Web** platform entry for each app that you want to protect by the oauth2 proxy(e.g.
23− https://internal.yourcompanycom/oauth2/callback). Click **Register**.
24−3. Next we need to add group read permissions for the app registration, on the **API Permissions** page of the app, click on
25− **Add a permission**, select **Microsoft Graph**, then select **Application permissions**, then click on **Group** and select
26− **Group.Read.All**. Hit **Add permissions** and then on **Grant admin consent** (you might need an admin to do this).
27− <br/>**IMPORTANT**: Even if this permission is listed with **"Admin consent required=No"** the consent might actually
28− be required, due to AAD policies you won't be able to see. If you get a **"Need admin approval"** during login,
29− most likely this is what you're missing!
30−4. Next, if you are planning to use v2.0 Azure Auth endpoint, go to the **Manifest** page and set `"accessTokenAcceptedVersion": 2`
31− in the App registration manifest file.
32−5. On the **Certificates & secrets** page of the app, add a new client secret and note down the value after hitting **Add**.
33−6. Configure the proxy with:
34−- for V1 Azure Auth endpoint (Azure Active Directory Endpoints - https://login.microsoftonline.com/common/oauth2/authorize)
35−
36−```
37− --provider=azure
38− --client-id=<application ID from step 3>
39− --client-secret=<value from step 5>
40− --azure-tenant={tenant-id}
41− --oidc-issuer-url=https://sts.windows.net/{tenant-id}/
42−```
43−
44−- for V2 Azure Auth endpoint (Microsoft Identity Platform Endpoints - https://login.microsoftonline.com/common/oauth2/v2.0/authorize)
45−```
46− --provider=azure
47− --client-id=<application ID from step 3>
48− --client-secret=<value from step 5>
49− --azure-tenant={tenant-id}
50− --oidc-issuer-url=https://login.microsoftonline.com/{tenant-id}/v2.0
51−```
52−
53−***Notes***:
54−- When using v2.0 Azure Auth endpoint (`https://login.microsoftonline.com/{tenant-id}/v2.0`) as `--oidc_issuer_url`, in conjunction
55− with `--resource` flag, be sure to append `/.default` at the end of the resource name. See
56− https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-permissions-and-consent#the-default-scope for more details.
57−- When using the Azure Auth provider with nginx and the cookie session store you may find the cookie is too large and doesn't
58− get passed through correctly. Increasing the proxy_buffer_size in nginx or implementing the
59− [redis session storage](../sessions.md#redis-storage) should resolve this.
docs/versioned_docs/version-7.15.x/configuration/providers/ms_entra_id.mddeleted−201
@@ -1,201 +0,0 @@
1−---
2−id: ms_entra_id
3−title: Microsoft Entra ID
4−---
5−
6−Provider for Microsoft Entra ID. Fully compliant with OIDC, with support for group overage and multi-tenant apps.
7−
8−## Config Options
9−
10−The provider is OIDC-compliant, so all the OIDC parameters are honored. Additional provider-specific configuration parameters are:
11−
12−| Flag | Toml Field | Type | Description | Default |
13−| --------------------------- | -------------------------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
14−| `--entra-id-allowed-tenant` | `entra_id_allowed_tenants` | string \| list | List of allowed tenants. In case of multi-tenant apps, incoming tokens are issued by different issuers and OIDC issuer verification needs to be disabled. When not specified, all tenants are allowed. Redundant for single-tenant apps (regular ID token validation matches the issuer). | |
15−| `--entra-id-federated-token-auth` | `entra_id_federated_token_auth` | boolean | Enable oAuth2 client authentication with federated token projected by Entra Workload Identity plugin, instead of client secret. | false |
16−
17−## Configure App registration
18−To begin, create an App registration, set a redirect URI, and generate a secret. All account types are supported, including single-tenant, multi-tenant, multi-tenant with Microsoft accounts, and Microsoft accounts only.
19−
20−<details>
21− <summary>See Azure Portal example</summary>
22− <div class="videoBlock">
23− <iframe src="https://www.youtube.com/embed/IUNfxhOzr4E"></iframe>
24− </div>
25−</details>
26−
27−<details>
28− <summary>See Terraform example</summary>
29−```
30− resource "azuread_application" "auth" {
31− display_name = "oauth2-proxy"
32− sign_in_audience = "AzureADMyOrg" # Others are also supported
33−
34− web {
35− redirect_uris = [
36− "https://podinfo.lakis.tech/oauth2/callback",
37− ]
38− }
39− // We don't specify any required API permissions - we allow user consent only
40− }
41−
42− resource "azuread_service_principal" "sp" {
43− client_id = azuread_application.auth.client_id
44− app_role_assignment_required = false
45− }
46−
47− resource "azuread_service_principal_password" "pass" {
48− service_principal_id = azuread_service_principal.sp.id
49− }
50−
51−```
52−</details>
53−
54−### Configure groups
55−If you want to make use of groups, you can configure *groups claim* to be present in ID Tokens issued by the App registration.
56−<details>
57− <summary>See Azure Portal example</summary>
58− <div class="videoBlock">
59− <div class="videoBlock">
60− <iframe src="https://www.youtube.com/embed/QZmP5MKEJis"></iframe>
61− </div>
62− </div>
63−</details>
64−<details>
65− <summary>See Terraform example</summary>
66−```
67− resource "azuread_application" "auth" {
68− display_name = "oauth2-proxy"
69− sign_in_audience = "AzureADMyOrg"
70−
71− group_membership_claims = [
72− "SecurityGroup"
73− ]
74−
75− web {
76− redirect_uris = [
77− "https://podinfo.lakis.tech/oauth2/callback",
78− ]
79− }
80− }
81−
82− resource "azuread_service_principal" "sp" {
83− client_id = azuread_application.auth.client_id
84− app_role_assignment_required = false
85− }
86−
87− resource "azuread_service_principal_password" "pass" {
88− service_principal_id = azuread_service_principal.sp.id
89− }
90−
91−```
92−</details>
93−
94−### Scopes and claims
95−For single-tenant and multi-tenant apps without groups, the only required scope is `openid` (See: [Scopes and permissions](https://learn.microsoft.com/en-us/entra/identity-platform/scopes-oidc#the-openid-scope)).
96−
97−To make use of groups - for example use `allowed_groups` setting or authorize based on groups inside your service - you need to enable *groups claims* in the App Registration. When enabled, list of groups is present in the issued ID token. No additional scopes are required besides `openid`. This works up to 200 groups.
98−
99−When user has more than 200 group memberships, OAuth2-Proxy attempts to retrieve the complete list from Microsoft Graph API's [`transitiveMemberOf`](https://learn.microsoft.com/en-us/graph/api/user-list-transitivememberof). Endpoint requires `User.Read` scope (delegated permission). This permission can be by default consented by user during first login. Set scope to `openid User.Read` to request user consent. Without proper scope, user with 200+ groups will authenticate with 0 groups. See: [group overages](https://learn.microsoft.com/en-us/security/zero-trust/develop/configure-tokens-group-claims-app-roles#group-overages).
100−
101−Alternatively to user consent, both `openid` and `User.Read` permissions can be consented by admistrator. Then, user is not asked for consent on the first login, and group overage works with `openid` scope only. Admin consent can also be required for some tenants. It can be granted with [azuread_service_principal_delegated_permission_grant](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/resources/service_principal_delegated_permission_grant) terraform resource.
102−
103−For personal microsoft accounts, required scope is `openid profile email`.
104−
105−See: [Overview of permissions and consent in the Microsoft identity platform](https://learn.microsoft.com/en-us/entra/identity-platform/permissions-consent-overview).
106−
107−### Multi-tenant apps
108−To authenticate apps from multiple tenants (including personal Microsoft accounts), set the common OIDC issuer url and disable verification:
109−```toml
110−oidc_issuer_url=https://login.microsoftonline.com/common/v2.0
111−insecure_oidc_skip_issuer_verification=true
112−```
113−`insecure_oidc_skip_issuer_verification` setting is required to disable following checks:
114−* Startup check for matching issuer URL returned from [discovery document](https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration) with `oidc_issuer_url` setting. Required, as document's `issuer` field doesn't equal to `https://login.microsoftonline.com/common/v2.0`. See [OIDC Discovery 4.3](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfigurationValidation).
115−* Matching ID token's `issuer` claim with `oidc_issuer_url` setting during ID token validation. Required to support tokens issued by different tenants. See [OIDC Core 3.1.3.7](https://openid.net/specs/openid-connect-core-1_0.html#IDTokenValidation).
116−
117−To provide additional security, Entra ID provider performs check on the ID token's `issuer` claim to match the `https://login.microsoftonline.com/{tenant-id}/v2.0` template.
118−
119−### Workload Identity
120−Provider supports authentication with federated token, without need of using client secret. Following conditions have to be met:
121−
122−* Cluster has public OIDC provider URL. For major cloud providers, it can be enabled with a single flag, for example for [Azure Kubernetes Service deployed with Terraform](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/kubernetes_cluster), it's `oidc_issuer_enabled`.
123−* Workload Identity admission webhook is deployed on the cluster. For AKS, it can be enabled with a flag (`workload_identity_enabled` in Terraform resource), for clusters outside of Azure, it can be installed from [helm chart](https://github.com/Azure/azure-workload-identity).
124−* Appropriate federated credential is added to application registration.
125−<details>
126− <summary>See federated credential terraform example</summary>
127−```
128− resource "azuread_application_federated_identity_credential" "fedcred" {
129− application_id = azuread_application.application.id # ID of your application
130− display_name = "federation-cred"
131− description = "Workload identity for oauth2-proxy"
132− audiences = ["api://AzureADTokenExchange"] # Fixed value
133− issuer = "https://cluster-oidc-issuer-url..."
134− subject = "system:serviceaccount:oauth2-proxy-namespace-name:oauth2-proxy-sa-name" # set proper NS and SA name
135− }
136−```
137−</details>
138−
139−* Kubernetes service account associated with oauth2-proxy deployment, is annotated with `azure.workload.identity/client-id: <app-registration-client-id>`
140−* oauth2-proxy pod is labeled with `azure.workload.identity/use: "true"`
141−* oauth2-proxy is configured with `entra_id_federated_token_auth` set to `true`.
142−
143−`client_secret` setting can be omitted when using federated token authentication.
144−
145−See: [Azure Workload Identity documentation](https://azure.github.io/azure-workload-identity/docs/).
146−
147−### Example configurations
148−Single-tenant app without groups (*groups claim* not enabled). Consider using generic OIDC provider:
149−```toml
150−provider="entra-id"
151−oidc_issuer_url="https://login.microsoftonline.com/<tenant-id>/v2.0"
152−client_id="<client-id>"
153−client_secret="<client-secret>"
154−scope="openid"
155−```
156−
157−Single-tenant app with up to 200 groups (*groups claim* enabled). Consider using generic OIDC provider:
158−```toml
159−provider="entra-id"
160−oidc_issuer_url="https://login.microsoftonline.com/<tenant-id>/v2.0"
161−client_id="<client-id>"
162−client_secret="<client-secret>"
163−scope="openid"
164−allowed_groups=["ac51800c-2679-4ecb-8130-636380a3b491"]
165−```
166−
167−Single-tenant app with more than 200 groups:
168−```toml
169−provider="entra-id"
170−oidc_issuer_url="https://login.microsoftonline.com/<tenant-id>/v2.0"
171−client_id="<client-id>"
172−client_secret="<client-secret>"
173−scope="openid User.Read"
174−allowed_groups=["968b4844-d5e7-4e18-a834-59927959369f"]
175−```
176−
177−Single-tenant app with more than 200 groups and workload identity enabled:
178−```toml
179−provider="entra-id"
180−oidc_issuer_url="https://login.microsoftonline.com/<tenant-id>/v2.0"
181−client_id="<client-id>"
182−scope="openid User.Read"
183−allowed_groups=["968b4844-d5e7-4e18-a834-59927959369f"]
184−entra_id_federated_token_auth=true
185−```
186−
187−Multi-tenant app with Microsoft personal accounts & one Entra tenant allowed, with group overage considered:
188−```toml
189−provider="entra-id"
190−oidc_issuer_url="https://login.microsoftonline.com/common/v2.0"
191−client_id="<client-id>"
192−client_secret="<client-secret>"
193−insecure_oidc_skip_issuer_verification=true
194−scope="openid profile email User.Read"
195−entra_id_allowed_tenants=["9188040d-6c67-4c5b-b112-36a304b66dad","<my-tenant-id>"] # Allow only <my-tenant-id> and Personal MS Accounts tenant
196−email_domains="*"
197−```
198−
199−## Kubernetes Dashboard Integration
200−
201−For a complete guide on integrating oauth2-proxy with Kubernetes Dashboard on AKS using Azure Entra ID authentication, including detailed configuration examples, RBAC setup, troubleshooting, and Workload Identity setup, see the [Kubernetes Dashboard integration guide](../integrations/kubernetes-dashboard.md).
docs/versioned_docs/version-7.15.x/configuration/providers/nextcloud.mddeleted−28
@@ -1,28 +0,0 @@
1−---
2−id: nextcloud
3−title: NextCloud
4−---
5−
6−The Nextcloud provider allows you to authenticate against users in your
7−Nextcloud instance.
8−
9−When you are using the Nextcloud provider, you must specify the urls via
10−configuration, environment variable, or command line argument. Depending
11−on whether your Nextcloud instance is using pretty urls your urls may be of the
12−form `/index.php/apps/oauth2/*` or `/apps/oauth2/*`.
13−
14−Refer to the [OAuth2
15−documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/oauth2.html)
16−to set up the client id and client secret. Your "Redirection URI" will be
17−`https://internalapp.yourcompany.com/oauth2/callback`.
18−
19−```
20− -provider nextcloud
21− -client-id <from nextcloud admin>
22− -client-secret <from nextcloud admin>
23− -login-url="<your nextcloud url>/index.php/apps/oauth2/authorize"
24− -redeem-url="<your nextcloud url>/index.php/apps/oauth2/api/v1/token"
25− -validate-url="<your nextcloud url>/ocs/v2.php/cloud/user?format=json"
26−```
27−
28−Note: in *all* cases the validate-url will *not* have the `index.php`.
docs/versioned_docs/version-7.15.x/configuration/providers/openid_connect.mddeleted−146
@@ -1,146 +0,0 @@
1−---
2−id: openid_connect
3−title: OpenID Connect
4−---
5−
6−OpenID Connect is a spec for OAUTH 2.0 + identity that is implemented by many major providers and several open source projects.
7−
8−This provider was originally built against CoreOS Dex, and we will use it as an example.
9−The OpenID Connect Provider (OIDC) can also be used to connect to other Identity Providers such as Okta, an example can be found below.
10−
11−#### Dex
12−
13−To configure the OIDC provider for Dex, perform the following steps:
14−
15−1. Download Dex:
16−
17− ```
18− go get github.com/dexidp/dex
19− ```
20−
21− See the [getting started guide](https://dexidp.io/docs/getting-started/) for more details.
22−
23−2. Setup oauth2-proxy with the correct provider and using the default ports and callbacks. Add a configuration block to
24− the `staticClients` section of `examples/config-dev.yaml`:
25−
26− ```
27− - id: oauth2-proxy
28− redirectURIs:
29− - 'http://127.0.0.1:4180/oauth2/callback'
30− name: 'oauth2-proxy'
31− secret: proxy
32− ```
33−
34−3. Launch Dex: from `$GOPATH/github.com/dexidp/dex`, run:
35−
36− ```
37− bin/dex serve examples/config-dev.yaml
38− ```
39−
40−4. In a second terminal, run the oauth2-proxy with the following args:
41−
42− ```shell
43− --provider oidc
44− --provider-display-name "My OIDC Provider"
45− --client-id oauth2-proxy
46− --client-secret proxy
47− --redirect-url http://127.0.0.1:4180/oauth2/callback
48− --oidc-issuer-url http://127.0.0.1:5556/dex
49− --cookie-secure=false
50− --cookie-secret=secret
51− --email-domain kilgore.trout
52− ```
53−
54− To serve the current working directory as a website under the `/static` endpoint, add:
55−
56− ```shell
57− --upstream file://$PWD/#/static/
58− ```
59−
60−5. Test the setup by visiting http://127.0.0.1:4180 or http://127.0.0.1:4180/static .
61−
62−See also [our local testing environment](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/contrib/local-environment) for a self-contained example using Docker and etcd as storage for Dex.
63−
64−#### Okta
65−
66−To configure the OIDC provider for Okta, perform the following steps:
67−
68−1. Log in to Okta using an administrative account. It is suggested you try this in preview first, `example.oktapreview.com`
69−2. (OPTIONAL) If you want to configure authorization scopes and claims to be passed on to multiple applications,
70− you may wish to configure an authorization server for each application. Otherwise, the provided `default` will work.
71− * Navigate to **Security** then select **API**
72− * Click **Add Authorization Server**, if this option is not available you may require an additional license for a custom
73− authorization server.
74− * Fill out the **Name** with something to describe the application you are protecting. e.g. 'Example App'.
75− * For **Audience**, pick the URL of the application you wish to protect: https://example.corp.com
76− * Fill out a **Description**
77− * Add any **Access Policies** you wish to configure to limit application access.
78− * The default settings will work for other options.
79− [See Okta documentation for more information on Authorization Servers](https://developer.okta.com/docs/guides/customize-authz-server/overview/)
80−3. Navigate to **Applications** then select **Add Application**.
81− * Select **Web** for the **Platform** setting.
82− * Select **OpenID Connect** and click **Create**
83− * Pick an **Application Name** such as `Example App`.
84− * Set the **Login redirect URI** to `https://example.corp.com`.
85− * Under **General** set the **Allowed grant types** to `Authorization Code` and `Refresh Token`.
86− * Leave the rest as default, taking note of the `Client ID` and `Client Secret`.
87− * Under **Assignments** select the users or groups you wish to access your application.
88−4. Create a configuration file like the following:
89−
90− ```
91− provider = "oidc"
92− redirect_url = "https://example.corp.com/oauth2/callback"
93− oidc_issuer_url = "https://corp.okta.com/oauth2/abCd1234"
94− upstreams = [
95− "https://example.corp.com"
96− ]
97− email_domains = [
98− "corp.com"
99− ]
100− client_id = "XXXXX"
101− client_secret = "YYYYY"
102− pass_access_token = true
103− cookie_secret = "ZZZZZ"
104− skip_provider_button = true
105− ```
106−
107−The `oidc_issuer_url` is based on URL from your **Authorization Server**'s **Issuer** field in step 2, or simply
108−https://corp.okta.com. The `client_id` and `client_secret` are configured in the application settings.
109−Generate a unique `cookie_secret` to encrypt the cookie.
110−
111−Then you can start the oauth2-proxy with `./oauth2-proxy --config /etc/example.cfg`
112−
113−#### Okta - localhost
114−
115−1. Signup for developer account: https://developer.okta.com/signup/
116−2. Create New `Web` Application: https://$\{your-okta-domain\}/dev/console/apps/new
117−3. Example Application Settings for localhost:
118− * **Name:** My Web App
119− * **Base URIs:** http://localhost:4180/
120− * **Login redirect URIs:** http://localhost:4180/oauth2/callback
121− * **Logout redirect URIs:** http://localhost:4180/
122− * **Group assignments:** `Everyone`
123− * **Grant type allowed:** `Authorization Code` and `Refresh Token`
124−4. Make note of the `Client ID` and `Client secret`, they are needed in a future step
125−5. Make note of the **default** Authorization Server Issuer URI from: https://$\{your-okta-domain\}/admin/oauth2/as
126−6. Example config file `/etc/localhost.cfg`
127− ```shell
128− provider = "oidc"
129− redirect_url = "http://localhost:4180/oauth2/callback"
130− oidc_issuer_url = "https://$\{your-okta-domain\}/oauth2/default"
131− upstreams = [
132− "http://0.0.0.0:8080"
133− ]
134− email_domains = [
135− "*"
136− ]
137− client_id = "XXX"
138− client_secret = "YYY"
139− pass_access_token = true
140− cookie_secret = "ZZZ"
141− cookie_secure = false
142− skip_provider_button = true
143− # Note: use the following for testing within a container
144− # http_address = "0.0.0.0:4180"
145− ```
146−7. Then you can start the oauth2-proxy with `./oauth2-proxy --config /etc/localhost.cfg`
docs/versioned_docs/version-7.15.x/configuration/providers/sourcehut.mddeleted−25
@@ -1,25 +0,0 @@
1−---
2−id: sourcehut
3−title: SourceHut
4−---
5−
6−1. Create a new OAuth client: https://meta.sr.ht/oauth2
7−2. Under `Redirection URI` enter the correct URL, i.e.
8− `https://internal.yourcompany.com/oauth2/callback`
9−
10−To use the provider, start with `--provider=sourcehut`.
11−
12−If you are hosting your own SourceHut instance, make sure you set the following
13−to the appropriate URLs:
14−
15−```shell
16− --login-url="https://<meta.your.instance>/oauth2/authorize"
17− --redeem-url="https://<meta.your.instance>/oauth2/access-token"
18− --profile-url="https://<meta.your.instance>/query"
19− --validate-url="https://<meta.your.instance>/profile"
20−```
21−
22−The default configuration allows everyone with an account to authenticate.
23−Restricting access is currently only supported by
24−[email](index.md#email-authentication).
25−
docs/versioned_docs/version-7.15.x/configuration/sessions.mddeleted−99
@@ -1,99 +0,0 @@
1−---
2−id: session_storage
3−title: Session Storage
4−---
5−
6−Sessions allow a user's authentication to be tracked between multiple HTTP
7−requests to a service.
8−
9−The OAuth2 Proxy uses a Cookie to track user sessions and will store the session
10−data in one of the available session storage backends.
11−
12−At present the available backends are (as passed to `--session-store-type`):
13−- [cookie](#cookie-storage) (default)
14−- [redis](#redis-storage)
15−
16−### Cookie Storage
17−
18−The Cookie storage backend is the default backend implementation and has
19−been used in the OAuth2 Proxy historically.
20−
21−With the Cookie storage backend, all session information is stored in client
22−side cookies and transferred with each and every request.
23−
24−The following should be known when using this implementation:
25−- Since all state is stored client side, this storage backend means that the OAuth2 Proxy is completely stateless
26−- Cookies are signed server side to prevent modification client-side
27−- It is mandatory to set a `cookie-secret` which will ensure data is encrypted within the cookie data.
28−- Since multiple requests can be made concurrently to the OAuth2 Proxy, this session implementation
29−cannot lock sessions and while updating and refreshing sessions, there can be conflicts which force
30−users to re-authenticate
31−
32−
33−### Redis Storage
34−
35−The Redis Storage backend stores encrypted sessions in redis. Instead of sending all the information
36−back the client for storage, as in the [Cookie storage](#cookie-storage), a ticket is sent back
37−to the user as the cookie value instead.
38−
39−A ticket is composed as the following:
40−
41−`{CookieName}-{ticketID}.{secret}`
42−
43−Where:
44−
45−- The `CookieName` is the OAuth2 cookie name (_oauth2_proxy by default)
46−- The `ticketID` is a 128-bit random number, hex-encoded
47−- The `secret` is a 128-bit random number, base64url encoded (no padding). The secret is unique for every session.
48−- The pair of `{CookieName}-{ticketID}` comprises a ticket handle, and thus, the redis key
49−to which the session is stored. The encoded session is encrypted with the secret and stored
50−in redis via the `SETEX` command.
51−
52−Encrypting every session uniquely protects the refresh/access/id tokens stored in the session from
53−disclosure. Additionally, the browser only has to send a short Cookie with every request and not the whole JWT,
54−which can get quite big.
55−
56−Two settings are used to configure the OAuth2 Proxy cookie lifetime:
57−
58− --cookie-refresh duration refresh the cookie after this duration; 0 to disable
59− --cookie-expire duration expire timeframe for cookie 168h0m0s
60−
61−The "cookie-expire" value should be equal to the lifetime of the Refresh-Token that is issued by the OAuth2 authorization server.
62−If it expires earlier and is deleted by the browser, OAuth2 Proxy cannot find the stored Refresh-Tokens in Redis and thus cannot start
63−the refresh flow to get a new Access-Token. If it is longer, it might be that the old Refresh-Token will be found in Redis but has already
64−expired.
65−
66−The "cookie-refresh" value controls when OAuth2 Proxy tries to refresh an Access-Token. If it is set to "0", the
67−Access-Token will never be refreshed, even if it is already expired and a valid Refresh-Token is available. If set, OAuth2 Proxy will
68−refresh the Access-Token after this many seconds whether it is still valid or not. According to the official OAuth2.0 specification
69−Access-Tokens are not required to follow a specific format. Therefore OAuth2 Proxy cannot check for any expiry date without an
70−introspection endpoint. If an Access-Token expires and you have not set a corresponding "cookie-refresh" value, you will likely
71−encounter expiry issues.
72−
73−Caveat: It can happen that the Access-Token is valid for e.g. "1m" and a request happens after exactly "59s".
74−It would pass OAuth2 Proxy and be forwarded to the backend but is just expired when the backend tries to validate
75−it. This is especially relevant if the backend uses the JWT to make requests to other backends.
76−For this reason, it's advised to set the cookie-refresh a couple of seconds less than the Access-Token lifespan.
77−
78−Recommended settings:
79−
80−* cookie_refresh := Access-Token lifespan - 1m
81−* cookie_expire := Refresh-Token lifespan (i.e. Keycloak client_session_idle)
82−
83−#### Usage
84−
85−When using the redis store, specify `--session-store-type=redis` as well as the Redis connection URL, via
86−`--redis-connection-url=redis://host[:port][/db-number]`.
87−
88−You may also configure the store for Redis Sentinel. In this case, you will want to use the
89−`--redis-use-sentinel=true` flag, as well as configure the flags `--redis-sentinel-master-name`
90−and `--redis-sentinel-connection-urls` appropriately.
91−
92−Redis Cluster is available to be the backend store as well. To leverage it, you will need to set the
93−`--redis-use-cluster=true` flag, and configure the flags `--redis-cluster-connection-urls` appropriately.
94−
95−Note that flags `--redis-use-sentinel=true` and `--redis-use-cluster=true` are mutually exclusive.
96−
97−Note, if Redis timeout option is set to non-zero, the `--redis-connection-idle-timeout`
98−must be less than [Redis timeout option](https://redis.io/docs/reference/clients/#client-timeouts). For example: if either redis.conf includes
99−`timeout 15` or using `CONFIG SET timeout 15` the `--redis-connection-idle-timeout` must be at least `--redis-connection-idle-timeout=14`
docs/versioned_docs/version-7.15.x/configuration/systemd_socket.mddeleted−51
@@ -1,51 +0,0 @@
1−---
2−id: systemd_socket
3−title: Systemd Socket Activation
4−---
5−
6−Pass an existing listener created by systemd.socket to oauth2-proxy.
7−
8−To do this create a socket:
9−
10−oauth2-proxy.socket
11−```
12−[Socket]
13−ListenStream=%t/oauth2.sock
14−SocketGroup=www-data
15−SocketMode=0660
16−```
17−
18−Now it's possible to call this socket from e.g. nginx:
19−```
20−server {
21− location /oauth2/ {
22− proxy_pass http://unix:/run/oauth2-proxy/oauth2.sock;
23−}
24−```
25−
26−The oauth2-proxy should have `--http-address=fd:3` as a parameter.
27−Here fd is case insensitive and means file descriptor. The number 3 refers to the first non-stdin/stdout/stderr file descriptor,
28−systemd-socket-activate (which is what systemd.socket uses), listens to what it is told and passes
29−the listener it created onto the process, starting with file descriptor 3.
30−
31−```
32−./oauth2-proxy \
33− --http-address="fd:3" \
34− --email-domain="yourcompany.com" \
35− --upstream=http://127.0.0.1:8080/ \
36− --cookie-secret=... \
37− --cookie-secure=true \
38− --provider=... \
39− --client-id=... \
40− --client-secret=...
41−```
42−
43−## Trusted IPs
44−
45−When listening on a Unix socket, Go sets `http.Request.RemoteAddr` to `"@"` instead of the usual `"host:port"` format. This means there is no client IP available from the connection itself.
46−
47−As a result, `--trusted-ip` entries cannot match against the direct connection address for Unix socket listeners. Requests arriving over a Unix socket will never be considered "trusted" based on their `RemoteAddr`. IP-based trust decisions will still work if a trusted reverse proxy sets `X-Forwarded-For` or `X-Real-IP` headers and `--reverse-proxy=true` is configured.
48−
49−## TLS
50−
51−Currently TLS is not supported (but it's doable).
docs/versioned_docs/version-7.15.x/configuration/tls.mddeleted−85
@@ -1,85 +0,0 @@
1−---
2−id: tls
3−title: TLS Configuration
4−---
5−
6−There are two recommended configurations:
7−- [At OAuth2 Proxy](#terminate-tls-at-oauth2-proxy)
8−- [At Reverse Proxy](#terminate-tls-at-reverse-proxy-eg-nginx)
9−
10−### Terminate TLS at OAuth2 Proxy
11−
12−1. Configure SSL Termination with OAuth2 Proxy by providing a `--tls-cert-file=/path/to/cert.pem` and `--tls-key-file=/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-file=/path/to/cert.pem \
21− --tls-key-file=/path/to/cert.key \
22− --cookie-secret=... \
23− --cookie-secure=true \
24− --provider=... \
25− --client-id=... \
26− --client-secret=...
27− ```
28−
29−2. With this configuration approach the customization of the TLS settings is limited.
30−
31− The minimal acceptable TLS version can be set with `--tls-min-version=TLS1.3`.
32− The defaults set `TLS1.2` as the minimal version.
33− Regardless of the minimum version configured, `TLS1.3` is currently always used as the maximal version.
34−
35− TLS server side cipher suites can be specified with `--tls-cipher-suite=TLS_RSA_WITH_RC4_128_SHA`.
36− If not specified, the defaults from [`crypto/tls`](https://pkg.go.dev/crypto/tls#CipherSuites) of the currently used `go` version for building `oauth2-proxy` will be used.
37− A complete list of valid TLS cipher suite names can be found in [`crypto/tls`](https://pkg.go.dev/crypto/tls#pkg-constants).
38−
39−### Terminate TLS at Reverse Proxy, e.g. Nginx
40−
41−1. Configure SSL Termination with [Nginx](http://nginx.org/) (example config below), Amazon ELB, Google Cloud Platform Load Balancing, or ...
42−
43− Because `oauth2-proxy` listens on `127.0.0.1:4180` by default, to listen on all interfaces (needed when using an
44− external load balancer like Amazon ELB or Google Platform Load Balancing) use `--http-address="0.0.0.0:4180"` or
45− `--http-address="http://:4180"`.
46−
47− Nginx will listen on port `443` and handle SSL connections while proxying to `oauth2-proxy` on port `4180`.
48− `oauth2-proxy` will then authenticate requests for an upstream application. The external endpoint for this example
49− would be `https://internal.yourcompany.com/`.
50−
51− An example Nginx config follows. Note the use of `Strict-Transport-Security` header to pin requests to SSL
52− via [HSTS](http://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security):
53−
54− ```
55− server {
56− listen 443 default ssl;
57− server_name internal.yourcompany.com;
58− ssl_certificate /path/to/cert.pem;
59− ssl_certificate_key /path/to/cert.key;
60− add_header Strict-Transport-Security max-age=2592000;
61−
62− location / {
63− proxy_pass http://127.0.0.1:4180;
64− proxy_set_header Host $host;
65− proxy_set_header X-Real-IP $remote_addr;
66− proxy_connect_timeout 1;
67− proxy_send_timeout 30;
68− proxy_read_timeout 30;
69− }
70− }
71− ```
72−
73−2. The command line to run `oauth2-proxy` in this configuration would look like this:
74−
75− ```bash
76− ./oauth2-proxy \
77− --email-domain="yourcompany.com" \
78− --upstream=http://127.0.0.1:8080/ \
79− --cookie-secret=... \
80− --cookie-secure=true \
81− --provider=... \
82− --reverse-proxy=true \
83− --client-id=... \
84− --client-secret=...
85− ```
docs/versioned_docs/version-7.15.x/features/endpoints.mddeleted−73
@@ -1,73 +0,0 @@
1−---
2−id: endpoints
3−title: Endpoints
4−---
5−
6−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.
7−
8−- / - the proxy endpoint provides authentication and returns the appropriate 40x error if not authenticated or authorized then passes the request upstream.
9−- /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
10−- /ping - returns a 200 OK response, which is intended for use with health checks
11−- /ready - returns a 200 OK response if all the underlying connections (e.g., Redis store) are connected
12−- /metrics - Metrics endpoint for Prometheus to scrape, serve on the address specified by `--metrics-address`, disabled by default
13−- /oauth2/sign_in - the login page, which also doubles as a sign-out page (it clears cookies)
14−- /oauth2/sign_out - this URL is used to clear the session cookie
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/userinfo - the URL is used to return user's email from the session in JSON format.
18−- /oauth2/auth - only returns a 202 Accepted response or a 401 Unauthorized response; for use with the [Nginx `auth_request` directive](../configuration/integrations/nginx)
19−- /oauth2/static/\* - stylesheets and other dependencies used in the sign_in and error pages
20−
21−### Sign out
22−
23−To sign the user out, redirect them to `/oauth2/sign_out`. This endpoint only removes oauth2-proxy's own cookies, i.e. the user is still logged in with the authentication provider and may automatically re-login when accessing the application again. You will also need to redirect the user to the authentication provider's sign-out page afterward using the `rd` query parameter, i.e. redirect the user to something like (notice the url-encoding!):
24−
25−```
26−/oauth2/sign_out?rd=https%3A%2F%2Fmy-oidc-provider.example.com%2Fsign_out_page
27−```
28−
29−Alternatively, include the redirect URL in the `X-Auth-Request-Redirect` header:
30−
31−```
32−GET /oauth2/sign_out HTTP/1.1
33−X-Auth-Request-Redirect: https://my-oidc-provider/sign_out_page
34−...
35−```
36−
37−(The "sign_out_page" should be the [`end_session_endpoint`](https://openid.net/specs/openid-connect-session-1_0.html#rfc.section.2.1) from [the metadata](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig) if your OIDC provider supports Session Management and Discovery.)
38−
39−BEWARE that the domain you want to redirect to (`my-oidc-provider.example.com` in the example) must be added to the [`--whitelist-domain`](../configuration/overview) configuration option otherwise the redirect will be ignored. Make sure to include the actual domain and port (if needed) and not the URL (e.g "localhost:8081" instead of "http://localhost:8081").
40−
41−ID Token can be injected in the redirect url by using `{id_token}` placeholder. For example to redirect to `https://my-oidc-provider.example.com/sign_out_page?id_token_hint={id_token}&post_logout_redirect_uri=https://my-app.example.com`;
42−
43−```
44−/oauth2/sign_out?rd=https%3A%2F%2Fmy-oidc-provider.example.com%2Fsign_out_page%3Fid_token_hint%3D%7Bid_token%7D%26post_logout_redirect_uri%3Dhttps%3A%2F%2Fmy-app.example.com
45−```
46−
47−or alternatively in the header:
48−
49−```
50−GET /oauth2/sign_out HTTP/1.1
51−X-Auth-Request-Redirect: https://my-oidc-provider.example.com/sign_out_page?id_token_hint={id_token}&post_logout_redirect_uri=https://my-app.example.com
52−...
53−```
54−
55−### Auth
56−
57−This endpoint returns 202 Accepted response or a 401 Unauthorized response.
58−
59−It can be configured using the following query parameters:
60−- `allowed_groups`: comma separated list of allowed groups
61−- `allowed_email_domains`: comma separated list of allowed email domains
62−- `allowed_emails`: comma separated list of allowed emails
63−
64−### Proxy (/)
65−
66−This endpoint returns the upstream response if authenticated.
67−If unauthenticated it returns a 401 Unauthorized. If the authenticatd user
68−is not in one of the allowed groups, or emails then it returns a 403 forbidden
69−
70−It can be configured using the following query parameters:
71−- `allowed_groups`: comma separated list of allowed groups
72−- `allowed_email_domains`: comma separated list of allowed email domains
73−- `allowed_emails`: comma separated list of allowed emails
docs/versioned_docs/version-7.15.x/installation.mddeleted−32
@@ -1,32 +0,0 @@
1−---
2−id: installation
3−title: Installation
4−---
5−
6−1. Choose how to deploy:
7−
8− a. Using a [Prebuilt Binary](https://github.com/oauth2-proxy/oauth2-proxy/releases) (current release is `v7.15.4`)
9−
10− b. Using Go to install the latest release
11− ```bash
12− $ go install github.com/oauth2-proxy/oauth2-proxy/v7@latest
13− ```
14− This will install the binary into `$GOPATH/bin`. Make sure you include `$GOPATH` in your `$PATH`. Otherwise your system won't find binaries installed via `go install`
15−
16− c. Using a [Prebuilt Docker Image](https://quay.io/oauth2-proxy/oauth2-proxy) (AMD64, PPC64LE, S390x, ARMv6, ARMv7, and ARM64 available)
17−
18− d. Using a [Pre-Release Nightly Docker Image](https://quay.io/oauth2-proxy/oauth2-proxy-nightly) (AMD64, PPC64LE, ARMv6, ARMv7, and ARM64 available)
19−
20− e. Using the official [Kubernetes manifest](https://github.com/oauth2-proxy/manifests) (Helm)
21−
22− 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`.
23−
24− ```
25− $ sha256sum -c sha256sum.txt
26− oauth2-proxy-x.y.z.linux-amd64: OK
27− ```
28−
29−2. [Select a Provider and Register an OAuth Application with a Provider](configuration/providers/index.md)
30−3. [Configure OAuth2 Proxy using config file, command line options, or environment variables](configuration/overview.md)
31−4. [Configure SSL or Deploy behind an SSL endpoint](configuration/tls.md) (example provided for Nginx)
32−5. [Configure OAuth2 Proxy using systemd.socket](configuration/systemd_socket.md) (example provided for Nginx/Systemd)
docs/versioned_docs/version-7.15.x/welcome.mddeleted−33
@@ -1,33 +0,0 @@
1−---
2−id: welcome
3−title: Welcome
4−hide_table_of_contents: true
5−slug: /
6−---
7−
8−![OAuth2 Proxy](/img/logos/OAuth2_Proxy_horizontal.svg)
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
14−This repository was forked from [bitly/OAuth2_Proxy](https://github.com/bitly/oauth2_proxy) on 27/11/2018.
15−Versions v3.0.0 and up are from this fork and will have diverged from any changes in the original fork.
16−A list of changes can be seen in the [CHANGELOG](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/CHANGELOG.md).
17−:::
18−
19−![Sign In Page](/img/sign-in-page.png)
20−
21−## Architecture
22−
23−![OAuth2 Proxy Architecture](/img/simplified-architecture.svg)
24−
25−
26−## Cloud Native Computing Foundation
27−
28−OAuth2 Proxy is a [Cloud Native Computing Foundation](https://cncf.io) Sandbox project.
29−
30−![CNCF](https://www.cncf.io/wp-content/uploads/2023/04/cncf-main-site-logo.svg)
31−
32−The Linux Foundation® (TLF) has registered trademarks and uses trademarks. For a list of TLF trademarks, see [Trademark Usage](https://www.linuxfoundation.org/legal/trademark-usage).
33−
docs/versioned_docs/version-7.2.x/behaviour.md+5−20
@@ -3,24 +3,9 @@ id: behaviour
33title: Behaviour
44---
55
6−1. Authentication Requirement: All requests passing through the proxy to upstream applications require authentication, excluding default proxy endpoints.
7− - Exception: If the request matches a skipped route (configured via `--skip-auth-route`):
8− - Authentication is not enforced, but the proxy will opportunistically attempt to validate a session cookie (`--cookie-name`) or JWT (`--skip-jwt-bearer-tokens`) if present in the request.
9− - Configured user info and authentication headers (e.g., `--pass-access-token`) are injected to upstream routes when validation succeeds.
6+1. Any request passing through the proxy (and not matched by `--skip-auth-regex`) is checked for the proxy's session cookie (`--cookie-name`) (or, if allowed, a JWT token - see `--skip-jwt-bearer-tokens`).
7+2. If authentication is required but missing then the user is asked to log in and redirected to the authentication provider (unless it is an Ajax request, i.e. one with `Accept: application/json`, in which case 401 Unauthorized is returned)
8+3. After returning from the authentication provider, the oauth tokens are stored in the configured session store (cookie, redis, ...) and a cookie is set
9+4. The request is forwarded to the upstream server with added user info and authentication headers (depending on the configuration)
1010
11−2. Unauthenticated Requests: When authentication is missing but required, the user is redirected to the configured Identity Provider (IdP) login page by default.
12− - Ajax Requests: If the request has `Accept: application/json` header:
13− - Returns `401 Unauthorized`.
14− - Invalid JWT Tokens: If `--skip-jwt-bearer-tokens` is set and the request includes an invalid JWT:
15− - Redirects to the login page by default.
16− - Returns `403 Forbidden` if `--bearer-token-login-fallback` is set to `false`.
17−
18−3. Post-Authentication: After successful authentication with the IdP, OAuth tokens are stored in the configured session store (cookie or Redis), and a cookie is set.
19−
20−4. Request Forwarding: The authenticated request is processed based on configuration:
21− - Forwarded to the configured upstream application with added user info and authentication headers, or
22− - Returns a valid status code for downstream processing by another proxy or load balancer (e.g., Nginx or Traefik).
23−
24−---
25−
26−Note: The proxy also provides a number of useful [endpoints](features/endpoints.md) for monitoring and management.
11+Notice that the proxy also provides a number of useful [endpoints](features/endpoints.md).
docs/versioned_docs/version-7.3.x/behaviour.md+5−20
@@ -3,24 +3,9 @@ id: behaviour
33title: Behaviour
44---
55
6−1. Authentication Requirement: All requests passing through the proxy to upstream applications require authentication, excluding default proxy endpoints.
7− - Exception: If the request matches a skipped route (configured via `--skip-auth-route`):
8− - Authentication is not enforced, but the proxy will opportunistically attempt to validate a session cookie (`--cookie-name`) or JWT (`--skip-jwt-bearer-tokens`) if present in the request.
9− - Configured user info and authentication headers (e.g., `--pass-access-token`) are injected to upstream routes when validation succeeds.
6+1. Any request passing through the proxy (and not matched by `--skip-auth-regex`) is checked for the proxy's session cookie (`--cookie-name`) (or, if allowed, a JWT token - see `--skip-jwt-bearer-tokens`).
7+2. If authentication is required but missing then the user is asked to log in and redirected to the authentication provider (unless it is an Ajax request, i.e. one with `Accept: application/json`, in which case 401 Unauthorized is returned)
8+3. After returning from the authentication provider, the oauth tokens are stored in the configured session store (cookie, redis, ...) and a cookie is set
9+4. The request is forwarded to the upstream server with added user info and authentication headers (depending on the configuration)
1010
11−2. Unauthenticated Requests: When authentication is missing but required, the user is redirected to the configured Identity Provider (IdP) login page by default.
12− - Ajax Requests: If the request has `Accept: application/json` header:
13− - Returns `401 Unauthorized`.
14− - Invalid JWT Tokens: If `--skip-jwt-bearer-tokens` is set and the request includes an invalid JWT:
15− - Redirects to the login page by default.
16− - Returns `403 Forbidden` if `--bearer-token-login-fallback` is set to `false`.
17−
18−3. Post-Authentication: After successful authentication with the IdP, OAuth tokens are stored in the configured session store (cookie or Redis), and a cookie is set.
19−
20−4. Request Forwarding: The authenticated request is processed based on configuration:
21− - Forwarded to the configured upstream application with added user info and authentication headers, or
22− - Returns a valid status code for downstream processing by another proxy or load balancer (e.g., Nginx or Traefik).
23−
24−---
25−
26−Note: The proxy also provides a number of useful [endpoints](features/endpoints.md) for monitoring and management.
11+Notice that the proxy also provides a number of useful [endpoints](features/endpoints.md).
docs/versioned_docs/version-7.4.x/behaviour.md+5−20
@@ -3,24 +3,9 @@ id: behaviour
33title: Behaviour
44---
55
6−1. Authentication Requirement: All requests passing through the proxy to upstream applications require authentication, excluding default proxy endpoints.
7− - Exception: If the request matches a skipped route (configured via `--skip-auth-route`):
8− - Authentication is not enforced, but the proxy will opportunistically attempt to validate a session cookie (`--cookie-name`) or JWT (`--skip-jwt-bearer-tokens`) if present in the request.
9− - Configured user info and authentication headers (e.g., `--pass-access-token`) are injected to upstream routes when validation succeeds.
6+1. Any request passing through the proxy (and not matched by `--skip-auth-regex`) is checked for the proxy's session cookie (`--cookie-name`) (or, if allowed, a JWT token - see `--skip-jwt-bearer-tokens`).
7+2. If authentication is required but missing then the user is asked to log in and redirected to the authentication provider (unless it is an Ajax request, i.e. one with `Accept: application/json`, in which case 401 Unauthorized is returned)
8+3. After returning from the authentication provider, the oauth tokens are stored in the configured session store (cookie, redis, ...) and a cookie is set
9+4. The request is forwarded to the upstream server with added user info and authentication headers (depending on the configuration)
1010
11−2. Unauthenticated Requests: When authentication is missing but required, the user is redirected to the configured Identity Provider (IdP) login page by default.
12− - Ajax Requests: If the request has `Accept: application/json` header:
13− - Returns `401 Unauthorized`.
14− - Invalid JWT Tokens: If `--skip-jwt-bearer-tokens` is set and the request includes an invalid JWT:
15− - Redirects to the login page by default.
16− - Returns `403 Forbidden` if `--bearer-token-login-fallback` is set to `false`.
17−
18−3. Post-Authentication: After successful authentication with the IdP, OAuth tokens are stored in the configured session store (cookie or Redis), and a cookie is set.
19−
20−4. Request Forwarding: The authenticated request is processed based on configuration:
21− - Forwarded to the configured upstream application with added user info and authentication headers, or
22− - Returns a valid status code for downstream processing by another proxy or load balancer (e.g., Nginx or Traefik).
23−
24−---
25−
26−Note: The proxy also provides a number of useful [endpoints](features/endpoints.md) for monitoring and management.
11+Notice that the proxy also provides a number of useful [endpoints](features/endpoints.md).
docs/versioned_docs/version-7.5.x/behaviour.md+5−20
@@ -3,24 +3,9 @@ id: behaviour
33title: Behaviour
44---
55
6−1. Authentication Requirement: All requests passing through the proxy to upstream applications require authentication, excluding default proxy endpoints.
7− - Exception: If the request matches a skipped route (configured via `--skip-auth-route`):
8− - Authentication is not enforced, but the proxy will opportunistically attempt to validate a session cookie (`--cookie-name`) or JWT (`--skip-jwt-bearer-tokens`) if present in the request.
9− - Configured user info and authentication headers (e.g., `--pass-access-token`) are injected to upstream routes when validation succeeds.
6+1. Any request passing through the proxy (and not matched by `--skip-auth-regex`) is checked for the proxy's session cookie (`--cookie-name`) (or, if allowed, a JWT token - see `--skip-jwt-bearer-tokens`).
7+2. If authentication is required but missing then the user is asked to log in and redirected to the authentication provider (unless it is an Ajax request, i.e. one with `Accept: application/json`, in which case 401 Unauthorized is returned)
8+3. After returning from the authentication provider, the oauth tokens are stored in the configured session store (cookie, redis, ...) and a cookie is set
9+4. The request is forwarded to the upstream server with added user info and authentication headers (depending on the configuration)
1010
11−2. Unauthenticated Requests: When authentication is missing but required, the user is redirected to the configured Identity Provider (IdP) login page by default.
12− - Ajax Requests: If the request has `Accept: application/json` header:
13− - Returns `401 Unauthorized`.
14− - Invalid JWT Tokens: If `--skip-jwt-bearer-tokens` is set and the request includes an invalid JWT:
15− - Redirects to the login page by default.
16− - Returns `403 Forbidden` if `--bearer-token-login-fallback` is set to `false`.
17−
18−3. Post-Authentication: After successful authentication with the IdP, OAuth tokens are stored in the configured session store (cookie or Redis), and a cookie is set.
19−
20−4. Request Forwarding: The authenticated request is processed based on configuration:
21− - Forwarded to the configured upstream application with added user info and authentication headers, or
22− - Returns a valid status code for downstream processing by another proxy or load balancer (e.g., Nginx or Traefik).
23−
24−---
25−
26−Note: The proxy also provides a number of useful [endpoints](features/endpoints.md) for monitoring and management.
11+Notice that the proxy also provides a number of useful [endpoints](features/endpoints.md).
docs/versioned_docs/version-7.6.x/behaviour.md+5−20
@@ -3,24 +3,9 @@ id: behaviour
33title: Behaviour
44---
55
6−1. Authentication Requirement: All requests passing through the proxy to upstream applications require authentication, excluding default proxy endpoints.
7− - Exception: If the request matches a skipped route (configured via `--skip-auth-route`):
8− - Authentication is not enforced, but the proxy will opportunistically attempt to validate a session cookie (`--cookie-name`) or JWT (`--skip-jwt-bearer-tokens`) if present in the request.
9− - Configured user info and authentication headers (e.g., `--pass-access-token`) are injected to upstream routes when validation succeeds.
6+1. Any request passing through the proxy (and not matched by `--skip-auth-regex`) is checked for the proxy's session cookie (`--cookie-name`) (or, if allowed, a JWT token - see `--skip-jwt-bearer-tokens`).
7+2. If authentication is required but missing then the user is asked to log in and redirected to the authentication provider (unless it is an Ajax request, i.e. one with `Accept: application/json`, in which case 401 Unauthorized is returned)
8+3. After returning from the authentication provider, the oauth tokens are stored in the configured session store (cookie, redis, ...) and a cookie is set
9+4. The request is forwarded to the upstream server with added user info and authentication headers (depending on the configuration)
1010
11−2. Unauthenticated Requests: When authentication is missing but required, the user is redirected to the configured Identity Provider (IdP) login page by default.
12− - Ajax Requests: If the request has `Accept: application/json` header:
13− - Returns `401 Unauthorized`.
14− - Invalid JWT Tokens: If `--skip-jwt-bearer-tokens` is set and the request includes an invalid JWT:
15− - Redirects to the login page by default.
16− - Returns `403 Forbidden` if `--bearer-token-login-fallback` is set to `false`.
17−
18−3. Post-Authentication: After successful authentication with the IdP, OAuth tokens are stored in the configured session store (cookie or Redis), and a cookie is set.
19−
20−4. Request Forwarding: The authenticated request is processed based on configuration:
21− - Forwarded to the configured upstream application with added user info and authentication headers, or
22− - Returns a valid status code for downstream processing by another proxy or load balancer (e.g., Nginx or Traefik).
23−
24−---
25−
26−Note: The proxy also provides a number of useful [endpoints](features/endpoints.md) for monitoring and management.
11+Notice that the proxy also provides a number of useful [endpoints](features/endpoints.md).
docs/versioned_docs/version-7.6.x/configuration/overview.md−1
@@ -237,7 +237,6 @@ Provider specific options can be found on their respective subpages.
237237| flag: `--session-store-type`<br/>toml: `session_store_type` | string | [Session data storage backend](sessions.md); redis or cookie | cookie |
238238| flag: `--redis-cluster-connection-urls`<br/>toml: `redis_cluster_connection_urls` | string \| list | List of Redis cluster connection URLs (e.g. `redis://HOST[:PORT]`). Used in conjunction with `--redis-use-cluster` | |
239239| flag: `--redis-connection-url`<br/>toml: `redis_connection_url` | string | URL of redis server for redis session storage (e.g. `redis://HOST[:PORT]`) | |
240−| flag: `--redis-ca-path`<br/>toml: `redis_ca_path` | string | Path to a CA certificates file that should be used when connecting to redis. If not specified, the system cert pool is used instead. |
241240| flag: `--redis-insecure-skip-tls-verify`<br/>toml: `redis_insecure_skip_tls_verify` | bool | skip TLS verification when connecting to Redis | false |
242241| flag: `--redis-password`<br/>toml: `redis_password` | string | Redis password. Applicable for all Redis configurations. Will override any password set in `--redis-connection-url` | |
243242| flag: `--redis-sentinel-password`<br/>toml: `redis_sentinel_password` | string | Redis sentinel password. Used only for sentinel connection; any redis node passwords need to use `--redis-password` | |
docs/versioned_docs/version-7.6.x/configuration/providers/gitlab.md+1−1
@@ -8,7 +8,7 @@ title: GitLab
88| Flag | Toml Field | Type | Description | Default |
99| ------------------- | ----------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
1010| `--gitlab-group` | `gitlab_groups` | string \| list | restrict logins to members of any of these groups (slug), separated by a comma | |
11−| `--gitlab-project` | `gitlab_projects` | string \| list | restrict logins to members of any of these projects (may be given multiple times) formatted as `orgname/repo=accesslevel`. Access level should be a value matching [Gitlab access levels](https://docs.gitlab.com/ee/api/members.html#valid-access-levels), defaulted to 20 if absent | |
11+| `--gitlab-projects` | `gitlab_projects` | string \| list | restrict logins to members of any of these projects (may be given multiple times) formatted as `orgname/repo=accesslevel`. Access level should be a value matching [Gitlab access levels](https://docs.gitlab.com/ee/api/members.html#valid-access-levels), defaulted to 20 if absent | |
1212
1313## Usage
1414
docs/versioned_docs/version-7.7.x/behaviour.md+5−20
@@ -3,24 +3,9 @@ id: behaviour
33title: Behaviour
44---
55
6−1. Authentication Requirement: All requests passing through the proxy to upstream applications require authentication, excluding default proxy endpoints.
7− - Exception: If the request matches a skipped route (configured via `--skip-auth-route`):
8− - Authentication is not enforced, but the proxy will opportunistically attempt to validate a session cookie (`--cookie-name`) or JWT (`--skip-jwt-bearer-tokens`) if present in the request.
9− - Configured user info and authentication headers (e.g., `--pass-access-token`) are injected to upstream routes when validation succeeds.
6+1. Any request passing through the proxy (and not matched by `--skip-auth-regex`) is checked for the proxy's session cookie (`--cookie-name`) (or, if allowed, a JWT token - see `--skip-jwt-bearer-tokens`).
7+2. If authentication is required but missing then the user is asked to log in and redirected to the authentication provider (unless it is an Ajax request, i.e. one with `Accept: application/json`, in which case 401 Unauthorized is returned)
8+3. After returning from the authentication provider, the oauth tokens are stored in the configured session store (cookie, redis, ...) and a cookie is set
9+4. The request is forwarded to the upstream server with added user info and authentication headers (depending on the configuration)
1010
11−2. Unauthenticated Requests: When authentication is missing but required, the user is redirected to the configured Identity Provider (IdP) login page by default.
12− - Ajax Requests: If the request has `Accept: application/json` header:
13− - Returns `401 Unauthorized`.
14− - Invalid JWT Tokens: If `--skip-jwt-bearer-tokens` is set and the request includes an invalid JWT:
15− - Redirects to the login page by default.
16− - Returns `403 Forbidden` if `--bearer-token-login-fallback` is set to `false`.
17−
18−3. Post-Authentication: After successful authentication with the IdP, OAuth tokens are stored in the configured session store (cookie or Redis), and a cookie is set.
19−
20−4. Request Forwarding: The authenticated request is processed based on configuration:
21− - Forwarded to the configured upstream application with added user info and authentication headers, or
22− - Returns a valid status code for downstream processing by another proxy or load balancer (e.g., Nginx or Traefik).
23−
24−---
25−
26−Note: The proxy also provides a number of useful [endpoints](features/endpoints.md) for monitoring and management.
11+Notice that the proxy also provides a number of useful [endpoints](features/endpoints.md).
docs/versioned_docs/version-7.7.x/configuration/overview.md−1
@@ -237,7 +237,6 @@ Provider specific options can be found on their respective subpages.
237237| flag: `--session-store-type`<br/>toml: `session_store_type` | string | [Session data storage backend](sessions.md); redis or cookie | cookie |
238238| flag: `--redis-cluster-connection-urls`<br/>toml: `redis_cluster_connection_urls` | string \| list | List of Redis cluster connection URLs (e.g. `redis://HOST[:PORT]`). Used in conjunction with `--redis-use-cluster` | |
239239| flag: `--redis-connection-url`<br/>toml: `redis_connection_url` | string | URL of redis server for redis session storage (e.g. `redis://HOST[:PORT]`) | |
240−| flag: `--redis-ca-path`<br/>toml: `redis_ca_path` | string | Path to a CA certificates file that should be used when connecting to redis. If not specified, the system cert pool is used instead. |
241240| flag: `--redis-insecure-skip-tls-verify`<br/>toml: `redis_insecure_skip_tls_verify` | bool | skip TLS verification when connecting to Redis | false |
242241| flag: `--redis-password`<br/>toml: `redis_password` | string | Redis password. Applicable for all Redis configurations. Will override any password set in `--redis-connection-url` | |
243242| flag: `--redis-sentinel-password`<br/>toml: `redis_sentinel_password` | string | Redis sentinel password. Used only for sentinel connection; any redis node passwords need to use `--redis-password` | |
docs/versioned_docs/version-7.7.x/configuration/providers/gitlab.md+1−1
@@ -8,7 +8,7 @@ title: GitLab
88| Flag | Toml Field | Type | Description | Default |
99| ------------------- | ----------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
1010| `--gitlab-group` | `gitlab_groups` | string \| list | restrict logins to members of any of these groups (slug), separated by a comma | |
11−| `--gitlab-project` | `gitlab_projects` | string \| list | restrict logins to members of any of these projects (may be given multiple times) formatted as `orgname/repo=accesslevel`. Access level should be a value matching [Gitlab access levels](https://docs.gitlab.com/ee/api/members.html#valid-access-levels), defaulted to 20 if absent | |
11+| `--gitlab-projects` | `gitlab_projects` | string \| list | restrict logins to members of any of these projects (may be given multiple times) formatted as `orgname/repo=accesslevel`. Access level should be a value matching [Gitlab access levels](https://docs.gitlab.com/ee/api/members.html#valid-access-levels), defaulted to 20 if absent | |
1212
1313## Usage
1414
docs/versioned_docs/version-7.8.x/behaviour.md+5−20
@@ -3,24 +3,9 @@ id: behaviour
33title: Behaviour
44---
55
6−1. Authentication Requirement: All requests passing through the proxy to upstream applications require authentication, excluding default proxy endpoints.
7− - Exception: If the request matches a skipped route (configured via `--skip-auth-route`):
8− - Authentication is not enforced, but the proxy will opportunistically attempt to validate a session cookie (`--cookie-name`) or JWT (`--skip-jwt-bearer-tokens`) if present in the request.
9− - Configured user info and authentication headers (e.g., `--pass-access-token`) are injected to upstream routes when validation succeeds.
6+1. Any request passing through the proxy (and not matched by `--skip-auth-regex`) is checked for the proxy's session cookie (`--cookie-name`) (or, if allowed, a JWT token - see `--skip-jwt-bearer-tokens`).
7+2. If authentication is required but missing then the user is asked to log in and redirected to the authentication provider (unless it is an Ajax request, i.e. one with `Accept: application/json`, in which case 401 Unauthorized is returned)
8+3. After returning from the authentication provider, the oauth tokens are stored in the configured session store (cookie, redis, ...) and a cookie is set
9+4. The request is forwarded to the upstream server with added user info and authentication headers (depending on the configuration)
1010
11−2. Unauthenticated Requests: When authentication is missing but required, the user is redirected to the configured Identity Provider (IdP) login page by default.
12− - Ajax Requests: If the request has `Accept: application/json` header:
13− - Returns `401 Unauthorized`.
14− - Invalid JWT Tokens: If `--skip-jwt-bearer-tokens` is set and the request includes an invalid JWT:
15− - Redirects to the login page by default.
16− - Returns `403 Forbidden` if `--bearer-token-login-fallback` is set to `false`.
17−
18−3. Post-Authentication: After successful authentication with the IdP, OAuth tokens are stored in the configured session store (cookie or Redis), and a cookie is set.
19−
20−4. Request Forwarding: The authenticated request is processed based on configuration:
21− - Forwarded to the configured upstream application with added user info and authentication headers, or
22− - Returns a valid status code for downstream processing by another proxy or load balancer (e.g., Nginx or Traefik).
23−
24−---
25−
26−Note: The proxy also provides a number of useful [endpoints](features/endpoints.md) for monitoring and management.
11+Notice that the proxy also provides a number of useful [endpoints](features/endpoints.md).
docs/versioned_docs/version-7.8.x/configuration/overview.md−1
@@ -239,7 +239,6 @@ Provider specific options can be found on their respective subpages.
239239| flag: `--session-store-type`<br/>toml: `session_store_type` | string | [Session data storage backend](sessions.md); redis or cookie | cookie |
240240| flag: `--redis-cluster-connection-urls`<br/>toml: `redis_cluster_connection_urls` | string \| list | List of Redis cluster connection URLs (e.g. `redis://HOST[:PORT]`). Used in conjunction with `--redis-use-cluster` | |
241241| flag: `--redis-connection-url`<br/>toml: `redis_connection_url` | string | URL of redis server for redis session storage (e.g. `redis://HOST[:PORT]`) | |
242−| flag: `--redis-ca-path`<br/>toml: `redis_ca_path` | string | Path to a CA certificates file that should be used when connecting to redis. If not specified, the system cert pool is used instead. |
243242| flag: `--redis-insecure-skip-tls-verify`<br/>toml: `redis_insecure_skip_tls_verify` | bool | skip TLS verification when connecting to Redis | false |
244243| flag: `--redis-password`<br/>toml: `redis_password` | string | Redis password. Applicable for all Redis configurations. Will override any password set in `--redis-connection-url` | |
245244| flag: `--redis-sentinel-password`<br/>toml: `redis_sentinel_password` | string | Redis sentinel password. Used only for sentinel connection; any redis node passwords need to use `--redis-password` | |
docs/versioned_docs/version-7.8.x/configuration/providers/gitlab.md+1−1
@@ -8,7 +8,7 @@ title: GitLab
88| Flag | Toml Field | Type | Description | Default |
99| ------------------- | ----------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
1010| `--gitlab-group` | `gitlab_groups` | string \| list | restrict logins to members of any of these groups (slug), separated by a comma | |
11−| `--gitlab-project` | `gitlab_projects` | string \| list | restrict logins to members of any of these projects (may be given multiple times) formatted as `orgname/repo=accesslevel`. Access level should be a value matching [Gitlab access levels](https://docs.gitlab.com/ee/api/members.html#valid-access-levels), defaulted to 20 if absent | |
11+| `--gitlab-projects` | `gitlab_projects` | string \| list | restrict logins to members of any of these projects (may be given multiple times) formatted as `orgname/repo=accesslevel`. Access level should be a value matching [Gitlab access levels](https://docs.gitlab.com/ee/api/members.html#valid-access-levels), defaulted to 20 if absent | |
1212
1313## Usage
1414
docs/versioned_docs/version-7.9.x/behaviour.md+5−20
@@ -3,24 +3,9 @@ id: behaviour
33title: Behaviour
44---
55
6−1. Authentication Requirement: All requests passing through the proxy to upstream applications require authentication, excluding default proxy endpoints.
7− - Exception: If the request matches a skipped route (configured via `--skip-auth-route`):
8− - Authentication is not enforced, but the proxy will opportunistically attempt to validate a session cookie (`--cookie-name`) or JWT (`--skip-jwt-bearer-tokens`) if present in the request.
9− - Configured user info and authentication headers (e.g., `--pass-access-token`) are injected to upstream routes when validation succeeds.
6+1. Any request passing through the proxy (and not matched by `--skip-auth-regex`) is checked for the proxy's session cookie (`--cookie-name`) (or, if allowed, a JWT token - see `--skip-jwt-bearer-tokens`).
7+2. If authentication is required but missing then the user is asked to log in and redirected to the authentication provider (unless it is an Ajax request, i.e. one with `Accept: application/json`, in which case 401 Unauthorized is returned)
8+3. After returning from the authentication provider, the oauth tokens are stored in the configured session store (cookie, redis, ...) and a cookie is set
9+4. The request is forwarded to the upstream server with added user info and authentication headers (depending on the configuration)
1010
11−2. Unauthenticated Requests: When authentication is missing but required, the user is redirected to the configured Identity Provider (IdP) login page by default.
12− - Ajax Requests: If the request has `Accept: application/json` header:
13− - Returns `401 Unauthorized`.
14− - Invalid JWT Tokens: If `--skip-jwt-bearer-tokens` is set and the request includes an invalid JWT:
15− - Redirects to the login page by default.
16− - Returns `403 Forbidden` if `--bearer-token-login-fallback` is set to `false`.
17−
18−3. Post-Authentication: After successful authentication with the IdP, OAuth tokens are stored in the configured session store (cookie or Redis), and a cookie is set.
19−
20−4. Request Forwarding: The authenticated request is processed based on configuration:
21− - Forwarded to the configured upstream application with added user info and authentication headers, or
22− - Returns a valid status code for downstream processing by another proxy or load balancer (e.g., Nginx or Traefik).
23−
24−---
25−
26−Note: The proxy also provides a number of useful [endpoints](features/endpoints.md) for monitoring and management.
11+Notice that the proxy also provides a number of useful [endpoints](features/endpoints.md).
docs/versioned_docs/version-7.9.x/configuration/overview.md−1
@@ -241,7 +241,6 @@ Provider specific options can be found on their respective subpages.
241241| flag: `--session-store-type`<br/>toml: `session_store_type` | string | [Session data storage backend](sessions.md); redis or cookie | cookie |
242242| flag: `--redis-cluster-connection-urls`<br/>toml: `redis_cluster_connection_urls` | string \| list | List of Redis cluster connection URLs (e.g. `redis://HOST[:PORT]`). Used in conjunction with `--redis-use-cluster` | |
243243| flag: `--redis-connection-url`<br/>toml: `redis_connection_url` | string | URL of redis server for redis session storage (e.g. `redis://HOST[:PORT]`) | |
244−| flag: `--redis-ca-path`<br/>toml: `redis_ca_path` | string | Path to a CA certificates file that should be used when connecting to redis. If not specified, the system cert pool is used instead. |
245244| flag: `--redis-insecure-skip-tls-verify`<br/>toml: `redis_insecure_skip_tls_verify` | bool | skip TLS verification when connecting to Redis | false |
246245| flag: `--redis-password`<br/>toml: `redis_password` | string | Redis password. Applicable for all Redis configurations. Will override any password set in `--redis-connection-url` | |
247246| flag: `--redis-sentinel-password`<br/>toml: `redis_sentinel_password` | string | Redis sentinel password. Used only for sentinel connection; any redis node passwords need to use `--redis-password` | |
docs/versioned_docs/version-7.9.x/configuration/providers/gitlab.md+1−1
@@ -8,7 +8,7 @@ title: GitLab
88| Flag | Toml Field | Type | Description | Default |
99| ------------------- | ----------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
1010| `--gitlab-group` | `gitlab_groups` | string \| list | restrict logins to members of any of these groups (slug), separated by a comma | |
11−| `--gitlab-project` | `gitlab_projects` | string \| list | restrict logins to members of any of these projects (may be given multiple times) formatted as `orgname/repo=accesslevel`. Access level should be a value matching [Gitlab access levels](https://docs.gitlab.com/ee/api/members.html#valid-access-levels), defaulted to 20 if absent | |
11+| `--gitlab-projects` | `gitlab_projects` | string \| list | restrict logins to members of any of these projects (may be given multiple times) formatted as `orgname/repo=accesslevel`. Access level should be a value matching [Gitlab access levels](https://docs.gitlab.com/ee/api/members.html#valid-access-levels), defaulted to 20 if absent | |
1212
1313## Usage
1414
docs/versioned_sidebars/version-7.13.x-sidebars.json+1−17
@@ -22,21 +22,7 @@
2222 "collapsed": false,
2323 "items": [
2424 "configuration/overview",
25− {
26− "type": "category",
27− "label": "Integration Guides",
28− "link": {
29− "type": "doc",
30− "id": "configuration/integrations/index"
31− },
32− "items": [
33− "configuration/integrations/nginx",
34− "configuration/integrations/traefik",
35− "configuration/integrations/caddy",
36− "configuration/integrations/headlamp",
37− "configuration/integrations/kubernetes-dashboard"
38− ]
39− },
25+ "configuration/integration",
4026 {
4127 "type": "category",
4228 "label": "OAuth Provider Configuration",
@@ -48,8 +34,6 @@
4834 "configuration/providers/adfs",
4935 "configuration/providers/azure",
5036 "configuration/providers/bitbucket",
51− "configuration/providers/cidaas",
52− "configuration/providers/cisco_duo",
5337 "configuration/providers/digitalocean",
5438 "configuration/providers/facebook",
5539 "configuration/providers/gitea",
docs/versioned_sidebars/version-7.14.x-sidebars.jsondeleted−100
@@ -1,100 +0,0 @@
1−{
2− "docs": [
3− {
4− "type": "doc",
5− "id": "welcome"
6− },
7− {
8− "type": "doc",
9− "id": "installation"
10− },
11− {
12− "type": "doc",
13− "id": "behaviour"
14− },
15− {
16− "type": "category",
17− "label": "Configuration",
18− "link": {
19− "type": "doc",
20− "id": "configuration/overview"
21− },
22− "collapsed": false,
23− "items": [
24− "configuration/overview",
25− {
26− "type": "category",
27− "label": "Integration Guides",
28− "link": {
29− "type": "doc",
30− "id": "configuration/integrations/index"
31− },
32− "items": [
33− "configuration/integrations/nginx",
34− "configuration/integrations/traefik",
35− "configuration/integrations/caddy",
36− "configuration/integrations/headlamp",
37− "configuration/integrations/kubernetes-dashboard"
38− ]
39− },
40− {
41− "type": "category",
42− "label": "OAuth Provider Configuration",
43− "link": {
44− "type": "doc",
45− "id": "configuration/providers/index"
46− },
47− "items": [
48− "configuration/providers/adfs",
49− "configuration/providers/azure",
50− "configuration/providers/bitbucket",
51− "configuration/providers/cidaas",
52− "configuration/providers/cisco_duo",
53− "configuration/providers/digitalocean",
54− "configuration/providers/facebook",
55− "configuration/providers/gitea",
56− "configuration/providers/github",
57− "configuration/providers/gitlab",
58− "configuration/providers/google",
59− "configuration/providers/keycloak",
60− "configuration/providers/keycloak_oidc",
61− "configuration/providers/linkedin",
62− "configuration/providers/login_gov",
63− "configuration/providers/ms_entra_id",
64− "configuration/providers/nextcloud",
65− "configuration/providers/openid_connect",
66− "configuration/providers/sourcehut"
67− ]
68− },
69− "configuration/session_storage",
70− "configuration/tls",
71− "configuration/alpha-config"
72− ]
73− },
74− {
75− "type": "category",
76− "label": "Features",
77− "link": {
78− "type": "doc",
79− "id": "features/endpoints"
80− },
81− "collapsed": false,
82− "items": [
83− "features/endpoints"
84− ]
85− },
86− {
87− "type": "category",
88− "label": "Community",
89− "link": {
90− "type": "doc",
91− "id": "community/security"
92− },
93− "collapsed": false,
94− "items": [
95− "community/contribution",
96− "community/security"
97− ]
98− }
99− ]
100−}
docs/versioned_sidebars/version-7.15.x-sidebars.jsondeleted−100
@@ -1,100 +0,0 @@
1−{
2− "docs": [
3− {
4− "type": "doc",
5− "id": "welcome"
6− },
7− {
8− "type": "doc",
9− "id": "installation"
10− },
11− {
12− "type": "doc",
13− "id": "behaviour"
14− },
15− {
16− "type": "category",
17− "label": "Configuration",
18− "link": {
19− "type": "doc",
20− "id": "configuration/overview"
21− },
22− "collapsed": false,
23− "items": [
24− "configuration/overview",
25− {
26− "type": "category",
27− "label": "Integration Guides",
28− "link": {
29− "type": "doc",
30− "id": "configuration/integrations/index"
31− },
32− "items": [
33− "configuration/integrations/nginx",
34− "configuration/integrations/traefik",
35− "configuration/integrations/caddy",
36− "configuration/integrations/headlamp",
37− "configuration/integrations/kubernetes-dashboard"
38− ]
39− },
40− {
41− "type": "category",
42− "label": "OAuth Provider Configuration",
43− "link": {
44− "type": "doc",
45− "id": "configuration/providers/index"
46− },
47− "items": [
48− "configuration/providers/adfs",
49− "configuration/providers/azure",
50− "configuration/providers/bitbucket",
51− "configuration/providers/cidaas",
52− "configuration/providers/cisco_duo",
53− "configuration/providers/digitalocean",
54− "configuration/providers/facebook",
55− "configuration/providers/gitea",
56− "configuration/providers/github",
57− "configuration/providers/gitlab",
58− "configuration/providers/google",
59− "configuration/providers/keycloak",
60− "configuration/providers/keycloak_oidc",
61− "configuration/providers/linkedin",
62− "configuration/providers/login_gov",
63− "configuration/providers/ms_entra_id",
64− "configuration/providers/nextcloud",
65− "configuration/providers/openid_connect",
66− "configuration/providers/sourcehut"
67− ]
68− },
69− "configuration/session_storage",
70− "configuration/tls",
71− "configuration/alpha-config"
72− ]
73− },
74− {
75− "type": "category",
76− "label": "Features",
77− "link": {
78− "type": "doc",
79− "id": "features/endpoints"
80− },
81− "collapsed": false,
82− "items": [
83− "features/endpoints"
84− ]
85− },
86− {
87− "type": "category",
88− "label": "Community",
89− "link": {
90− "type": "doc",
91− "id": "community/security"
92− },
93− "collapsed": false,
94− "items": [
95− "community/contribution",
96− "community/security"
97− ]
98− }
99− ]
100−}
docs/versions.json−2
@@ -1,6 +1,4 @@
11[
2− "7.15.x",
3− "7.14.x",
42 "7.13.x",
53 "7.12.x",
64 "7.11.x",
go.mod+48−45
@@ -1,83 +1,86 @@
11module github.com/oauth2-proxy/oauth2-proxy/v7
22
3−go 1.26.0
3+go 1.25.3
44
55require (
66 cloud.google.com/go/compute/metadata v0.9.0
77 github.com/Bose/minisentinel v0.0.0-20200130220412-917c5a9223bb
88 github.com/a8m/envsubst v1.4.3
9− github.com/alicebob/miniredis/v2 v2.38.0
9+ github.com/alicebob/miniredis/v2 v2.35.0
1010 github.com/bitly/go-simplejson v0.5.1
11− github.com/bsm/redislock v0.10.0
12− github.com/coreos/go-oidc/v3 v3.20.0
11+ github.com/bsm/redislock v0.9.4
12+ github.com/coreos/go-oidc/v3 v3.16.0
1313 github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
14− github.com/fsnotify/fsnotify v1.10.1
15− github.com/go-jose/go-jose/v3 v3.0.5
16− github.com/go-jose/go-jose/v4 v4.1.4
17− github.com/go-viper/mapstructure/v2 v2.5.0
18− github.com/golang-jwt/jwt/v5 v5.3.1
14+ github.com/fsnotify/fsnotify v1.9.0
15+ github.com/go-jose/go-jose/v3 v3.0.4
16+ github.com/go-viper/mapstructure/v2 v2.4.0
17+ github.com/golang-jwt/jwt/v5 v5.3.0
1918 github.com/google/go-cmp v0.7.0
2019 github.com/google/uuid v1.6.0
2120 github.com/gorilla/mux v1.8.1
2221 github.com/justinas/alice v1.2.0
2322 github.com/oauth2-proxy/mockoidc v0.0.0-20240214162133-caebfff84d25
24− github.com/onsi/ginkgo/v2 v2.32.1
25− github.com/onsi/gomega v1.42.1
26− github.com/pierrec/lz4/v4 v4.1.28
27− github.com/prometheus/client_golang v1.24.1
28− github.com/redis/go-redis/v9 v9.22.0
23+ github.com/onsi/ginkgo/v2 v2.27.2
24+ github.com/onsi/gomega v1.38.2
25+ github.com/pierrec/lz4/v4 v4.1.22
26+ github.com/prometheus/client_golang v1.23.2
27+ github.com/redis/go-redis/v9 v9.16.0
2928 github.com/spf13/cast v1.10.0
3029 github.com/spf13/pflag v1.0.10
3130 github.com/spf13/viper v1.21.0
32− github.com/stretchr/testify v1.12.0
31+ github.com/stretchr/testify v1.11.1
3332 github.com/vmihailenco/msgpack/v5 v5.4.1
34− go.yaml.in/yaml/v3 v3.0.5
35− golang.org/x/crypto v0.55.0
36− golang.org/x/net v0.58.0
37− golang.org/x/oauth2 v0.36.0
38− golang.org/x/sync v0.22.0
39− google.golang.org/api v0.293.0
33+ go.yaml.in/yaml/v3 v3.0.4
34+ golang.org/x/crypto v0.43.0
35+ golang.org/x/net v0.46.0
36+ golang.org/x/oauth2 v0.32.0
37+ golang.org/x/sync v0.17.0
38+ google.golang.org/api v0.254.0
4039 gopkg.in/natefinch/lumberjack.v2 v2.2.1
41− k8s.io/apimachinery v0.36.3
40+ k8s.io/apimachinery v0.34.1
4241)
4342
4443require (
45− cloud.google.com/go/auth v0.23.1 // indirect
44+ cloud.google.com/go/auth v0.17.0 // indirect
4645 cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
47− github.com/Masterminds/semver/v3 v3.5.0 // indirect
46+ github.com/Masterminds/semver/v3 v3.4.0 // indirect
4847 github.com/beorn7/perks v1.0.1 // indirect
4948 github.com/cespare/xxhash/v2 v2.3.0 // indirect
50− github.com/felixge/httpsnoop v1.1.0 // indirect
51− github.com/go-logr/logr v1.4.4 // indirect
49+ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
50+ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
51+ github.com/felixge/httpsnoop v1.0.4 // indirect
52+ github.com/go-jose/go-jose/v4 v4.1.3 // indirect
53+ github.com/go-logr/logr v1.4.3 // indirect
5254 github.com/go-logr/stdr v1.2.2 // indirect
5355 github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
54− github.com/google/pprof v0.0.0-20260802141513-ef3492d7dac3 // indirect
56+ github.com/google/pprof v0.0.0-20251007162407-5df77e3f7d1d // indirect
5557 github.com/google/s2a-go v0.1.9 // indirect
56− github.com/googleapis/enterprise-certificate-proxy v0.3.21 // indirect
57− github.com/googleapis/gax-go/v2 v2.23.0 // indirect
58+ github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect
59+ github.com/googleapis/gax-go/v2 v2.15.0 // indirect
5860 github.com/kylelemons/godebug v1.1.0 // indirect
5961 github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
60− github.com/pelletier/go-toml/v2 v2.4.3 // indirect
62+ github.com/pelletier/go-toml/v2 v2.2.4 // indirect
63+ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
6164 github.com/prometheus/client_model v0.6.2 // indirect
62− github.com/prometheus/common v0.70.1 // indirect
63− github.com/prometheus/procfs v0.21.1 // indirect
65+ github.com/prometheus/common v0.67.2 // indirect
66+ github.com/prometheus/procfs v0.19.1 // indirect
6467 github.com/sagikazarmark/locafero v0.12.0 // indirect
6568 github.com/spf13/afero v1.15.0 // indirect
6669 github.com/subosito/gotenv v1.6.0 // indirect
6770 github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
68− github.com/yuin/gopher-lua v1.1.2 // indirect
71+ github.com/yuin/gopher-lua v1.1.1 // indirect
6972 go.opentelemetry.io/auto/sdk v1.2.1 // indirect
70− go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.70.0 // indirect
71− go.opentelemetry.io/otel v1.45.0 // indirect
72− go.opentelemetry.io/otel/metric v1.45.0 // indirect
73− go.opentelemetry.io/otel/trace v1.45.0 // indirect
74− go.uber.org/atomic v1.11.0 // indirect
75− golang.org/x/mod v0.40.0 // indirect
76− golang.org/x/sys v0.47.0 // indirect
77− golang.org/x/text v0.41.0 // indirect
78− golang.org/x/tools v0.49.0 // indirect
79− google.golang.org/genproto/googleapis/rpc v0.0.0-20260817212433-ac3dfec99bb1 // indirect
80− google.golang.org/grpc v1.83.0 // indirect
81− google.golang.org/protobuf v1.36.12 // indirect
73+ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 // indirect
74+ go.opentelemetry.io/otel v1.38.0 // indirect
75+ go.opentelemetry.io/otel/metric v1.38.0 // indirect
76+ go.opentelemetry.io/otel/trace v1.38.0 // indirect
77+ go.yaml.in/yaml/v2 v2.4.3 // indirect
78+ golang.org/x/mod v0.29.0 // indirect
79+ golang.org/x/sys v0.37.0 // indirect
80+ golang.org/x/text v0.30.0 // indirect
81+ golang.org/x/tools v0.38.0 // indirect
82+ google.golang.org/genproto/googleapis/rpc v0.0.0-20251029180050-ab9386a59fda // indirect
83+ google.golang.org/grpc v1.76.0 // indirect
84+ google.golang.org/protobuf v1.36.10 // indirect
8285 gopkg.in/yaml.v3 v3.0.1 // indirect
8386)
go.sum+110−110
@@ -1,5 +1,5 @@
1−cloud.google.com/go/auth v0.23.1 h1:1tPpBPG02lQHmoiAvs9egyCASqXP0xgobptjZzov/Jg=
2−cloud.google.com/go/auth v0.23.1/go.mod h1:4DhBRcqvtljQN3dJ57qtqbib5ZGCYE5f2crfiiC2EM0=
1+cloud.google.com/go/auth v0.17.0 h1:74yCm7hCj2rUyyAocqnFzsAYXgJhrG26XCFimrc/Kz4=
2+cloud.google.com/go/auth v0.17.0/go.mod h1:6wv/t5/6rOPAX4fJiRjKkJCvswLwdet7G8+UGXt7nCQ=
33cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIiLpZnkHRbnc=
44cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c=
55cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs=
@@ -8,14 +8,14 @@ github.com/Bose/minisentinel v0.0.0-20200130220412-917c5a9223bb h1:ZVN4Iat3runWO
88github.com/Bose/minisentinel v0.0.0-20200130220412-917c5a9223bb/go.mod h1:WsAABbY4HQBgd3mGuG4KMNTbHJCPvx9IVBHzysbknss=
99github.com/FZambia/sentinel v1.0.0 h1:KJ0ryjKTZk5WMp0dXvSdNqp3lFaW1fNFuEYfrkLOYIc=
1010github.com/FZambia/sentinel v1.0.0/go.mod h1:ytL1Am/RLlAoAXG6Kj5LNuw/TRRQrv2rt2FT26vP5gI=
11−github.com/Masterminds/semver/v3 v3.5.0 h1:kQceYJfbupGfZOKZQg0kou0DgAKhzDg2NZPAwZ/2OOE=
12−github.com/Masterminds/semver/v3 v3.5.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
11+github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
12+github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
1313github.com/a8m/envsubst v1.4.3 h1:kDF7paGK8QACWYaQo6KtyYBozY2jhQrTuNNuUxQkhJY=
1414github.com/a8m/envsubst v1.4.3/go.mod h1:4jjHWQlZoaXPoLQUb7H2qT4iLkZDdmEQiOUogdUmqVU=
1515github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
1616github.com/alicebob/miniredis/v2 v2.11.1/go.mod h1:UA48pmi7aSazcGAvcdKcBB49z521IC9VjTTRz2nIaJE=
17−github.com/alicebob/miniredis/v2 v2.38.0 h1:nZAzCR+Lj+Vxk4ZXzm2NuKq2O33RXj1XxJ2e2uP9jiw=
18−github.com/alicebob/miniredis/v2 v2.38.0/go.mod h1:TcL7YfarKPGDAthEtl5NBeHZfeUQj6OXMm/+iu5cLMM=
17+github.com/alicebob/miniredis/v2 v2.35.0 h1:QwLphYqCEAo1eu1TqPRN2jgVMPBweeQcR21jeqDCONI=
18+github.com/alicebob/miniredis/v2 v2.35.0/go.mod h1:TcL7YfarKPGDAthEtl5NBeHZfeUQj6OXMm/+iu5cLMM=
1919github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
2020github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
2121github.com/bitly/go-simplejson v0.5.1 h1:xgwPbetQScXt1gh9BmoJ6j9JMr3TElvuIyjR8pgdoow=
@@ -24,47 +24,51 @@ github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
2424github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
2525github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
2626github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
27−github.com/bsm/redislock v0.10.0 h1:NAe1OHDnwPmWEzD+LpWBZXAdZrWld/xj/wmqEcQednQ=
28−github.com/bsm/redislock v0.10.0/go.mod h1:M05WZGjPbX/8ne7LmB7AbOsa2kv7Jzx4fqkLpDFZvJs=
27+github.com/bsm/redislock v0.9.4 h1:X/Wse1DPpiQgHbVYRE9zv6m070UcKoOGekgvpNhiSvw=
28+github.com/bsm/redislock v0.9.4/go.mod h1:Epf7AJLiSFwLCiZcfi6pWFO/8eAYrYpQXFxEDPoDeAk=
2929github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
3030github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
3131github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
3232github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
3333github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
34−github.com/coreos/go-oidc/v3 v3.20.0 h1:EtE0WIBHk03N+DqGkY4+UONzzZHk7amKt6IyNd7OsZE=
35−github.com/coreos/go-oidc/v3 v3.20.0/go.mod h1:DYCf24+ncYi+XkIH97GY1+dqoRlbaSI26KVTCI9SrY4=
34+github.com/coreos/go-oidc/v3 v3.16.0 h1:qRQUCFstKpXwmEjDQTIbyY/5jF00+asXzSkmkoa/mow=
35+github.com/coreos/go-oidc/v3 v3.16.0/go.mod h1:wqPbKFrVnE90vty060SB40FCJ8fTHTxSwyXJqZH+sI8=
3636github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf h1:iW4rZ826su+pqaw19uhpSCzhj44qo35pNgKFGqzDKkU=
3737github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
3838github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
39−github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeORc=
40−github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE=
39+github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
40+github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
41+github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
42+github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
43+github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
44+github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
4145github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
4246github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
43−github.com/fsnotify/fsnotify v1.10.1 h1:b0/UzAf9yR5rhf3RPm9gf3ehBPpf0oZKIjtpKrx59Ho=
44−github.com/fsnotify/fsnotify v1.10.1/go.mod h1:TLheqan6HD6GBK6PrDWyDPBaEV8LspOxvPSjC+bVfgo=
47+github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
48+github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
4549github.com/gkampitakis/ciinfo v0.3.2 h1:JcuOPk8ZU7nZQjdUhctuhQofk7BGHuIy0c9Ez8BNhXs=
4650github.com/gkampitakis/ciinfo v0.3.2/go.mod h1:1NIwaOcFChN4fa/B0hEBdAb6npDlFL8Bwx4dfRLRqAo=
4751github.com/gkampitakis/go-diff v1.3.2 h1:Qyn0J9XJSDTgnsgHRdz9Zp24RaJeKMUHg2+PDZZdC4M=
4852github.com/gkampitakis/go-diff v1.3.2/go.mod h1:LLgOrpqleQe26cte8s36HTWcTmMEur6OPYerdAAS9tk=
4953github.com/gkampitakis/go-snaps v0.5.15 h1:amyJrvM1D33cPHwVrjo9jQxX8g/7E2wYdZ+01KS3zGE=
5054github.com/gkampitakis/go-snaps v0.5.15/go.mod h1:HNpx/9GoKisdhw9AFOBT1N7DBs9DiHo/hGheFGBZ+mc=
51−github.com/go-jose/go-jose/v3 v3.0.5 h1:BLLJWbC4nMZOfuPVxoZIxeYsn6Nl2r1fITaJ78UQlVQ=
52−github.com/go-jose/go-jose/v3 v3.0.5/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ=
53−github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA=
54−github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
55+github.com/go-jose/go-jose/v3 v3.0.4 h1:Wp5HA7bLQcKnf6YYao/4kpRpVMp/yf6+pJKV8WFSaNY=
56+github.com/go-jose/go-jose/v3 v3.0.4/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ=
57+github.com/go-jose/go-jose/v4 v4.1.3 h1:CVLmWDhDVRa6Mi/IgCgaopNosCaHz7zrMeF9MlZRkrs=
58+github.com/go-jose/go-jose/v4 v4.1.3/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
5559github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
56−github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8=
57−github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
60+github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
61+github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
5862github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
5963github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
6064github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
6165github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
62−github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro=
63−github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
66+github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs=
67+github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
6468github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw=
6569github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
66−github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY=
67−github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE=
70+github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo=
71+github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE=
6872github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
6973github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
7074github.com/gomodule/redigo v1.7.1-0.20190322064113-39e2c31b7ca3 h1:6amM4HsNPOvMLVc2ZnyqrjeQ92YAVWn7T4WBKK87inY=
@@ -72,27 +76,25 @@ github.com/gomodule/redigo v1.7.1-0.20190322064113-39e2c31b7ca3/go.mod h1:B4C85q
7276github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
7377github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
7478github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
75−github.com/google/pprof v0.0.0-20260802141513-ef3492d7dac3 h1:LMLX+LgTNWpfvCBdFebv6EsYotImrt/Ppc5cXIriCSo=
76−github.com/google/pprof v0.0.0-20260802141513-ef3492d7dac3/go.mod h1:jl5iWTm0/hd5PjEYEOuwAJ57L/CibdZfrqZ5XA5GrCk=
79+github.com/google/pprof v0.0.0-20251007162407-5df77e3f7d1d h1:KJIErDwbSHjnp/SGzE5ed8Aol7JsKiI5X7yWKAtzhM0=
80+github.com/google/pprof v0.0.0-20251007162407-5df77e3f7d1d/go.mod h1:I6V7YzU0XDpsHqbsyrghnFZLO1gwK6NPTNvmetQIk9U=
7781github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0=
7882github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM=
7983github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
8084github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
8185github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
82−github.com/googleapis/enterprise-certificate-proxy v0.3.21 h1:OFdQ3tnCX/zaQ0Cedur3D3z7kI6HiLX9g3TiAN4/DFU=
83−github.com/googleapis/enterprise-certificate-proxy v0.3.21/go.mod h1:L3D/IQExI6LqEjBdXcZQ1WluSgigQmSwBboFstVPM4w=
84−github.com/googleapis/gax-go/v2 v2.23.0 h1:Tchl7qkvE7Ip3y+ztvNufYFvkfqTe7NfLTYGIdJRLuE=
85−github.com/googleapis/gax-go/v2 v2.23.0/go.mod h1:rBQKOVJCdb8IFEzg+FCwlt1LP/xMDGuqUXhUG+XMXEg=
86+github.com/googleapis/enterprise-certificate-proxy v0.3.6 h1:GW/XbdyBFQ8Qe+YAmFU9uHLo7OnF5tL52HFAgMmyrf4=
87+github.com/googleapis/enterprise-certificate-proxy v0.3.6/go.mod h1:MkHOF77EYAE7qfSuSS9PU6g4Nt4e11cnsDUowfwewLA=
88+github.com/googleapis/gax-go/v2 v2.15.0 h1:SyjDc1mGgZU5LncH8gimWo9lW1DtIfPibOG81vgd/bo=
89+github.com/googleapis/gax-go/v2 v2.15.0/go.mod h1:zVVkkxAQHa1RQpg9z2AUCMnKhi0Qld9rcmyfL1OZhoc=
8690github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
8791github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
8892github.com/joshdk/go-junit v1.0.0 h1:S86cUKIdwBHWwA6xCmFlf3RTLfVXYQfvanM5Uh+K6GE=
8993github.com/joshdk/go-junit v1.0.0/go.mod h1:TiiV0PqkaNfFXjEiyjWM3XXrhVyCa1K4Zfga6W52ung=
9094github.com/justinas/alice v1.2.0 h1:+MHSA/vccVCF4Uq37S42jwlkvI2Xzl7zTPCN5BnZNVo=
9195github.com/justinas/alice v1.2.0/go.mod h1:fN5HRH/reO/zrUflLfTN43t3vXvKzvZIENsNEe7i7qA=
92−github.com/klauspost/compress v1.19.1 h1:VsB4HPswih7mmZ8WleSFQ75c/Ui1M4trX5oAsJnhSlk=
93−github.com/klauspost/compress v1.19.1/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ=
94−github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
95−github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
96+github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
97+github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
9698github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
9799github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
98100github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
@@ -109,25 +111,27 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq
109111github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
110112github.com/oauth2-proxy/mockoidc v0.0.0-20240214162133-caebfff84d25 h1:9bCMuD3TcnjeqjPT2gSlha4asp8NvgcFRYExCaikCxk=
111113github.com/oauth2-proxy/mockoidc v0.0.0-20240214162133-caebfff84d25/go.mod h1:eDjgYHYDJbPLBLsyZ6qRaugP0mX8vePOhZ5id1fdzJw=
112−github.com/onsi/ginkgo/v2 v2.32.1 h1:6tlvcDm/3sE8lGJbZ4+d4mO3RLy24/tQWOFzVSQNIfw=
113−github.com/onsi/ginkgo/v2 v2.32.1/go.mod h1:+aXOY+vzZ5mu2iI2HpTZUPmM//oQfsNFX6gU9kNcA44=
114−github.com/onsi/gomega v1.42.1 h1:iN1rCUX+44NZ1Dc97MPoeFYbFR0vh8zxoxMFwKdyZ6I=
115−github.com/onsi/gomega v1.42.1/go.mod h1:REff/hsDsodHoKlWsP2mAPhu1+5/6hVYNf9rIEBpeSg=
116−github.com/pelletier/go-toml/v2 v2.4.3 h1:GTRvJQutkOSftxIFD5xw9aepkYNuPWmVJpffdDPYVpY=
117−github.com/pelletier/go-toml/v2 v2.4.3/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
118−github.com/pierrec/lz4/v4 v4.1.28 h1:pPEPwRJ4kybBTfGt28q7lQsRJQHhC08axprdLD5Ppio=
119−github.com/pierrec/lz4/v4 v4.1.28/go.mod h1:EoQMVJgeeEOMsCqCzqFm2O0cJvljX2nGZjcRIPL34O4=
114+github.com/onsi/ginkgo/v2 v2.27.2 h1:LzwLj0b89qtIy6SSASkzlNvX6WktqurSHwkk2ipF/Ns=
115+github.com/onsi/ginkgo/v2 v2.27.2/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo=
116+github.com/onsi/gomega v1.38.2 h1:eZCjf2xjZAqe+LeWvKb5weQ+NcPwX84kqJ0cZNxok2A=
117+github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k=
118+github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
119+github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
120+github.com/pierrec/lz4/v4 v4.1.22 h1:cKFw6uJDK+/gfw5BcDL0JL5aBsAFdsIT18eRtLj7VIU=
121+github.com/pierrec/lz4/v4 v4.1.22/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
120122github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
121−github.com/prometheus/client_golang v1.24.1 h1:JnJkREXzWxUdCuPFpIWZiPispT9xVV59uiuyR2bPlnU=
122−github.com/prometheus/client_golang v1.24.1/go.mod h1:F+oSRECHg4sse5ucfYpYDeIv/hu68Zo0uoHKetWnzcE=
123+github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
124+github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
125+github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o=
126+github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg=
123127github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=
124128github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
125−github.com/prometheus/common v0.70.1 h1:1HvjP4D5oL3t8RsPlwxA9onvvStjtIHYE5XuuwOi/PY=
126−github.com/prometheus/common v0.70.1/go.mod h1:VdFUQDMZK3VLkurFUVhia6uys/0suUp86TJz5qbJRhc=
127−github.com/prometheus/procfs v0.21.1 h1:GljZCt+zSTS+NZq88cyQ1LjZ+RCHp3uVuabBWA5+OJI=
128−github.com/prometheus/procfs v0.21.1/go.mod h1:aB55Cww9pdSJVHk0hUf0inxWyyjPogFIjmHKYgMKmtY=
129−github.com/redis/go-redis/v9 v9.22.0 h1:laDvpYXTJtZLloinw1fA5Kqd6HAEH2XKxOkG/PDq2F0=
130−github.com/redis/go-redis/v9 v9.22.0/go.mod h1:y2g0Wj8rQvuK0ELM+oxSudcLtC09JScs98I/X9gRWY4=
129+github.com/prometheus/common v0.67.2 h1:PcBAckGFTIHt2+L3I33uNRTlKTplNzFctXcWhPyAEN8=
130+github.com/prometheus/common v0.67.2/go.mod h1:63W3KZb1JOKgcjlIr64WW/LvFGAqKPj0atm+knVGEko=
131+github.com/prometheus/procfs v0.19.1 h1:QVtROpTkphuXuNlnCv3m1ut3JytkXHtQ3xvck/YmzMM=
132+github.com/prometheus/procfs v0.19.1/go.mod h1:M0aotyiemPhBCM0z5w87kL22CxfcH05ZpYlu+b4J7mw=
133+github.com/redis/go-redis/v9 v9.16.0 h1:OotgqgLSRCmzfqChbQyG1PHC3tLNR89DG4jdOERSEP4=
134+github.com/redis/go-redis/v9 v9.16.0/go.mod h1:u410H11HMLoB+TP67dz8rL9s6QW2j76l0//kSOd3370=
131135github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
132136github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
133137github.com/sagikazarmark/locafero v0.12.0 h1:/NQhBAkUb4+fH1jivKHWusDYFjMOOKU88eegjfxfHb4=
@@ -142,8 +146,8 @@ github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU=
142146github.com/spf13/viper v1.21.0/go.mod h1:P0lhsswPGWD/1lZJ9ny3fYnVqxiegrlNrEmgLjbTCAY=
143147github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
144148github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
145−github.com/stretchr/testify v1.12.0 h1:K6Mr6jO9JICuend/5xzTM03ydSV3vdNRYAdPSukj8uI=
146−github.com/stretchr/testify v1.12.0/go.mod h1:bOYBZb5qJ00vPzWfIqBUZPaxK8jWiXc6d3ErP4Ca9Gw=
149+github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
150+github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
147151github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
148152github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
149153github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
@@ -161,57 +165,53 @@ github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV
161165github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
162166github.com/yuin/gopher-lua v0.0.0-20190206043414-8bfc7677f583/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ=
163167github.com/yuin/gopher-lua v0.0.0-20191213034115-f46add6fdb5c/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ=
164−github.com/yuin/gopher-lua v1.1.2 h1:yF/FjE3hD65tBbt0VXLE13HWS9h34fdzJmrWRXwobGA=
165−github.com/yuin/gopher-lua v1.1.2/go.mod h1:7aRmXIWl37SqRf0koeyylBEzJ+aPt8A+mmkQ4f1ntR8=
166−github.com/zeebo/xxh3 v1.1.0 h1:s7DLGDK45Dyfg7++yxI0khrfwq9661w9EN78eP/UZVs=
167−github.com/zeebo/xxh3 v1.1.0/go.mod h1:IisAie1LELR4xhVinxWS5+zf1lA4p0MW4T+w+W07F5s=
168+github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M=
169+github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw=
168170go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
169171go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
170−go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0 h1:yI1/OhfEPy7J9eoa6Sj051C7n5dvpj0QX8g4sRchg04=
171−go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0/go.mod h1:NoUCKYWK+3ecatC4HjkRktREheMeEtrXoQxrqYFeHSc=
172−go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.70.0 h1:LMuyCAyfalSjDyjdC65nK6N0zoTT63+E/u95X0JovZI=
173−go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.70.0/go.mod h1:085m8qbm4hgc8rZWGDEa4vmyyo2c3nPxUslYUKUIU04=
174−go.opentelemetry.io/otel v1.45.0 h1:pdrWmLHofpubmArBv1LgFSv1Z0Ie/ppdZzu+kUN5EeU=
175−go.opentelemetry.io/otel v1.45.0/go.mod h1:XZxIqPapzEYnhNSScF5DIqXhm/rYi0FzCe2XddAwZfQ=
176−go.opentelemetry.io/otel/metric v1.45.0 h1:7Eg1uH7CJ5cXv9is6tnBe1FI6rj1nwUdbFypRm3br/M=
177−go.opentelemetry.io/otel/metric v1.45.0/go.mod h1:HAPbm1nd3p1PmFH7v2dR+6BjXxw+Lq4a2+pndMAm08s=
178−go.opentelemetry.io/otel/sdk v1.45.0 h1:4VVSMgQ83dUgW2aoX5f6JgLvHwIvzcuLnF9lUdCSpCw=
179−go.opentelemetry.io/otel/sdk v1.45.0/go.mod h1:Sr40LgXV7DsKMMJMKOhUWOgMWTfAaqvm2kF0g7ilwuA=
180−go.opentelemetry.io/otel/sdk/metric v1.45.0 h1:oVFszMfyj1Am6s24Vtc7wBb8BKLcwepJjNEYILuiE3o=
181−go.opentelemetry.io/otel/sdk/metric v1.45.0/go.mod h1:vUWUxDZvu1WVRj8JA8S0AdhsPrZoDpA2DdZauIh4mDA=
182−go.opentelemetry.io/otel/trace v1.45.0 h1:l/mP6Uv7oNO7/TblbhpbgMidxhq1uO/rPsikOyVhxag=
183−go.opentelemetry.io/otel/trace v1.45.0/go.mod h1:qoJJA2xNMnxRrdISU/kLtfUH2wNeQbiv+jhs/CxI8bc=
184−go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
185−go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
172+go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 h1:q4XOmH/0opmeuJtPsbFNivyl7bCt7yRBbeEm2sC/XtQ=
173+go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0/go.mod h1:snMWehoOh2wsEwnvvwtDyFCxVeDAODenXHtn5vzrKjo=
174+go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 h1:RbKq8BG0FI8OiXhBfcRtqqHcZcka+gU3cskNuf05R18=
175+go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0/go.mod h1:h06DGIukJOevXaj/xrNjhi/2098RZzcLTbc0jDAUbsg=
176+go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8=
177+go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM=
178+go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA=
179+go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI=
180+go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E=
181+go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg=
182+go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM=
183+go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA=
184+go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE=
185+go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs=
186186go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
187187go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
188−go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ=
189−go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ=
190−go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw=
191−go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg=
188+go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0=
189+go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8=
190+go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
191+go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
192192golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
193193golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
194194golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
195−golang.org/x/crypto v0.55.0 h1:+KWHjbgOaAQ66dh/YlkZKHlz9ZUlq61AFirAR9ntP8M=
196−golang.org/x/crypto v0.55.0/go.mod h1:uq0V9dE/fzQuJtbnL+2EhWOE63vo164FY8xqEnV9xis=
195+golang.org/x/crypto v0.43.0 h1:dduJYIi3A3KOfdGOHX8AVZ/jGiyPa3IbBozJ5kNuE04=
196+golang.org/x/crypto v0.43.0/go.mod h1:BFbav4mRNlXJL4wNeejLpWxB7wMbc79PdRGhWKncxR0=
197197golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
198198golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
199−golang.org/x/mod v0.40.0 h1:hUv+3cXcdRHz08UmSiOob7sadHig73uo5bkXxQ/tvUs=
200−golang.org/x/mod v0.40.0/go.mod h1:0/weTWkPWGBikyTWAX3dkjVztMmBA5hM0DH6BElSupE=
199+golang.org/x/mod v0.29.0 h1:HV8lRxZC4l2cr3Zq1LvtOsi/ThTgWnUk/y64QSs8GwA=
200+golang.org/x/mod v0.29.0/go.mod h1:NyhrlYXJ2H4eJiRy/WDBO6HMqZQ6q9nk4JzS3NuCK+w=
201201golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
202202golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
203203golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
204204golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
205205golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
206−golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To=
207−golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU=
208−golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs=
209−golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q=
206+golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4=
207+golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210=
208+golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY=
209+golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
210210golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
211211golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
212212golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
213−golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek=
214−golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
213+golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
214+golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
215215golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
216216golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
217217golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -221,8 +221,8 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
221221golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
222222golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
223223golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
224−golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=
225−golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
224+golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
225+golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
226226golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
227227golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
228228golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
@@ -234,31 +234,31 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
234234golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
235235golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
236236golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
237−golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8=
238−golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M=
239−golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U=
240−golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno=
237+golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k=
238+golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM=
239+golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI=
240+golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
241241golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
242242golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
243243golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
244244golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
245−golang.org/x/tools v0.49.0 h1:3NI7VXzL9+1WZD52Dx2ttoPwD5DWrFGpl9mFZDlmisI=
246−golang.org/x/tools v0.49.0/go.mod h1:SJNXV9DBKT0UbdttsQjbfJlAE/q+y36++zo3uL3N0Oo=
245+golang.org/x/tools v0.38.0 h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ=
246+golang.org/x/tools v0.38.0/go.mod h1:yEsQ/d/YK8cjh0L6rZlY8tgtlKiBNTL14pGDJPJpYQs=
247247golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
248−gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
249−gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
250−google.golang.org/api v0.293.0 h1:p9XIWOf63U4OgYx120ZwVU8+vl4XTPmWfgVPnmOAS9w=
251−google.golang.org/api v0.293.0/go.mod h1:6n5tjEB1gzwniZTepZ0g5u+wM7Bof5GeULCx/zh8ZE0=
252−google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7 h1:XzmzkmB14QhVhgnawEVsOn6OFsnpyxNPRY9QV01dNB0=
253−google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7/go.mod h1:L43LFes82YgSonw6iTXTxXUX1OlULt4AQtkik4ULL/I=
254−google.golang.org/genproto/googleapis/api v0.0.0-20260630182238-925bb5da69e7 h1:jQ9p21COKWjP3VwuFrNRiiOTMh3mPpN45R7SLrH/HUU=
255−google.golang.org/genproto/googleapis/api v0.0.0-20260630182238-925bb5da69e7/go.mod h1:KqHwBx2upmfa1XSi1WuRvC+2VGCLtooKkfmyvRbUmqA=
256−google.golang.org/genproto/googleapis/rpc v0.0.0-20260817212433-ac3dfec99bb1 h1:utmqiUzZAEINbLmRyAt1QjVkMyLQ+lvIwCpLaB1rZfw=
257−google.golang.org/genproto/googleapis/rpc v0.0.0-20260817212433-ac3dfec99bb1/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
258−google.golang.org/grpc v1.83.0 h1:JeNZEKJFbQxArAMl+hiytHauacDNqJUllNfmIMmpqnQ=
259−google.golang.org/grpc v1.83.0/go.mod h1:kDyl6SKsiHKt0uylY5gtn5cEjkrIOhQOGDgIc4JGwzQ=
260−google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc=
261−google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
248+gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
249+gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
250+google.golang.org/api v0.254.0 h1:jl3XrGj7lRjnlUvZAbAdhINTLbsg5dbjmR90+pTQvt4=
251+google.golang.org/api v0.254.0/go.mod h1:5BkSURm3D9kAqjGvBNgf0EcbX6Rnrf6UArKkwBzAyqQ=
252+google.golang.org/genproto v0.0.0-20250603155806-513f23925822 h1:rHWScKit0gvAPuOnu87KpaYtjK5zBMLcULh7gxkCXu4=
253+google.golang.org/genproto v0.0.0-20250603155806-513f23925822/go.mod h1:HubltRL7rMh0LfnQPkMH4NPDFEWp0jw3vixw7jEM53s=
254+google.golang.org/genproto/googleapis/api v0.0.0-20250804133106-a7a43d27e69b h1:ULiyYQ0FdsJhwwZUwbaXpZF5yUE3h+RA+gxvBu37ucc=
255+google.golang.org/genproto/googleapis/api v0.0.0-20250804133106-a7a43d27e69b/go.mod h1:oDOGiMSXHL4sDTJvFvIB9nRQCGdLP1o/iVaqQK8zB+M=
256+google.golang.org/genproto/googleapis/rpc v0.0.0-20251029180050-ab9386a59fda h1:i/Q+bfisr7gq6feoJnS/DlpdwEL4ihp41fvRiM3Ork0=
257+google.golang.org/genproto/googleapis/rpc v0.0.0-20251029180050-ab9386a59fda/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk=
258+google.golang.org/grpc v1.76.0 h1:UnVkv1+uMLYXoIz6o7chp59WfQUYA2ex/BXQ9rHZu7A=
259+google.golang.org/grpc v1.76.0/go.mod h1:Ju12QI8M6iQJtbcsV+awF5a4hfJMLi4X0JLo94ULZ6c=
260+google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE=
261+google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
262262gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
263263gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
264264gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
@@ -267,5 +267,5 @@ gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYs
267267gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
268268gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
269269gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
270−k8s.io/apimachinery v0.36.3 h1:PkzMRBRG8joFD8EhCuQAtNPvJlxb82FwplP26HIzvAM=
271−k8s.io/apimachinery v0.36.3/go.mod h1:cTSjBWgPe/6CQyBKzY/hDIRWCQQQeK0mfLbml0UYFHE=
270+k8s.io/apimachinery v0.34.1 h1:dTlxFls/eikpJxmAC7MVE8oOeP1zryV7iRyIjB0gky4=
271+k8s.io/apimachinery v0.34.1/go.mod h1:/GwIlEcWuTX9zKIg2mbw0LRFIsXwrfoVxn+ef0X13lw=
main.go−14
@@ -26,7 +26,6 @@ func main() {
2626 alphaConfig := configFlagSet.String("alpha-config", "", "path to alpha config file (use at your own risk - the structure in this config file may change between minor releases)")
2727 convertConfig := configFlagSet.Bool("convert-config-to-alpha", false, "if true, the proxy will load configuration as normal and convert existing configuration to the alpha config structure, and print it to stdout")
2828 showVersion := configFlagSet.Bool("version", false, "print version string")
29− configTest := configFlagSet.Bool("config-test", false, "test the configuration and exit")
3029 configFlagSet.Parse(os.Args[1:])
3130
3231 if *showVersion {
@@ -38,24 +37,11 @@ func main() {
3837 logger.Fatal("cannot use alpha-config and convert-config-to-alpha together")
3938 }
4039
41− if *configTest && *convertConfig {
42− logger.Fatal("cannot use config-test and convert-config-to-alpha together")
43− }
44−
4540 opts, err := loadConfiguration(*config, *alphaConfig, configFlagSet, os.Args[1:])
4641 if err != nil {
4742 logger.Fatalf("ERROR: %v", err)
4843 }
4944
50− if *configTest {
51− if err = validation.Validate(opts); err != nil {
52− logger.Errorf("%s", err)
53− os.Exit(1)
54− }
55− fmt.Println("configuration is valid")
56− return
57− }
58−
5945 if *convertConfig {
6046 if err := printConvertedConfig(opts); err != nil {
6147 logger.Fatalf("ERROR: could not convert config: %v", err)
main_test.go+20−97
@@ -7,7 +7,6 @@ import (
77 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/options"
88 . "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/options/testutil"
99 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/util/ptr"
10− "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/validation"
1110 . "github.com/onsi/ginkgo/v2"
1211 . "github.com/onsi/gomega"
1312 "github.com/onsi/gomega/format"
@@ -124,26 +123,26 @@ redirect_url="http://localhost:4180/oauth2/callback"
124123 opts.RawRedirectURL = "http://localhost:4180/oauth2/callback"
125124
126125 opts.UpstreamServers = options.UpstreamConfig{
127− ProxyRawPath: ptr.To(false),
126+ ProxyRawPath: ptr.Ptr(false),
128127 Upstreams: []options.Upstream{
129128 {
130129 ID: "/",
131130 Path: "/",
132131 URI: "http://httpbin",
133− FlushInterval: ptr.To(options.DefaultUpstreamFlushInterval),
134− PassHostHeader: ptr.To(true),
135− ProxyWebSockets: ptr.To(true),
136− Timeout: ptr.To(options.DefaultUpstreamTimeout),
137− Static: ptr.To(false),
138− InsecureSkipTLSVerify: ptr.To(false),
139− DisableKeepAlives: ptr.To(false),
132+ FlushInterval: ptr.Ptr(options.DefaultUpstreamFlushInterval),
133+ PassHostHeader: ptr.Ptr(true),
134+ ProxyWebSockets: ptr.Ptr(true),
135+ Timeout: ptr.Ptr(options.DefaultUpstreamTimeout),
136+ Static: ptr.Ptr(false),
137+ InsecureSkipTLSVerify: ptr.Ptr(false),
138+ DisableKeepAlives: ptr.Ptr(false),
140139 },
141140 },
142141 }
143142
144143 authHeader := options.Header{
145144 Name: "Authorization",
146− PreserveRequestValue: ptr.To(false),
145+ PreserveRequestValue: ptr.Ptr(false),
147146 Values: []options.HeaderValue{
148147 {
149148 ClaimSource: &options.ClaimSource{
@@ -166,13 +165,12 @@ redirect_url="http://localhost:4180/oauth2/callback"
166165 Type: "google",
167166 ClientSecret: "b2F1dGgyLXByb3h5LWNsaWVudC1zZWNyZXQK",
168167 ClientID: "oauth2-proxy",
169− UseSystemTrustStore: ptr.To(false),
170− SkipClaimsFromProfileURL: ptr.To(false),
168+ UseSystemTrustStore: ptr.Ptr(false),
169+ SkipClaimsFromProfileURL: ptr.Ptr(false),
171170 GoogleConfig: options.GoogleOptions{
172171 AdminEmail: "admin@example.com",
172+ UseApplicationDefaultCredentials: ptr.Ptr(false),
173173 TargetPrincipal: "principal",
174− UseOrganizationID: ptr.To(false),
175− UseApplicationDefaultCredentials: ptr.To(false),
176174 },
177175 AzureConfig: options.AzureOptions{
178176 Tenant: "common",
@@ -183,17 +181,16 @@ redirect_url="http://localhost:4180/oauth2/callback"
183181 UserIDClaim: "email",
184182 AudienceClaims: []string{"aud"},
185183 ExtraAudiences: []string{},
186− InsecureSkipNonce: ptr.To(true),
187− InsecureAllowUnverifiedEmail: ptr.To(false),
188− InsecureSkipIssuerVerification: ptr.To(false),
189− SkipDiscovery: ptr.To(false),
190− EnabledSigningAlgs: []string{},
184+ InsecureSkipNonce: ptr.Ptr(true),
185+ InsecureAllowUnverifiedEmail: ptr.Ptr(false),
186+ InsecureSkipIssuerVerification: ptr.Ptr(false),
187+ SkipDiscovery: ptr.Ptr(false),
191188 },
192189 MicrosoftEntraIDConfig: options.MicrosoftEntraIDOptions{
193− FederatedTokenAuth: ptr.To(false),
190+ FederatedTokenAuth: ptr.Ptr(false),
194191 },
195192 ADFSConfig: options.ADFSOptions{
196− SkipScope: ptr.To(false),
193+ SkipScope: ptr.Ptr(false),
197194 },
198195 LoginURLParameters: []options.LoginURLParameter{
199196 {Name: "approval_prompt", Default: []string{"force"}},
@@ -278,7 +275,7 @@ redirect_url="http://localhost:4180/oauth2/callback"
278275 Entry("with bad legacy configuration", loadConfigurationTableInput{
279276 configContent: testCoreConfig + "unknown_field=\"something\"",
280277 expectedOptions: func() *options.Options { return nil },
281− expectedErr: errors.New("failed to load legacy options: failed to load config: error unmarshalling config: decoding failed due to the following error(s):\n\n'options.LegacyOptions' has invalid keys: unknown_field"),
278+ expectedErr: errors.New("failed to load legacy options: failed to load config: error unmarshalling config: decoding failed due to the following error(s):\n\n'' has invalid keys: unknown_field"),
282279 }),
283280 Entry("with bad alpha configuration", loadConfigurationTableInput{
284281 configContent: testCoreConfig,
@@ -290,81 +287,7 @@ redirect_url="http://localhost:4180/oauth2/callback"
290287 configContent: testCoreConfig + "unknown_field=\"something\"",
291288 alphaConfigContent: testAlphaConfig,
292289 expectedOptions: func() *options.Options { return nil },
293− expectedErr: errors.New("failed to load legacy options: failed to load config: error unmarshalling config: decoding failed due to the following error(s):\n\n'options.LegacyOptions' has invalid keys: unknown_field"),
290+ expectedErr: errors.New("failed to load legacy options: failed to load config: error unmarshalling config: decoding failed due to the following error(s):\n\n'' has invalid keys: unknown_field"),
294291 }),
295292 )
296−
297− Describe("Config Test Mode", func() {
298− const validConfig = `
299−http_address="127.0.0.1:4180"
300−upstreams="http://httpbin"
301−client_id="oauth2-proxy"
302−client_secret="b2F1dGgyLXByb3h5LWNsaWVudC1zZWNyZXQK"
303−cookie_secret="OQINaROshtE9TcZkNAm-5Zs2Pv3xaWytBmc5W7sPX7w="
304−email_domains="example.com"
305−cookie_secure="false"
306−redirect_url="http://localhost:4180/oauth2/callback"
307−`
308−
309− const invalidConfig = `
310−http_address="127.0.0.1:4180"
311−upstreams="http://httpbin"
312−email_domains="example.com"
313−cookie_secure="false"
314−redirect_url="http://localhost:4180/oauth2/callback"
315−`
316−
317− writeTempConfig := func(content string) string {
318− file, err := os.CreateTemp("", "oauth2-proxy-test-config-XXXX.cfg")
319− Expect(err).ToNot(HaveOccurred())
320− defer file.Close()
321−
322− _, err = file.WriteString(content)
323− Expect(err).ToNot(HaveOccurred())
324− return file.Name()
325− }
326−
327− It("should pass validation with a valid configuration", func() {
328− configFile := writeTempConfig(validConfig)
329− defer os.Remove(configFile)
330−
331− flagSet := pflag.NewFlagSet("test", pflag.ContinueOnError)
332− opts, err := loadConfiguration(configFile, "", flagSet, []string{})
333− Expect(err).ToNot(HaveOccurred())
334−
335− err = validation.Validate(opts)
336− Expect(err).ToNot(HaveOccurred())
337− })
338−
339− It("should fail validation with an invalid configuration (missing required fields)", func() {
340− configFile := writeTempConfig(invalidConfig)
341− defer os.Remove(configFile)
342−
343− flagSet := pflag.NewFlagSet("test", pflag.ContinueOnError)
344− opts, err := loadConfiguration(configFile, "", flagSet, []string{})
345− Expect(err).ToNot(HaveOccurred())
346−
347− err = validation.Validate(opts)
348− Expect(err).To(HaveOccurred())
349− Expect(err.Error()).To(ContainSubstring("invalid configuration"))
350− })
351−
352− It("should fail to load a configuration file with syntax errors", func() {
353− configFile := writeTempConfig("this is not valid toml ===")
354− defer os.Remove(configFile)
355−
356− flagSet := pflag.NewFlagSet("test", pflag.ContinueOnError)
357− _, err := loadConfiguration(configFile, "", flagSet, []string{})
358− Expect(err).To(HaveOccurred())
359− })
360−
361− It("should register the config-test flag", func() {
362− flagSet := pflag.NewFlagSet("test", pflag.ContinueOnError)
363− flagSet.ParseErrorsAllowlist.UnknownFlags = true
364− configTest := flagSet.Bool("config-test", false, "test the configuration and exit")
365− err := flagSet.Parse([]string{"--config-test"})
366− Expect(err).ToNot(HaveOccurred())
367− Expect(*configTest).To(BeTrue())
368− })
369− })
370293})
oauthproxy.go+31−61
@@ -28,7 +28,7 @@ import (
2828 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/authentication/basic"
2929 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/cookies"
3030 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/encryption"
31− "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/proxyhttp"
31+ proxyhttp "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/http"
3232 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/util"
3333 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/version"
3434
@@ -54,13 +54,9 @@ const (
5454 authOnlyPath = "/auth"
5555 userInfoPath = "/userinfo"
5656 staticPathPrefix = "/static/"
57−
58− idTokenPlaceholder = "{id_token}"
5957)
6058
6159var (
62− defaultTrustedProxyIPs = []string{"0.0.0.0/0", "::/0"}
63−
6460 // ErrNeedsLogin means the user should be redirected to the login page
6561 ErrNeedsLogin = errors.New("redirect to login page")
6662
@@ -185,14 +181,13 @@ func NewOAuthProxy(opts *options.Options, validator func(string) bool) (*OAuthPr
185181
186182 logger.Printf("Cookie settings: name:%s secure(https):%v httponly:%v expiry:%s domains:%s path:%s samesite:%s refresh:%s", opts.Cookie.Name, opts.Cookie.Secure, opts.Cookie.HTTPOnly, opts.Cookie.Expire, strings.Join(opts.Cookie.Domains, ","), opts.Cookie.Path, opts.Cookie.SameSite, refresh)
187183
188− trustedIPs, err := ip.ParseNetSet(opts.TrustedIPs)
189− if err != nil {
190− return nil, err
191− }
192−
193− trustedProxies, err := buildTrustedProxyNetSet(opts)
194− if err != nil {
195− return nil, err
184+ trustedIPs := ip.NewNetSet()
185+ for _, ipStr := range opts.TrustedIPs {
186+ if ipNet := ip.ParseIPNet(ipStr); ipNet != nil {
187+ trustedIPs.AddIPNet(*ipNet)
188+ } else {
189+ return nil, fmt.Errorf("could not parse IP network (%s)", ipStr)
190+ }
196191 }
197192
198193 allowedRoutes, err := buildRoutesAllowlist(opts)
@@ -205,7 +200,7 @@ func NewOAuthProxy(opts *options.Options, validator func(string) bool) (*OAuthPr
205200 return nil, err
206201 }
207202
208− preAuthChain, err := buildPreAuthChain(opts, sessionStore, trustedProxies)
203+ preAuthChain, err := buildPreAuthChain(opts, sessionStore)
209204 if err != nil {
210205 return nil, fmt.Errorf("could not build pre-auth chain: %v", err)
211206 }
@@ -358,8 +353,8 @@ func (p *OAuthProxy) buildProxySubrouter(s *mux.Router) {
358353// buildPreAuthChain constructs a chain that should process every request before
359354// the OAuth2 Proxy authentication logic kicks in.
360355// For example forcing HTTPS or health checks.
361−func buildPreAuthChain(opts *options.Options, sessionStore sessionsapi.SessionStore, trustedProxies *ip.NetSet) (alice.Chain, error) {
362− chain := alice.New(middleware.NewScope(opts.ReverseProxy, opts.Logging.RequestIDHeader, trustedProxies))
356+func buildPreAuthChain(opts *options.Options, sessionStore sessionsapi.SessionStore) (alice.Chain, error) {
357+ chain := alice.New(middleware.NewScope(opts.ReverseProxy, opts.Logging.RequestIDHeader))
363358
364359 if opts.ForceHTTPS {
365360 _, httpsPort, err := net.SplitHostPort(opts.Server.SecureBindAddress)
@@ -398,24 +393,13 @@ func buildPreAuthChain(opts *options.Options, sessionStore sessionsapi.SessionSt
398393 return chain, nil
399394}
400395
401−func buildTrustedProxyNetSet(opts *options.Options) (*ip.NetSet, error) {
402− trustedProxyIPs := opts.TrustedProxyIPs
403− if opts.ReverseProxy && len(trustedProxyIPs) == 0 {
404− logger.Print("WARNING: --reverse-proxy is enabled but no --trusted-proxy-ip CIDRs were configured. All connecting IPs are trusted to supply X-Forwarded-* headers by default (0.0.0.0/0, ::/0). This preserves backwards compatibility but is a potential security risk; configure --trusted-proxy-ip to match your reverse proxy addresses.")
405− trustedProxyIPs = defaultTrustedProxyIPs
406− }
407−
408− return ip.ParseNetSet(trustedProxyIPs)
409−}
410−
411396func buildSessionChain(opts *options.Options, provider providers.Provider, sessionStore sessionsapi.SessionStore, validator basic.Validator) alice.Chain {
412397 chain := alice.New()
413398
414399 if opts.SkipJwtBearerTokens {
415− verifiers := opts.GetJWTBearerVerifiers()
416−
417− sessionLoaders := make([]middlewareapi.TokenToSessionFunc, 0, len(verifiers)+1)
418− sessionLoaders = append(sessionLoaders, provider.CreateSessionFromToken)
400+ sessionLoaders := []middlewareapi.TokenToSessionFunc{
401+ provider.CreateSessionFromToken,
402+ }
419403
420404 for _, verifier := range opts.GetJWTBearerVerifiers() {
421405 sessionLoaders = append(sessionLoaders,
@@ -587,7 +571,7 @@ func (p *OAuthProxy) ErrorPage(rw http.ResponseWriter, req *http.Request, code i
587571
588572// IsAllowedRequest is used to check if auth should be skipped for this request
589573func (p *OAuthProxy) IsAllowedRequest(req *http.Request) bool {
590− isPreflightRequestAllowed := p.skipAuthPreflight && req.Method == http.MethodOptions
574+ isPreflightRequestAllowed := p.skipAuthPreflight && req.Method == "OPTIONS"
591575 return isPreflightRequestAllowed || p.isAllowedRoute(req) || p.isTrustedIP(req)
592576}
593577
@@ -626,7 +610,9 @@ func (p *OAuthProxy) isAPIPath(req *http.Request) bool {
626610
627611// isTrustedIP is used to check if a request comes from a trusted client IP address.
628612func (p *OAuthProxy) isTrustedIP(req *http.Request) bool {
629− if p.trustedIPs == nil {
613+ // RemoteAddr @ means unix socket
614+ // https://github.com/golang/go/blob/0fa53e41f122b1661d0678a6d36d71b7b5ad031d/src/syscall/syscall_linux.go#L506-L511
615+ if p.trustedIPs == nil && req.RemoteAddr != "@" {
630616 return false
631617 }
632618
@@ -647,10 +633,6 @@ func (p *OAuthProxy) isTrustedIP(req *http.Request) bool {
647633// SignInPage writes the sign in template to the response
648634func (p *OAuthProxy) SignInPage(rw http.ResponseWriter, req *http.Request, code int) {
649635 prepareNoCache(rw)
650−
651− if err := p.ClearSessionCookie(rw, req); err != nil {
652− logger.Printf("Error clearing session cookie: %v", err)
653− }
654636 rw.WriteHeader(code)
655637
656638 redirectURL, err := p.appDirector.GetRedirect(req)
@@ -664,12 +646,16 @@ func (p *OAuthProxy) SignInPage(rw http.ResponseWriter, req *http.Request, code
664646 redirectURL = "/"
665647 }
666648
649+ if err := p.ClearSessionCookie(rw, req); err != nil {
650+ logger.Printf("Error clearing session cookie: %v", err)
651+ }
652+
667653 p.pageWriter.WriteSignInPage(rw, req, redirectURL, code)
668654}
669655
670656// ManualSignIn handles basic auth logins to the proxy
671657func (p *OAuthProxy) ManualSignIn(req *http.Request) (string, bool, int) {
672− if req.Method != http.MethodPost || p.basicAuthValidator == nil {
658+ if req.Method != "POST" || p.basicAuthValidator == nil {
673659 return "", false, http.StatusOK
674660 }
675661 user := req.FormValue("username")
@@ -734,17 +720,15 @@ func (p *OAuthProxy) UserInfo(rw http.ResponseWriter, req *http.Request) {
734720 }
735721
736722 userInfo := struct {
737− User string `json:"user"`
738− Email string `json:"email"`
739− Groups []string `json:"groups,omitempty"`
740− PreferredUsername string `json:"preferredUsername,omitempty"`
741− AdditionalClaims map[string]interface{} `json:"additionalClaims,omitempty"`
723+ User string `json:"user"`
724+ Email string `json:"email"`
725+ Groups []string `json:"groups,omitempty"`
726+ PreferredUsername string `json:"preferredUsername,omitempty"`
742727 }{
743728 User: session.User,
744729 Email: session.Email,
745730 Groups: session.Groups,
746731 PreferredUsername: session.PreferredUsername,
747− AdditionalClaims: session.AdditionalClaims,
748732 }
749733
750734 if err := json.NewEncoder(rw).Encode(userInfo); err != nil {
@@ -761,20 +745,6 @@ func (p *OAuthProxy) SignOut(rw http.ResponseWriter, req *http.Request) {
761745 p.ErrorPage(rw, req, http.StatusInternalServerError, err.Error())
762746 return
763747 }
764−
765− if strings.Contains(redirect, idTokenPlaceholder) {
766− session, err := p.getAuthenticatedSession(rw, req)
767− if err != nil {
768− logger.Errorf("error getting authenticated session during SignOut, won't replace id_token placeholder in redirect URL: %v", err)
769− } else {
770− redirect = strings.ReplaceAll(redirect, idTokenPlaceholder, session.IDToken)
771− }
772− }
773−
774− // Call backend logout before clearing the session so we still have the session
775− // (and id_token) available to invoke the provider's logout endpoint
776− p.backendLogout(rw, req)
777−
778748 err = p.ClearSessionCookie(rw, req)
779749 if err != nil {
780750 logger.Errorf("Error clearing session cookie: %v", err)
@@ -782,6 +752,8 @@ func (p *OAuthProxy) SignOut(rw http.ResponseWriter, req *http.Request) {
782752 return
783753 }
784754
755+ p.backendLogout(rw, req)
756+
785757 http.Redirect(rw, req, redirect, http.StatusFound)
786758}
787759
@@ -801,7 +773,7 @@ func (p *OAuthProxy) backendLogout(rw http.ResponseWriter, req *http.Request) {
801773 return
802774 }
803775
804− backendLogoutURL := strings.ReplaceAll(providerData.BackendLogoutURL, idTokenPlaceholder, session.IDToken)
776+ backendLogoutURL := strings.ReplaceAll(providerData.BackendLogoutURL, "{id_token}", session.IDToken)
805777 // security exception because URL is dynamic ({id_token} replacement) but
806778 // base is not end-user provided but comes from configuration somewhat secure
807779 resp, err := http.Get(backendLogoutURL) // #nosec G107
@@ -811,7 +783,7 @@ func (p *OAuthProxy) backendLogout(rw http.ResponseWriter, req *http.Request) {
811783 }
812784
813785 defer resp.Body.Close()
814− if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusNoContent {
786+ if resp.StatusCode != 200 {
815787 logger.Errorf("error while calling backend logout url, returned error code %v", resp.StatusCode)
816788 }
817789}
@@ -886,8 +858,6 @@ func (p *OAuthProxy) OAuthCallback(rw http.ResponseWriter, req *http.Request) {
886858 remoteAddr := ip.GetClientString(p.realClientIPParser, req, true)
887859
888860 // finish the oauth cycle
889− // #nosec G120 -- The default max size in Go is already capped at 10MB so this would be the absolute max and is
890− // unlikely to be hit in practice.
891861 err := req.ParseForm()
892862 if err != nil {
893863 logger.Errorf("Error while parsing OAuth2 callback: %v", err)
oauthproxy_test.go+65−342
@@ -15,7 +15,6 @@ import (
1515 "time"
1616
1717 "github.com/coreos/go-oidc/v3/oidc"
18− middlewareapi "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/middleware"
1918 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/options"
2019 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/sessions"
2120 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/authentication/hmacauth"
@@ -54,7 +53,7 @@ func TestRobotsTxt(t *testing.T) {
5453 t.Fatal(err)
5554 }
5655 rw := httptest.NewRecorder()
57− req, _ := http.NewRequest(http.MethodGet, "/robots.txt", nil)
56+ req, _ := http.NewRequest("GET", "/robots.txt", nil)
5857 proxy.ServeHTTP(rw, req)
5958 assert.Equal(t, 200, rw.Code)
6059 assert.Equal(t, "User-agent: *\nDisallow: /\n", rw.Body.String())
@@ -241,7 +240,7 @@ func TestBasicAuthPassword(t *testing.T) {
241240
242241 // Save the required session
243242 rw := httptest.NewRecorder()
244− req, _ := http.NewRequest(http.MethodGet, "/", nil)
243+ req, _ := http.NewRequest("GET", "/", nil)
245244 err = proxy.sessionStore.Save(rw, req, &sessions.SessionState{
246245 Email: emailAddress,
247246 })
@@ -250,7 +249,7 @@ func TestBasicAuthPassword(t *testing.T) {
250249 // Extract the cookie value to inject into the test request
251250 cookie := rw.Header().Values("Set-Cookie")[0]
252251
253− req, _ = http.NewRequest(http.MethodGet, "/", nil)
252+ req, _ = http.NewRequest("GET", "/", nil)
254253 req.Header.Set("Cookie", cookie)
255254 rw = httptest.NewRecorder()
256255 proxy.ServeHTTP(rw, req)
@@ -300,14 +299,14 @@ func TestPassGroupsHeadersWithGroups(t *testing.T) {
300299
301300 // Save the required session
302301 rw := httptest.NewRecorder()
303− req, _ := http.NewRequest(http.MethodGet, "/", nil)
302+ req, _ := http.NewRequest("GET", "/", nil)
304303 err = proxy.sessionStore.Save(rw, req, session)
305304 assert.NoError(t, err)
306305
307306 // Extract the cookie value to inject into the test request
308307 cookie := rw.Header().Values("Set-Cookie")[0]
309308
310− req, _ = http.NewRequest(http.MethodGet, "/", nil)
309+ req, _ = http.NewRequest("GET", "/", nil)
311310 req.Header.Set("Cookie", cookie)
312311 rw = httptest.NewRecorder()
313312 proxy.ServeHTTP(rw, req)
@@ -457,7 +456,7 @@ func (patTest *PassAccessTokenTest) getEndpointWithCookie(cookie string, endpoin
457456 return 0, ""
458457 }
459458
460− req, err := http.NewRequest(http.MethodGet, endpoint, strings.NewReader(""))
459+ req, err := http.NewRequest("GET", endpoint, strings.NewReader(""))
461460 if err != nil {
462461 return 0, ""
463462 }
@@ -508,7 +507,7 @@ func TestStaticProxyUpstream(t *testing.T) {
508507 ProxyUpstream: options.Upstream{
509508 ID: "static-proxy",
510509 Path: "/static-proxy",
511− Static: ptr.To(true),
510+ Static: ptr.Ptr(true),
512511 },
513512 })
514513 if err != nil {
@@ -608,7 +607,7 @@ func NewSignInPageTest(skipProvider bool) (*SignInPageTest, error) {
608607
609608func (sipTest *SignInPageTest) GetEndpoint(endpoint string) (int, string) {
610609 rw := httptest.NewRecorder()
611− req, _ := http.NewRequest(http.MethodGet, endpoint, strings.NewReader(""))
610+ req, _ := http.NewRequest("GET", endpoint, strings.NewReader(""))
612611 sipTest.proxy.ServeHTTP(rw, req)
613612 return rw.Code, rw.Body.String()
614613}
@@ -713,50 +712,6 @@ func TestManualSignInCorrectCredentials(t *testing.T) {
713712 assert.Equal(t, http.StatusFound, statusCode)
714713}
715714
716−func TestSignInPageClearsExistingSessionCookie(t *testing.T) {
717− opts := baseTestOptions()
718− err := validation.Validate(opts)
719− require.NoError(t, err)
720−
721− proxy, err := NewOAuthProxy(opts, func(string) bool {
722− return true
723− })
724− require.NoError(t, err)
725−
726− // Create a real session cookie using the actual session store.
727− saveRW := httptest.NewRecorder()
728− saveReq := httptest.NewRequest(http.MethodGet, "/", nil)
729− err = proxy.sessionStore.Save(saveRW, saveReq, &sessions.SessionState{
730− Email: "john.doe@example.com",
731− })
732− require.NoError(t, err)
733−
734− cookies := saveRW.Result().Cookies()
735− require.NotEmpty(t, cookies)
736−
737− // Send that cookie to the sign-in page.
738− req := httptest.NewRequest(http.MethodGet, "/oauth2/sign_in", nil)
739− for _, c := range cookies {
740− req.AddCookie(c)
741− }
742−
743− rw := httptest.NewRecorder()
744− proxy.ServeHTTP(rw, req)
745−
746− assert.Equal(t, http.StatusOK, rw.Code)
747−
748− cleared := false
749− for _, c := range rw.Result().Cookies() {
750− if c.Name == proxy.CookieOptions.Name {
751− cleared = true
752− assert.Equal(t, "", c.Value)
753− assert.Less(t, c.MaxAge, 0)
754− }
755− }
756−
757− assert.True(t, cleared, "expected sign-in page to clear existing session cookie")
758−}
759−
760715func TestSignInPageIncludesTargetRedirect(t *testing.T) {
761716 sipTest, err := NewSignInPageTest(false)
762717 if err != nil {
@@ -894,7 +849,7 @@ func NewProcessCookieTest(opts ProcessCookieTestOpts, modifiers ...OptionsModifi
894849 // access_token validation.
895850 pcTest.proxy.CookieOptions.Refresh = time.Duration(0)
896851 pcTest.rw = httptest.NewRecorder()
897− pcTest.req, _ = http.NewRequest(http.MethodGet, "/", strings.NewReader(""))
852+ pcTest.req, _ = http.NewRequest("GET", "/", strings.NewReader(""))
898853 pcTest.validateUser = true
899854 return &pcTest, nil
900855}
@@ -1027,7 +982,7 @@ func NewUserInfoEndpointTest() (*ProcessCookieTest, error) {
1027982 if err != nil {
1028983 return nil, err
1029984 }
1030− pcTest.req, _ = http.NewRequest(http.MethodGet,
985+ pcTest.req, _ = http.NewRequest("GET",
1031986 pcTest.opts.ProxyPrefix+"/userinfo", nil)
1032987 return pcTest, nil
1033988}
@@ -1077,20 +1032,6 @@ func TestUserInfoEndpointAccepted(t *testing.T) {
10771032 },
10781033 expectedResponse: "{\"user\":\"john.doe\",\"email\":\"john.doe@example.com\",\"groups\":[\"example\",\"groups\"],\"preferredUsername\":\"john\"}\n",
10791034 },
1080− {
1081− name: "With Additional Claim",
1082− session: &sessions.SessionState{
1083− User: "john.doe",
1084− PreferredUsername: "john",
1085− Email: "john.doe@example.com",
1086− Groups: []string{"example", "groups"},
1087− AccessToken: "my_access_token",
1088− AdditionalClaims: map[string]interface{}{
1089− "foo": "bar",
1090− },
1091− },
1092− expectedResponse: "{\"user\":\"john.doe\",\"email\":\"john.doe@example.com\",\"groups\":[\"example\",\"groups\"],\"preferredUsername\":\"john\",\"additionalClaims\":{\"foo\":\"bar\"}}\n",
1093− },
10941035 }
10951036
10961037 for _, tc := range testCases {
@@ -1135,7 +1076,7 @@ func NewAuthOnlyEndpointTest(querystring string, modifiers ...OptionsModifier) (
11351076 return nil, err
11361077 }
11371078 pcTest.req, _ = http.NewRequest(
1138− http.MethodGet,
1079+ "GET",
11391080 fmt.Sprintf("%s/auth%s", pcTest.opts.ProxyPrefix, querystring),
11401081 nil)
11411082 return pcTest, nil
@@ -1274,7 +1215,7 @@ func TestAuthOnlyEndpointSetXAuthRequestHeaders(t *testing.T) {
12741215 pcTest.validateUser = true
12751216
12761217 pcTest.rw = httptest.NewRecorder()
1277− pcTest.req, _ = http.NewRequest(http.MethodGet,
1218+ pcTest.req, _ = http.NewRequest("GET",
12781219 pcTest.opts.ProxyPrefix+authOnlyPath, nil)
12791220
12801221 created := time.Now()
@@ -1367,7 +1308,7 @@ func TestAuthOnlyEndpointSetBasicAuthTrueRequestHeaders(t *testing.T) {
13671308 pcTest.validateUser = true
13681309
13691310 pcTest.rw = httptest.NewRecorder()
1370− pcTest.req, _ = http.NewRequest(http.MethodGet,
1311+ pcTest.req, _ = http.NewRequest("GET",
13711312 pcTest.opts.ProxyPrefix+authOnlyPath, nil)
13721313
13731314 created := time.Now()
@@ -1447,7 +1388,7 @@ func TestAuthOnlyEndpointSetBasicAuthFalseRequestHeaders(t *testing.T) {
14471388 pcTest.validateUser = true
14481389
14491390 pcTest.rw = httptest.NewRecorder()
1450− pcTest.req, _ = http.NewRequest(http.MethodGet,
1391+ pcTest.req, _ = http.NewRequest("GET",
14511392 pcTest.opts.ProxyPrefix+authOnlyPath, nil)
14521393
14531394 created := time.Now()
@@ -1495,7 +1436,7 @@ func TestAuthSkippedForPreflightRequests(t *testing.T) {
14951436 }
14961437 proxy.provider = NewTestProvider(upstreamURL, "")
14971438 rw := httptest.NewRecorder()
1498− req, _ := http.NewRequest(http.MethodOptions, "/preflight-request", nil)
1439+ req, _ := http.NewRequest("OPTIONS", "/preflight-request", nil)
14991440 proxy.ServeHTTP(rw, req)
15001441
15011442 assert.Equal(t, 200, rw.Code)
@@ -1652,19 +1593,19 @@ func TestRequestSignature(t *testing.T) {
16521593 resp string
16531594 }{
16541595 "No request signature": {
1655− method: http.MethodGet,
1596+ method: "GET",
16561597 body: "",
16571598 key: "",
16581599 resp: "no signature received",
16591600 },
16601601 "Get request": {
1661− method: http.MethodGet,
1602+ method: "GET",
16621603 body: "",
16631604 key: "7d9e1aa87a5954e6f9fc59266b3af9d7c35fda2d",
16641605 resp: "signatures match",
16651606 },
16661607 "Post request": {
1667− method: http.MethodPost,
1608+ method: "POST",
16681609 body: `{ "hello": "world!" }`,
16691610 key: "d90df39e2d19282840252612dd7c81421a372f61",
16701611 resp: "signatures match",
@@ -2087,44 +2028,6 @@ func Test_noCacheHeaders(t *testing.T) {
20872028 })
20882029}
20892030
2090−func TestSignOutCallsBackendLogoutURL(t *testing.T) {
2091− const testIDToken = "test-id-token-12345"
2092− var receivedURL string
2093− backendLogoutServer := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
2094− receivedURL = req.URL.String()
2095− rw.WriteHeader(http.StatusOK)
2096− }))
2097− defer backendLogoutServer.Close()
2098−
2099− opts := baseTestOptions()
2100− opts.Providers[0].BackendLogoutURL = backendLogoutServer.URL + "/logout?id_token_hint={id_token}"
2101− err := validation.Validate(opts)
2102− require.NoError(t, err)
2103−
2104− proxy, err := NewOAuthProxy(opts, func(string) bool { return true })
2105− require.NoError(t, err)
2106−
2107− // Save a session with IDToken so backend logout can use it
2108− rw := httptest.NewRecorder()
2109− req := httptest.NewRequest(http.MethodGet, "/", nil)
2110− err = proxy.sessionStore.Save(rw, req, &sessions.SessionState{
2111− Email: "user@example.com",
2112− IDToken: testIDToken,
2113− })
2114− require.NoError(t, err)
2115− cookie := rw.Header().Values("Set-Cookie")[0]
2116−
2117− // Hit sign_out with the session cookie; backend logout should be called before session is cleared
2118− signOutReq := httptest.NewRequest(http.MethodGet, "/oauth2/sign_out", nil)
2119− signOutReq.Header.Set("Cookie", cookie)
2120− rec := httptest.NewRecorder()
2121− proxy.ServeHTTP(rec, signOutReq)
2122−
2123− assert.Equal(t, http.StatusFound, rec.Code, "sign_out should redirect")
2124− assert.Contains(t, receivedURL, "id_token_hint="+testIDToken,
2125− "backend logout URL should have been called with id_token from session")
2126−}
2127−
21282031func baseTestOptions() *options.Options {
21292032 opts := options.NewOptions()
21302033 opts.Cookie.Secret = rawCookieSecret
@@ -2189,33 +2092,7 @@ func TestTrustedIPs(t *testing.T) {
21892092 reverseProxy: false,
21902093 realClientIPHeader: "X-Real-IP", // Default value
21912094 req: func() *http.Request {
2192− req, _ := http.NewRequest(http.MethodGet, "/", nil)
2193− return req
2194− }(),
2195− expectTrusted: false,
2196− },
2197− // Check Unix socket with no trusted IPs configured does not error.
2198− {
2199− name: "UnixSocketWithoutTrustedIPs",
2200− trustedIPs: nil,
2201− reverseProxy: false,
2202− realClientIPHeader: "X-Real-IP",
2203− req: func() *http.Request {
2204− req, _ := http.NewRequest(http.MethodGet, "/", nil)
2205− req.RemoteAddr = "@"
2206− return req
2207− }(),
2208− expectTrusted: false,
2209− },
2210− // Check Unix socket with trusted IPs configured returns false (no IP to match).
2211− {
2212− name: "UnixSocketWithTrustedIPs",
2213− trustedIPs: []string{"127.0.0.1"},
2214− reverseProxy: false,
2215− realClientIPHeader: "X-Real-IP",
2216− req: func() *http.Request {
2217− req, _ := http.NewRequest(http.MethodGet, "/", nil)
2218− req.RemoteAddr = "@"
2095+ req, _ := http.NewRequest("GET", "/", nil)
22192096 return req
22202097 }(),
22212098 expectTrusted: false,
@@ -2227,7 +2104,7 @@ func TestTrustedIPs(t *testing.T) {
22272104 reverseProxy: false,
22282105 realClientIPHeader: "X-Real-IP", // Default value
22292106 req: func() *http.Request {
2230− req, _ := http.NewRequest(http.MethodGet, "/", nil)
2107+ req, _ := http.NewRequest("GET", "/", nil)
22312108 req.RemoteAddr = "127.0.0.1:43670"
22322109 return req
22332110 }(),
@@ -2240,7 +2117,7 @@ func TestTrustedIPs(t *testing.T) {
22402117 reverseProxy: true,
22412118 realClientIPHeader: "X-Real-IP", // Default value
22422119 req: func() *http.Request {
2243− req, _ := http.NewRequest(http.MethodGet, "/", nil)
2120+ req, _ := http.NewRequest("GET", "/", nil)
22442121 req.RemoteAddr = "127.0.0.1:44324"
22452122 return req
22462123 }(),
@@ -2253,7 +2130,7 @@ func TestTrustedIPs(t *testing.T) {
22532130 reverseProxy: true,
22542131 realClientIPHeader: "X-Forwarded-For",
22552132 req: func() *http.Request {
2256− req, _ := http.NewRequest(http.MethodGet, "/", nil)
2133+ req, _ := http.NewRequest("GET", "/", nil)
22572134 req.Header.Add("X-Forwarded-For", "127.0.0.1")
22582135 return req
22592136 }(),
@@ -2266,7 +2143,7 @@ func TestTrustedIPs(t *testing.T) {
22662143 reverseProxy: true,
22672144 realClientIPHeader: "X-Forwarded-For",
22682145 req: func() *http.Request {
2269− req, _ := http.NewRequest(http.MethodGet, "/", nil)
2146+ req, _ := http.NewRequest("GET", "/", nil)
22702147 req.Header.Add("X-Forwarded-For", "::1")
22712148 return req
22722149 }(),
@@ -2279,7 +2156,7 @@ func TestTrustedIPs(t *testing.T) {
22792156 reverseProxy: true,
22802157 realClientIPHeader: "X-Forwarded-For",
22812158 req: func() *http.Request {
2282− req, _ := http.NewRequest(http.MethodGet, "/", nil)
2159+ req, _ := http.NewRequest("GET", "/", nil)
22832160 req.Header.Add("X-Forwarded-For", "12.34.56.78")
22842161 return req
22852162 }(),
@@ -2292,7 +2169,7 @@ func TestTrustedIPs(t *testing.T) {
22922169 reverseProxy: true,
22932170 realClientIPHeader: "X-Forwarded-For",
22942171 req: func() *http.Request {
2295− req, _ := http.NewRequest(http.MethodGet, "/", nil)
2172+ req, _ := http.NewRequest("GET", "/", nil)
22962173 req.Header.Add("X-Forwarded-For", "::2")
22972174 return req
22982175 }(),
@@ -2305,7 +2182,7 @@ func TestTrustedIPs(t *testing.T) {
23052182 reverseProxy: true,
23062183 realClientIPHeader: "X-Forwarded-For",
23072184 req: func() *http.Request {
2308− req, _ := http.NewRequest(http.MethodGet, "/", nil)
2185+ req, _ := http.NewRequest("GET", "/", nil)
23092186 req.Header.Add("X-Real-IP", "::1")
23102187 return req
23112188 }(),
@@ -2318,7 +2195,7 @@ func TestTrustedIPs(t *testing.T) {
23182195 reverseProxy: true,
23192196 realClientIPHeader: "X-Forwarded-For",
23202197 req: func() *http.Request {
2321− req, _ := http.NewRequest(http.MethodGet, "/", nil)
2198+ req, _ := http.NewRequest("GET", "/", nil)
23222199 req.Header.Add("X-Forwarded-For", "adsfljk29242as!!")
23232200 return req
23242201 }(),
@@ -2331,7 +2208,7 @@ func TestTrustedIPs(t *testing.T) {
23312208 reverseProxy: false,
23322209 realClientIPHeader: "X-Real-IP",
23332210 req: func() *http.Request {
2334− req, _ := http.NewRequest(http.MethodGet, "/", nil)
2211+ req, _ := http.NewRequest("GET", "/", nil)
23352212 req.RemoteAddr = "adsfljk29242as!!"
23362213 return req
23372214 }(),
@@ -2347,7 +2224,7 @@ func TestTrustedIPs(t *testing.T) {
23472224 {
23482225 ID: "static",
23492226 Path: "/",
2350− Static: ptr.To(true),
2227+ Static: ptr.Ptr(true),
23512228 },
23522229 },
23532230 }
@@ -2427,12 +2304,12 @@ func Test_buildRoutesAllowlist(t *testing.T) {
24272304 },
24282305 expectedRoutes: []expectedAllowedRoute{
24292306 {
2430− method: http.MethodGet,
2307+ method: "GET",
24312308 negate: false,
24322309 regexString: "^/foo/bar",
24332310 },
24342311 {
2435− method: http.MethodPost,
2312+ method: "POST",
24362313 negate: false,
24372314 regexString: "^/baz/[0-9]+/thing",
24382315 },
@@ -2485,11 +2362,11 @@ func Test_buildRoutesAllowlist(t *testing.T) {
24852362 regexString: "^/baz/[0-9]+/thing/regex",
24862363 },
24872364 {
2488− method: http.MethodGet,
2365+ method: "GET",
24892366 regexString: "^/foo/bar",
24902367 },
24912368 {
2492− method: http.MethodPost,
2369+ method: "POST",
24932370 regexString: "^/baz/[0-9]+/thing",
24942371 },
24952372 {
@@ -2641,7 +2518,7 @@ func TestApiRoutes(t *testing.T) {
26412518
26422519 for _, tc := range testCases {
26432520 t.Run(tc.name, func(t *testing.T) {
2644− req, err := http.NewRequest(http.MethodGet, tc.url, nil)
2521+ req, err := http.NewRequest("GET", tc.url, nil)
26452522 req.Header.Set("Accept", tc.contentType)
26462523 assert.NoError(t, err)
26472524
@@ -2679,11 +2556,9 @@ func TestAllowedRequest(t *testing.T) {
26792556 }
26802557 opts.SkipAuthRegex = []string{
26812558 "^/skip/auth/regex$",
2682− "^/public/.*/endpoint$",
26832559 }
26842560 opts.SkipAuthRoutes = []string{
26852561 "GET=^/skip/auth/routes/get",
2686− "^/foo/.*/bar$",
26872562 }
26882563 err := validation.Validate(opts)
26892564 assert.NoError(t, err)
@@ -2700,37 +2575,25 @@ func TestAllowedRequest(t *testing.T) {
27002575 }{
27012576 {
27022577 name: "Regex GET allowed",
2703− method: http.MethodGet,
2578+ method: "GET",
27042579 url: "/skip/auth/regex",
27052580 allowed: true,
27062581 },
27072582 {
27082583 name: "Regex POST allowed ",
2709− method: http.MethodPost,
2584+ method: "POST",
27102585 url: "/skip/auth/regex",
27112586 allowed: true,
27122587 },
27132588 {
27142589 name: "Regex denied",
2715− method: http.MethodGet,
2590+ method: "GET",
27162591 url: "/wrong/denied",
27172592 allowed: false,
27182593 },
2719− {
2720− name: "Regex allowed with fragment-free path",
2721− method: http.MethodGet,
2722− url: "/public/legit/endpoint",
2723− allowed: true,
2724− },
2725− {
2726− name: "Regex denied when path contains encoded fragment suffix",
2727− method: http.MethodGet,
2728− url: "/public/secret%23/endpoint",
2729− allowed: false,
2730− },
27312594 {
27322595 name: "Route allowed",
2733− method: http.MethodGet,
2596+ method: "GET",
27342597 url: "/skip/auth/routes/get",
27352598 allowed: true,
27362599 },
@@ -2742,28 +2605,16 @@ func TestAllowedRequest(t *testing.T) {
27422605 },
27432606 {
27442607 name: "Route denied with wrong path",
2745− method: http.MethodGet,
2608+ method: "GET",
27462609 url: "/skip/auth/routes/wrong/path",
27472610 allowed: false,
27482611 },
27492612 {
27502613 name: "Route denied with wrong path and method",
2751− method: http.MethodPost,
2614+ method: "POST",
27522615 url: "/skip/auth/routes/wrong/path",
27532616 allowed: false,
27542617 },
2755− {
2756− name: "Route allowed with fragment-free path",
2757− method: http.MethodGet,
2758− url: "/foo/public/bar",
2759− allowed: true,
2760− },
2761− {
2762− name: "Route denied when path contains encoded fragment suffix",
2763− method: http.MethodGet,
2764− url: "/foo/secret%23/bar",
2765− allowed: false,
2766− },
27672618 }
27682619
27692620 for _, tc := range testCases {
@@ -2804,11 +2655,9 @@ func TestAllowedRequestWithForwardedUriHeader(t *testing.T) {
28042655 }
28052656 opts.SkipAuthRegex = []string{
28062657 "^/skip/auth/regex$",
2807− "^/public/.*/endpoint$",
28082658 }
28092659 opts.SkipAuthRoutes = []string{
28102660 "GET=^/skip/auth/routes/get",
2811− "^/foo/.*/bar$",
28122661 }
28132662 err := validation.Validate(opts)
28142663 assert.NoError(t, err)
@@ -2825,37 +2674,25 @@ func TestAllowedRequestWithForwardedUriHeader(t *testing.T) {
28252674 }{
28262675 {
28272676 name: "Regex GET allowed",
2828− method: http.MethodGet,
2677+ method: "GET",
28292678 url: "/skip/auth/regex",
28302679 allowed: true,
28312680 },
28322681 {
28332682 name: "Regex POST allowed ",
2834− method: http.MethodPost,
2683+ method: "POST",
28352684 url: "/skip/auth/regex",
28362685 allowed: true,
28372686 },
28382687 {
28392688 name: "Regex denied",
2840− method: http.MethodGet,
2689+ method: "GET",
28412690 url: "/wrong/denied",
28422691 allowed: false,
28432692 },
2844− {
2845− name: "Regex allowed with fragment-free path",
2846− method: http.MethodGet,
2847− url: "/public/legit/endpoint",
2848− allowed: true,
2849− },
2850− {
2851− name: "Regex denied when X-Forwarded-Uri contains an encoded fragment suffix",
2852− method: http.MethodGet,
2853− url: "/public/secret%23/endpoint",
2854− allowed: false,
2855− },
28562693 {
28572694 name: "Route allowed",
2858− method: http.MethodGet,
2695+ method: "GET",
28592696 url: "/skip/auth/routes/get",
28602697 allowed: true,
28612698 },
@@ -2867,35 +2704,22 @@ func TestAllowedRequestWithForwardedUriHeader(t *testing.T) {
28672704 },
28682705 {
28692706 name: "Route denied with wrong path",
2870− method: http.MethodGet,
2707+ method: "GET",
28712708 url: "/skip/auth/routes/wrong/path",
28722709 allowed: false,
28732710 },
28742711 {
28752712 name: "Route denied with wrong path and method",
2876− method: http.MethodPost,
2713+ method: "POST",
28772714 url: "/skip/auth/routes/wrong/path",
28782715 allowed: false,
28792716 },
2880− {
2881− name: "Route allowed with fragment-free path",
2882− method: http.MethodGet,
2883− url: "/foo/public/bar",
2884− allowed: true,
2885− },
2886− {
2887− name: "Route denied when X-Forwarded-Uri contains an encoded fragment suffix",
2888− method: http.MethodGet,
2889− url: "/foo/secret%23/bar",
2890− allowed: false,
2891− },
28922717 }
28932718
28942719 for _, tc := range testCases {
28952720 t.Run(tc.name, func(t *testing.T) {
28962721 req, err := http.NewRequest(tc.method, opts.ProxyPrefix+authOnlyPath, nil)
28972722 req.Header.Set("X-Forwarded-Uri", tc.url)
2898− req.RemoteAddr = "127.0.0.1:4180"
28992723 assert.NoError(t, err)
29002724
29012725 rw := httptest.NewRecorder()
@@ -2910,43 +2734,6 @@ func TestAllowedRequestWithForwardedUriHeader(t *testing.T) {
29102734 }
29112735}
29122736
2913−func TestAllowedRequestWithForwardedUriHeaderRequiresTrustedProxy(t *testing.T) {
2914− upstreamServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
2915− w.WriteHeader(200)
2916− }))
2917− t.Cleanup(upstreamServer.Close)
2918−
2919− opts := baseTestOptions()
2920− opts.ReverseProxy = true
2921− opts.TrustedProxyIPs = []string{"127.0.0.1/32"}
2922− opts.UpstreamServers = options.UpstreamConfig{
2923− Upstreams: []options.Upstream{
2924− {
2925− ID: upstreamServer.URL,
2926− Path: "/",
2927− URI: upstreamServer.URL,
2928− },
2929− },
2930− }
2931− opts.SkipAuthRegex = []string{"^/skip/auth/regex$"}
2932−
2933− err := validation.Validate(opts)
2934− assert.NoError(t, err)
2935−
2936− proxy, err := NewOAuthProxy(opts, func(_ string) bool { return true })
2937− assert.NoError(t, err)
2938−
2939− req, err := http.NewRequest(http.MethodGet, opts.ProxyPrefix+authOnlyPath, nil)
2940− assert.NoError(t, err)
2941− req.RemoteAddr = "192.0.2.10:4180"
2942− req.Header.Set("X-Forwarded-Uri", "/skip/auth/regex")
2943−
2944− rw := httptest.NewRecorder()
2945− proxy.ServeHTTP(rw, req)
2946−
2947− assert.Equal(t, 401, rw.Code)
2948−}
2949−
29502737func TestAllowedRequestNegateWithoutMethod(t *testing.T) {
29512738 upstreamServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
29522739 w.WriteHeader(200)
@@ -2986,37 +2773,37 @@ func TestAllowedRequestNegateWithoutMethod(t *testing.T) {
29862773 }{
29872774 {
29882775 name: "Some static file allowed",
2989− method: http.MethodGet,
2776+ method: "GET",
29902777 url: "/static/file.txt",
29912778 allowed: true,
29922779 },
29932780 {
29942781 name: "POST to contact form allowed",
2995− method: http.MethodPost,
2782+ method: "POST",
29962783 url: "/contact",
29972784 allowed: true,
29982785 },
29992786 {
30002787 name: "Regex POST allowed",
3001− method: http.MethodPost,
2788+ method: "POST",
30022789 url: "/api/public-entity",
30032790 allowed: true,
30042791 },
30052792 {
30062793 name: "Regex POST with trailing slash allowed",
3007− method: http.MethodPost,
2794+ method: "POST",
30082795 url: "/api/public-entity/",
30092796 allowed: true,
30102797 },
30112798 {
30122799 name: "Regex GET api route denied",
3013− method: http.MethodGet,
2800+ method: "GET",
30142801 url: "/api/users",
30152802 allowed: false,
30162803 },
30172804 {
30182805 name: "Regex POST api route denied",
3019− method: http.MethodPost,
2806+ method: "POST",
30202807 url: "/api/users",
30212808 allowed: false,
30222809 },
@@ -3086,37 +2873,37 @@ func TestAllowedRequestNegateWithMethod(t *testing.T) {
30862873 }{
30872874 {
30882875 name: "Some static file allowed",
3089− method: http.MethodGet,
2876+ method: "GET",
30902877 url: "/static/file.txt",
30912878 allowed: true,
30922879 },
30932880 {
30942881 name: "POST to contact form not allowed",
3095− method: http.MethodPost,
2882+ method: "POST",
30962883 url: "/contact",
30972884 allowed: false,
30982885 },
30992886 {
31002887 name: "Regex POST allowed",
3101− method: http.MethodPost,
2888+ method: "POST",
31022889 url: "/api/public-entity",
31032890 allowed: true,
31042891 },
31052892 {
31062893 name: "Regex POST with trailing slash allowed",
3107− method: http.MethodPost,
2894+ method: "POST",
31082895 url: "/api/public-entity/",
31092896 allowed: true,
31102897 },
31112898 {
31122899 name: "Regex GET api route denied",
3113− method: http.MethodGet,
2900+ method: "GET",
31142901 url: "/api/users",
31152902 allowed: false,
31162903 },
31172904 {
31182905 name: "Regex POST api route denied",
3119− method: http.MethodPost,
2906+ method: "POST",
31202907 url: "/api/users",
31212908 allowed: false,
31222909 },
@@ -3256,7 +3043,7 @@ func TestProxyAllowedGroups(t *testing.T) {
32563043 t.Fatal(err)
32573044 }
32583045
3259− test.req, _ = http.NewRequest(http.MethodGet, fmt.Sprintf("/%s", tt.querystring), nil)
3046+ test.req, _ = http.NewRequest("GET", fmt.Sprintf("/%s", tt.querystring), nil)
32603047
32613048 test.req.Header.Add("accept", applicationJSON)
32623049 err = test.SaveSession(session)
@@ -3400,7 +3187,7 @@ func TestAuthOnlyAllowedGroupsWithSkipMethods(t *testing.T) {
34003187 {
34013188 name: "UserWithGroupSkipAuthPreflight",
34023189 groups: []string{"a", "c"},
3403− method: http.MethodOptions,
3190+ method: "OPTIONS",
34043191 ip: "1.2.3.5:43670",
34053192 withSession: true,
34063193 expectedStatusCode: http.StatusAccepted,
@@ -3408,7 +3195,7 @@ func TestAuthOnlyAllowedGroupsWithSkipMethods(t *testing.T) {
34083195 {
34093196 name: "UserWithGroupTrustedIp",
34103197 groups: []string{"a", "c"},
3411− method: http.MethodGet,
3198+ method: "GET",
34123199 ip: "1.2.3.4:43670",
34133200 withSession: true,
34143201 expectedStatusCode: http.StatusAccepted,
@@ -3416,7 +3203,7 @@ func TestAuthOnlyAllowedGroupsWithSkipMethods(t *testing.T) {
34163203 {
34173204 name: "UserWithoutGroupSkipAuthPreflight",
34183205 groups: []string{"c"},
3419− method: http.MethodOptions,
3206+ method: "OPTIONS",
34203207 ip: "1.2.3.5:43670",
34213208 withSession: true,
34223209 expectedStatusCode: http.StatusForbidden,
@@ -3424,21 +3211,21 @@ func TestAuthOnlyAllowedGroupsWithSkipMethods(t *testing.T) {
34243211 {
34253212 name: "UserWithoutGroupTrustedIp",
34263213 groups: []string{"c"},
3427− method: http.MethodGet,
3214+ method: "GET",
34283215 ip: "1.2.3.4:43670",
34293216 withSession: true,
34303217 expectedStatusCode: http.StatusForbidden,
34313218 },
34323219 {
34333220 name: "UserWithoutSessionSkipAuthPreflight",
3434− method: http.MethodOptions,
3221+ method: "OPTIONS",
34353222 ip: "1.2.3.5:43670",
34363223 withSession: false,
34373224 expectedStatusCode: http.StatusAccepted,
34383225 },
34393226 {
34403227 name: "UserWithoutSessionTrustedIp",
3441− method: http.MethodGet,
3228+ method: "GET",
34423229 ip: "1.2.3.4:43670",
34433230 withSession: false,
34443231 expectedStatusCode: http.StatusAccepted,
@@ -3538,24 +3325,6 @@ func TestAuthOnlyAllowedEmailDomains(t *testing.T) {
35383325 querystring: "?allowed_email_domains=a.b.c.example.com,*.c.example.com",
35393326 expectedStatusCode: http.StatusAccepted,
35403327 },
3541− {
3542− name: "UserWithMultipleAtSignsExactDomain",
3543− email: "attacker@evil.com@example.com",
3544− querystring: "?allowed_email_domains=example.com",
3545− expectedStatusCode: http.StatusForbidden,
3546− },
3547− {
3548− name: "UserWithMultipleAtSignsWildcardDomain",
3549− email: "attacker@evil.com@foo.example.com",
3550− querystring: "?allowed_email_domains=*.example.com",
3551− expectedStatusCode: http.StatusForbidden,
3552− },
3553− {
3554− name: "UserWithMultipleAtSignsDotPrefixedDomain",
3555− email: "attacker@evil.com@foo.example.com",
3556− querystring: "?allowed_email_domains=.example.com",
3557− expectedStatusCode: http.StatusForbidden,
3558− },
35593328 }
35603329
35613330 for _, tc := range testCases {
@@ -3762,49 +3531,3 @@ func TestGetOAuthRedirectURI(t *testing.T) {
37623531 })
37633532 }
37643533}
3765−
3766−func TestIdTokenPlaceholderInSignOut(t *testing.T) {
3767− opts := baseTestOptions()
3768− opts.WhitelistDomains = []string{"my-oidc-provider.example.com"}
3769−
3770− err := validation.Validate(opts)
3771− assert.NoError(t, err)
3772−
3773− const emailAddress = "john.doe@example.com"
3774− const userName = "9fcab5c9b889a557"
3775− created := time.Now()
3776−
3777− session := &sessions.SessionState{
3778− User: userName,
3779− Groups: []string{"a", "b"},
3780− Email: emailAddress,
3781− IDToken: "eYjjjjjj.vvvv.ddd",
3782− AccessToken: "oauth_token",
3783− CreatedAt: &created,
3784− }
3785−
3786− proxy, err := NewOAuthProxy(opts, func(email string) bool {
3787− return true
3788− })
3789− assert.NoError(t, err)
3790−
3791− // Save the required session
3792− rw := httptest.NewRecorder()
3793− req, _ := http.NewRequest(http.MethodGet, "/", nil)
3794− err = proxy.sessionStore.Save(rw, req, session)
3795− assert.NoError(t, err)
3796−
3797− rw = httptest.NewRecorder()
3798−
3799− rdUrl := url.QueryEscape("https://my-oidc-provider.example.com/sign_out_page?id_token_hint={id_token}&post_logout_redirect_uri=https://my-app.example.com/")
3800− req, _ = http.NewRequest(http.MethodGet, "/oauth2/sign_out?rd="+rdUrl, nil)
3801− req = middlewareapi.AddRequestScope(req, &middlewareapi.RequestScope{
3802− RequestID: "11111111-2222-4333-8444-555555555555",
3803− Session: session,
3804− })
3805−
3806− proxy.SignOut(rw, req)
3807− newLocation := rw.Header().Values("Location")[0]
3808−
3809− assert.Equal(t, "https://my-oidc-provider.example.com/sign_out_page?id_token_hint=eYjjjjjj.vvvv.ddd&post_logout_redirect_uri=https://my-app.example.com/", newLocation)
3810−}
pkg/apis/middleware/scope.go+1−48
@@ -2,12 +2,9 @@ package middleware
22
33import (
44 "context"
5− "net"
65 "net/http"
7− "strings"
86
97 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/sessions"
10− "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/ip"
118)
129
1310type scopeKey string
@@ -21,13 +18,9 @@ const RequestScopeKey scopeKey = "request-scope"
2118// within the chain.
2219type RequestScope struct {
2320 // ReverseProxy tracks whether OAuth2-Proxy is operating in reverse proxy
24− // mode and if request `X-Forwarded-*` headers may be trusted
21+ // mode and if request `X-Forwarded-*` headers should be trusted
2522 ReverseProxy bool
2623
27− // TrustedProxies tracks which direct callers are allowed to supply
28− // forwarded headers when ReverseProxy mode is enabled.
29− TrustedProxies *ip.NetSet
30−
3124 // RequestID is set to the request's `X-Request-Id` header if set.
3225 // Otherwise a random UUID is set.
3326 RequestID string
@@ -65,43 +58,3 @@ func AddRequestScope(req *http.Request, scope *RequestScope) *http.Request {
6558 ctx := context.WithValue(req.Context(), RequestScopeKey, scope)
6659 return req.WithContext(ctx)
6760}
68−
69−// CanTrustForwardedHeaders returns whether forwarded headers should be
70−// processed for this request.
71−func (s *RequestScope) CanTrustForwardedHeaders(req *http.Request) bool {
72− if s == nil || req == nil || !s.ReverseProxy || s.TrustedProxies == nil {
73− return false
74− }
75−
76− if isUnixSocketRemoteAddr(req.RemoteAddr) {
77− return true
78− }
79−
80− remoteIP := parseRemoteAddrIP(req.RemoteAddr)
81− if remoteIP == nil {
82− return false
83− }
84−
85− return s.TrustedProxies.Has(remoteIP)
86−}
87−
88−func parseRemoteAddrIP(remoteAddr string) net.IP {
89− if remoteAddr == "" {
90− return nil
91− }
92−
93− if ip := net.ParseIP(remoteAddr); ip != nil {
94− return ip
95− }
96−
97− host, _, err := net.SplitHostPort(remoteAddr)
98− if err != nil {
99− return nil
100− }
101−
102− return net.ParseIP(host)
103−}
104−
105−func isUnixSocketRemoteAddr(remoteAddr string) bool {
106− return remoteAddr == "@" || strings.HasPrefix(remoteAddr, "/")
107−}
pkg/apis/middleware/scope_test.go−34
@@ -4,7 +4,6 @@ import (
44 "net/http"
55
66 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/middleware"
7− "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/ip"
87 . "github.com/onsi/ginkgo/v2"
98 . "github.com/onsi/gomega"
109)
@@ -54,37 +53,4 @@ var _ = Describe("Scope Suite", func() {
5453 })
5554 })
5655 })
57−
58− Context("CanTrustForwardedHeaders", func() {
59− var request *http.Request
60− var scope *middleware.RequestScope
61−
62− BeforeEach(func() {
63− var err error
64− request, err = http.NewRequest("", "http://127.0.0.1/", nil)
65− Expect(err).ToNot(HaveOccurred())
66−
67− trustedProxies, err := ip.ParseNetSet([]string{"127.0.0.1"})
68− Expect(err).ToNot(HaveOccurred())
69− scope = &middleware.RequestScope{
70− ReverseProxy: true,
71− TrustedProxies: trustedProxies,
72− }
73− })
74−
75− It("returns true for a trusted remote address", func() {
76− request.RemoteAddr = "127.0.0.1:4180"
77− Expect(scope.CanTrustForwardedHeaders(request)).To(BeTrue())
78− })
79−
80− It("returns false for an untrusted remote address", func() {
81− request.RemoteAddr = "192.0.2.10:4180"
82− Expect(scope.CanTrustForwardedHeaders(request)).To(BeFalse())
83− })
84−
85− It("returns true for unix socket callers", func() {
86− request.RemoteAddr = "@"
87− Expect(scope.CanTrustForwardedHeaders(request)).To(BeTrue())
88− })
89− })
9056})
pkg/apis/middleware/session.go+1−4
@@ -41,10 +41,7 @@ func CreateTokenToSessionFunc(verify VerifyFunc) TokenToSessionFunc {
4141 claims.Email = claims.Subject
4242 }
4343
44− // Ensure email is verified
45− // If the email is not verified, return an error
46− // If the email_verified claim is missing, assume it is verified
47− if !ptr.Deref(claims.Verified, true) {
44+ if !ptr.Deref(claims.Verified, false) {
4845 return nil, fmt.Errorf("email in id_token (%s) isn't verified", claims.Email)
4946 }
5047
pkg/apis/options/cookie.go−3
@@ -24,7 +24,6 @@ type Cookie struct {
2424 CSRFPerRequest bool `flag:"cookie-csrf-per-request" cfg:"cookie_csrf_per_request"`
2525 CSRFPerRequestLimit int `flag:"cookie-csrf-per-request-limit" cfg:"cookie_csrf_per_request_limit"`
2626 CSRFExpire time.Duration `flag:"cookie-csrf-expire" cfg:"cookie_csrf_expire"`
27− CSRFSameSite string `flag:"cookie-csrf-samesite" cfg:"cookie_csrf_samesite"`
2827}
2928
3029func cookieFlagSet() *pflag.FlagSet {
@@ -43,7 +42,6 @@ func cookieFlagSet() *pflag.FlagSet {
4342 flagSet.Bool("cookie-csrf-per-request", false, "When this property is set to true, then the CSRF cookie name is built based on the state and varies per request. If property is set to false, then CSRF cookie has the same name for all requests.")
4443 flagSet.Int("cookie-csrf-per-request-limit", 0, "Sets a limit on the number of CSRF requests cookies that oauth2-proxy will create. The oldest cookies will be removed. Useful if users end up with 431 Request headers too large status codes.")
4544 flagSet.Duration("cookie-csrf-expire", time.Duration(15)*time.Minute, "expire timeframe for CSRF cookie")
46− flagSet.String("cookie-csrf-samesite", "", "set SameSite CSRF cookie attribute (ie: \"lax\", \"strict\", \"none\", or \"\"). When using the default setting, the CSRF cookie samesite value is taken from the session cookie configuration.")
4745 return flagSet
4846}
4947
@@ -63,7 +61,6 @@ func cookieDefaults() Cookie {
6361 CSRFPerRequest: false,
6462 CSRFPerRequestLimit: 0,
6563 CSRFExpire: time.Duration(15) * time.Minute,
66− CSRFSameSite: "",
6764 }
6865}
6966
pkg/apis/options/header.go+2−4
@@ -5,8 +5,6 @@ import "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/util/ptr"
55const (
66 // DefaultHeaderPreserveRequestValue is the default value for Header.PreserveRequestValue
77 DefaultHeaderPreserveRequestValue bool = false
8− // DefaultInsecureSkipHeaderNormalization is the default value for Header.InsecureSkipHeaderNormalization
9− DefaultInsecureSkipHeaderNormalization bool = false
108)
119
1210// Header represents an individual header that will be added to a request or
@@ -30,7 +28,7 @@ type Header struct {
3028 // treated as the same header. Additionally underscores (_) in header names
3129 // will be converted to dashes (-) when normalizing.
3230 // Defaults to false (header names will be normalized).
33− InsecureSkipHeaderNormalization *bool `yaml:"InsecureSkipHeaderNormalization,omitempty"`
31+ InsecureSkipHeaderNormalization bool `json:"InsecureSkipHeaderNormalization,omitempty"`
3432
3533 // Values contains the desired values for this header
3634 Values []HeaderValue `yaml:"values,omitempty"`
@@ -66,7 +64,7 @@ type ClaimSource struct {
6664// EnsureDefaults sets any default values for Header fields.
6765func (h *Header) EnsureDefaults() {
6866 if h.PreserveRequestValue == nil {
69− h.PreserveRequestValue = ptr.To(DefaultHeaderPreserveRequestValue)
67+ h.PreserveRequestValue = ptr.Ptr(DefaultHeaderPreserveRequestValue)
7068 }
7169 for i := range h.Values {
7270 h.Values[i].EnsureDefaults()
pkg/apis/options/legacy_options.go+28−50
@@ -51,16 +51,15 @@ func NewLegacyOptions() *LegacyOptions {
5151 },
5252
5353 LegacyProvider: LegacyProvider{
54− ProviderType: "google",
55− AzureTenant: "common",
56− ApprovalPrompt: "force",
57− UserIDClaim: "email",
58− OIDCEmailClaim: "email",
59− OIDCGroupsClaim: "groups",
60− OIDCAudienceClaims: []string{"aud"},
61− OIDCExtraAudiences: []string{},
62− OIDCEnabledSigningAlgs: []string{},
63− InsecureOIDCSkipNonce: true,
54+ ProviderType: "google",
55+ AzureTenant: "common",
56+ ApprovalPrompt: "force",
57+ UserIDClaim: "email",
58+ OIDCEmailClaim: "email",
59+ OIDCGroupsClaim: "groups",
60+ OIDCAudienceClaims: []string{"aud"},
61+ OIDCExtraAudiences: []string{},
62+ InsecureOIDCSkipNonce: true,
6463 },
6564
6665 Options: *NewOptions(),
@@ -97,7 +96,6 @@ func (l *LegacyOptions) ToOptions() (*Options, error) {
9796 return nil, fmt.Errorf("error converting provider: %v", err)
9897 }
9998 l.Options.Providers = providers
100− l.Options.EnsureDefaults()
10199
102100 return &l.Options, nil
103101}
@@ -167,7 +165,7 @@ func (l *LegacyUpstreams) convert() (UpstreamConfig, error) {
167165 logger.Errorf("unable to convert %q to int, use default \"200\"", u.Host)
168166 responseCode = 200
169167 }
170− upstream.Static = ptr.To(true)
168+ upstream.Static = ptr.Ptr(true)
171169 upstream.StaticCode = &responseCode
172170
173171 // This is not allowed to be empty and must be unique
@@ -178,12 +176,8 @@ func (l *LegacyUpstreams) convert() (UpstreamConfig, error) {
178176
179177 // Force defaults compatible with static responses
180178 upstream.URI = ""
181− upstream.InsecureSkipTLSVerify = ptr.To(false)
182− upstream.DisableKeepAlives = ptr.To(false)
183− upstream.PassHostHeader = ptr.To(false)
184− upstream.ProxyWebSockets = ptr.To(false)
185− upstream.FlushInterval = ptr.To(DefaultUpstreamFlushInterval)
186− upstream.Timeout = ptr.To(DefaultUpstreamTimeout)
179+ upstream.InsecureSkipTLSVerify = ptr.Ptr(false)
180+ upstream.DisableKeepAlives = ptr.Ptr(false)
187181 case "unix":
188182 upstream.Path = "/"
189183 }
@@ -256,7 +250,7 @@ func (l *LegacyHeaders) getRequestHeaders() []Header {
256250 }
257251
258252 for i := range requestHeaders {
259− requestHeaders[i].PreserveRequestValue = ptr.To(!l.SkipAuthStripHeaders)
253+ requestHeaders[i].PreserveRequestValue = ptr.Ptr(!l.SkipAuthStripHeaders)
260254 }
261255
262256 return requestHeaders
@@ -290,8 +284,7 @@ func getBasicAuthHeader(preferEmailToUser bool, basicAuthPassword string) Header
290284 }
291285
292286 return Header{
293− Name: "Authorization",
294− PreserveRequestValue: ptr.To(false),
287+ Name: "Authorization",
295288 Values: []HeaderValue{
296289 {
297290 ClaimSource: &ClaimSource{
@@ -309,8 +302,7 @@ func getBasicAuthHeader(preferEmailToUser bool, basicAuthPassword string) Header
309302func getPassUserHeaders(preferEmailToUser bool) []Header {
310303 headers := []Header{
311304 {
312− Name: "X-Forwarded-Groups",
313− PreserveRequestValue: ptr.To(false),
305+ Name: "X-Forwarded-Groups",
314306 Values: []HeaderValue{
315307 {
316308 ClaimSource: &ClaimSource{
@@ -324,8 +316,7 @@ func getPassUserHeaders(preferEmailToUser bool) []Header {
324316 if preferEmailToUser {
325317 return append(headers,
326318 Header{
327− Name: "X-Forwarded-User",
328− PreserveRequestValue: ptr.To(false),
319+ Name: "X-Forwarded-User",
329320 Values: []HeaderValue{
330321 {
331322 ClaimSource: &ClaimSource{
@@ -339,8 +330,7 @@ func getPassUserHeaders(preferEmailToUser bool) []Header {
339330
340331 return append(headers,
341332 Header{
342− Name: "X-Forwarded-User",
343− PreserveRequestValue: ptr.To(false),
333+ Name: "X-Forwarded-User",
344334 Values: []HeaderValue{
345335 {
346336 ClaimSource: &ClaimSource{
@@ -350,8 +340,7 @@ func getPassUserHeaders(preferEmailToUser bool) []Header {
350340 },
351341 },
352342 Header{
353− Name: "X-Forwarded-Email",
354− PreserveRequestValue: ptr.To(false),
343+ Name: "X-Forwarded-Email",
355344 Values: []HeaderValue{
356345 {
357346 ClaimSource: &ClaimSource{
@@ -365,8 +354,7 @@ func getPassUserHeaders(preferEmailToUser bool) []Header {
365354
366355func getPassAccessTokenHeader() Header {
367356 return Header{
368− Name: "X-Forwarded-Access-Token",
369− PreserveRequestValue: ptr.To(false),
357+ Name: "X-Forwarded-Access-Token",
370358 Values: []HeaderValue{
371359 {
372360 ClaimSource: &ClaimSource{
@@ -379,8 +367,7 @@ func getPassAccessTokenHeader() Header {
379367
380368func getAuthorizationHeader() Header {
381369 return Header{
382− Name: "Authorization",
383− PreserveRequestValue: ptr.To(false),
370+ Name: "Authorization",
384371 Values: []HeaderValue{
385372 {
386373 ClaimSource: &ClaimSource{
@@ -394,8 +381,7 @@ func getAuthorizationHeader() Header {
394381
395382func getPreferredUsernameHeader() Header {
396383 return Header{
397− Name: "X-Forwarded-Preferred-Username",
398− PreserveRequestValue: ptr.To(false),
384+ Name: "X-Forwarded-Preferred-Username",
399385 Values: []HeaderValue{
400386 {
401387 ClaimSource: &ClaimSource{
@@ -409,8 +395,7 @@ func getPreferredUsernameHeader() Header {
409395func getXAuthRequestHeaders() []Header {
410396 headers := []Header{
411397 {
412− Name: "X-Auth-Request-User",
413− PreserveRequestValue: ptr.To(false),
398+ Name: "X-Auth-Request-User",
414399 Values: []HeaderValue{
415400 {
416401 ClaimSource: &ClaimSource{
@@ -420,8 +405,7 @@ func getXAuthRequestHeaders() []Header {
420405 },
421406 },
422407 {
423− Name: "X-Auth-Request-Email",
424− PreserveRequestValue: ptr.To(false),
408+ Name: "X-Auth-Request-Email",
425409 Values: []HeaderValue{
426410 {
427411 ClaimSource: &ClaimSource{
@@ -431,8 +415,7 @@ func getXAuthRequestHeaders() []Header {
431415 },
432416 },
433417 {
434− Name: "X-Auth-Request-Preferred-Username",
435− PreserveRequestValue: ptr.To(false),
418+ Name: "X-Auth-Request-Preferred-Username",
436419 Values: []HeaderValue{
437420 {
438421 ClaimSource: &ClaimSource{
@@ -442,8 +425,7 @@ func getXAuthRequestHeaders() []Header {
442425 },
443426 },
444427 {
445− Name: "X-Auth-Request-Groups",
446− PreserveRequestValue: ptr.To(false),
428+ Name: "X-Auth-Request-Groups",
447429 Values: []HeaderValue{
448430 {
449431 ClaimSource: &ClaimSource{
@@ -459,8 +441,7 @@ func getXAuthRequestHeaders() []Header {
459441
460442func getXAuthRequestAccessTokenHeader() Header {
461443 return Header{
462− Name: "X-Auth-Request-Access-Token",
463− PreserveRequestValue: ptr.To(false),
444+ Name: "X-Auth-Request-Access-Token",
464445 Values: []HeaderValue{
465446 {
466447 ClaimSource: &ClaimSource{
@@ -546,7 +527,6 @@ type LegacyProvider struct {
546527 OIDCAudienceClaims []string `flag:"oidc-audience-claim" cfg:"oidc_audience_claims"`
547528 OIDCExtraAudiences []string `flag:"oidc-extra-audience" cfg:"oidc_extra_audiences"`
548529 OIDCPublicKeyFiles []string `flag:"oidc-public-key-file" cfg:"oidc_public_key_files"`
549− OIDCEnabledSigningAlgs []string `flag:"oidc-enabled-signing-alg" cfg:"oidc_enabled_signing_algs"`
550530 LoginURL string `flag:"login-url" cfg:"login_url"`
551531 AuthRequestResponseMode string `flag:"auth-request-response-mode" cfg:"auth_request_response_mode"`
552532 RedeemURL string `flag:"redeem-url" cfg:"redeem_url"`
@@ -608,7 +588,6 @@ func legacyProviderFlagSet() *pflag.FlagSet {
608588 flagSet.StringSlice("oidc-audience-claim", OIDCAudienceClaims, "which OIDC claims are used as audience to verify against client id")
609589 flagSet.StringSlice("oidc-extra-audience", []string{}, "additional audiences allowed to pass audience verification")
610590 flagSet.StringSlice("oidc-public-key-file", []string{}, "path to public key file in PEM format to use for verifying JWT tokens (may be given multiple times)")
611− flagSet.StringSlice("oidc-enabled-signing-alg", []string{}, "accepted signing algorithms for provider to use")
612591 flagSet.String("login-url", "", "Authentication endpoint")
613592 flagSet.String("redeem-url", "", "Token redemption endpoint")
614593 flagSet.String("profile-url", "", "Profile access endpoint")
@@ -694,7 +673,7 @@ func (l LegacyServer) convert() (Server, Server) {
694673}
695674
696675func (l *LegacyProvider) convert() (Providers, error) {
697− providers := make(Providers, 0, 1)
676+ providers := Providers{}
698677
699678 provider := Provider{
700679 ClientID: l.ClientID,
@@ -730,7 +709,6 @@ func (l *LegacyProvider) convert() (Providers, error) {
730709 AudienceClaims: l.OIDCAudienceClaims,
731710 ExtraAudiences: l.OIDCExtraAudiences,
732711 PublicKeyFiles: l.OIDCPublicKeyFiles,
733− EnabledSigningAlgs: l.OIDCEnabledSigningAlgs,
734712 }
735713
736714 // Support for legacy configuration option
@@ -793,7 +771,7 @@ func (l *LegacyProvider) convert() (Providers, error) {
793771 ServiceAccountJSON: l.GoogleServiceAccountJSON,
794772 UseApplicationDefaultCredentials: &l.GoogleUseApplicationDefaultCredentials,
795773 TargetPrincipal: l.GoogleTargetPrincipal,
796− UseOrganizationID: &l.GoogleUseOrganizationID,
774+ UseOrganizationID: l.GoogleUseOrganizationID,
797775 AdminAPIUserScope: l.GoogleAdminAPIUserScope,
798776 }
799777 case "entra-id":
pkg/apis/options/legacy_options_test.go+67−103
@@ -27,7 +27,6 @@ var _ = Describe("Legacy Options", func() {
2727 legacyOpts.LegacyUpstreams.Upstreams = []string{"http://foo.bar/baz", "file:///var/lib/website#/bar", "static://204"}
2828 legacyOpts.LegacyProvider.ClientID = "oauth-proxy"
2929 legacyOpts.LegacyUpstreams.DisableKeepAlives = false
30− legacyOpts.LegacyProvider.OIDCEnabledSigningAlgs = []string{"RS256", "EdDSA"}
3130
3231 staticCode := 204
3332 opts.UpstreamServers = UpstreamConfig{
@@ -37,9 +36,9 @@ var _ = Describe("Legacy Options", func() {
3736 Path: "/baz",
3837 URI: "http://foo.bar/baz",
3938 FlushInterval: &flushInterval,
40− InsecureSkipTLSVerify: ptr.To(true),
41− PassHostHeader: ptr.To(true),
42− ProxyWebSockets: ptr.To(true),
39+ InsecureSkipTLSVerify: ptr.Ptr(true),
40+ PassHostHeader: ptr.Ptr(true),
41+ ProxyWebSockets: ptr.Ptr(true),
4342 Timeout: &timeout,
4443 DisableKeepAlives: &legacyOpts.LegacyUpstreams.DisableKeepAlives,
4544 },
@@ -48,9 +47,9 @@ var _ = Describe("Legacy Options", func() {
4847 Path: "/bar",
4948 URI: "file:///var/lib/website",
5049 FlushInterval: &flushInterval,
51− InsecureSkipTLSVerify: ptr.To(true),
52− PassHostHeader: ptr.To(true),
53− ProxyWebSockets: ptr.To(true),
50+ InsecureSkipTLSVerify: ptr.Ptr(true),
51+ PassHostHeader: ptr.Ptr(true),
52+ ProxyWebSockets: ptr.Ptr(true),
5453 Timeout: &timeout,
5554 DisableKeepAlives: &legacyOpts.LegacyUpstreams.DisableKeepAlives,
5655 },
@@ -58,10 +57,10 @@ var _ = Describe("Legacy Options", func() {
5857 ID: "static://204",
5958 Path: "/",
6059 URI: "",
61− Static: ptr.To(true),
60+ Static: ptr.Ptr(true),
6261 StaticCode: &staticCode,
6362 FlushInterval: nil,
64− InsecureSkipTLSVerify: ptr.To(false),
63+ InsecureSkipTLSVerify: ptr.Ptr(false),
6564 PassHostHeader: nil,
6665 ProxyWebSockets: nil,
6766 Timeout: nil,
@@ -73,7 +72,7 @@ var _ = Describe("Legacy Options", func() {
7372 opts.InjectRequestHeaders = []Header{
7473 {
7574 Name: "X-Forwarded-Groups",
76− PreserveRequestValue: ptr.To(false),
75+ PreserveRequestValue: ptr.Ptr(false),
7776 Values: []HeaderValue{
7877 {
7978 ClaimSource: &ClaimSource{
@@ -84,7 +83,7 @@ var _ = Describe("Legacy Options", func() {
8483 },
8584 {
8685 Name: "X-Forwarded-User",
87− PreserveRequestValue: ptr.To(false),
86+ PreserveRequestValue: ptr.Ptr(false),
8887 Values: []HeaderValue{
8988 {
9089 ClaimSource: &ClaimSource{
@@ -95,7 +94,7 @@ var _ = Describe("Legacy Options", func() {
9594 },
9695 {
9796 Name: "X-Forwarded-Email",
98− PreserveRequestValue: ptr.To(false),
97+ PreserveRequestValue: ptr.Ptr(false),
9998 Values: []HeaderValue{
10099 {
101100 ClaimSource: &ClaimSource{
@@ -106,7 +105,7 @@ var _ = Describe("Legacy Options", func() {
106105 },
107106 {
108107 Name: "X-Forwarded-Preferred-Username",
109− PreserveRequestValue: ptr.To(false),
108+ PreserveRequestValue: ptr.Ptr(false),
110109 Values: []HeaderValue{
111110 {
112111 ClaimSource: &ClaimSource{
@@ -123,20 +122,16 @@ var _ = Describe("Legacy Options", func() {
123122 BindAddress: "127.0.0.1:4180",
124123 }
125124
126− opts.Providers[0].ID = "google=oauth-proxy"
127125 opts.Providers[0].ClientID = "oauth-proxy"
126+ opts.Providers[0].ID = "google=oauth-proxy"
127+ opts.Providers[0].OIDCConfig.InsecureSkipNonce = ptr.Ptr(true)
128128 opts.Providers[0].OIDCConfig.AudienceClaims = []string{"aud"}
129129 opts.Providers[0].OIDCConfig.ExtraAudiences = []string{}
130− opts.Providers[0].OIDCConfig.InsecureSkipNonce = ptr.To(true)
131− opts.Providers[0].OIDCConfig.InsecureSkipIssuerVerification = ptr.To(false)
132− opts.Providers[0].OIDCConfig.EnabledSigningAlgs = []string{"RS256", "EdDSA"}
133130 opts.Providers[0].LoginURLParameters = []LoginURLParameter{
134131 {Name: "approval_prompt", Default: []string{"force"}},
135132 }
136133
137134 converted, err := legacyOpts.ToOptions()
138− opts.EnsureDefaults()
139−
140135 Expect(err).ToNot(HaveOccurred())
141136 Expect(converted).To(EqualOpts(opts))
142137 })
@@ -204,14 +199,14 @@ var _ = Describe("Legacy Options", func() {
204199 ID: validStatic,
205200 Path: "/",
206201 URI: "",
207− Static: ptr.To(true),
202+ Static: ptr.Ptr(true),
208203 StaticCode: &validStaticCode,
209− InsecureSkipTLSVerify: ptr.To(DefaultUpsteamInsecureSkipTLSVerify),
210− PassHostHeader: ptr.To(DefaultStaticPassHostHeader),
211− ProxyWebSockets: ptr.To(DefaultStaticProxyWebSockets),
212− FlushInterval: ptr.To(DefaultUpstreamFlushInterval),
213− Timeout: ptr.To(DefaultUpstreamTimeout),
214− DisableKeepAlives: ptr.To(DefaultUpstreamDisableKeepAlives),
204+ InsecureSkipTLSVerify: ptr.Ptr(false),
205+ PassHostHeader: nil,
206+ ProxyWebSockets: nil,
207+ FlushInterval: nil,
208+ Timeout: nil,
209+ DisableKeepAlives: ptr.Ptr(false),
215210 }
216211
217212 invalidStatic := "static://abc"
@@ -220,14 +215,14 @@ var _ = Describe("Legacy Options", func() {
220215 ID: invalidStatic,
221216 Path: "/",
222217 URI: "",
223− Static: ptr.To(true),
218+ Static: ptr.Ptr(true),
224219 StaticCode: &invalidStaticCode,
225− InsecureSkipTLSVerify: ptr.To(DefaultUpsteamInsecureSkipTLSVerify),
226− PassHostHeader: ptr.To(DefaultStaticPassHostHeader),
227− ProxyWebSockets: ptr.To(DefaultStaticProxyWebSockets),
228− FlushInterval: ptr.To(DefaultUpstreamFlushInterval),
229− Timeout: ptr.To(DefaultUpstreamTimeout),
230− DisableKeepAlives: ptr.To(DefaultUpstreamDisableKeepAlives),
220+ InsecureSkipTLSVerify: ptr.Ptr(false),
221+ PassHostHeader: nil,
222+ ProxyWebSockets: nil,
223+ FlushInterval: nil,
224+ Timeout: nil,
225+ DisableKeepAlives: ptr.Ptr(false),
231226 }
232227
233228 invalidHTTP := ":foo"
@@ -320,7 +315,7 @@ var _ = Describe("Legacy Options", func() {
320315
321316 xForwardedUser := Header{
322317 Name: "X-Forwarded-User",
323− PreserveRequestValue: ptr.To(false),
318+ PreserveRequestValue: ptr.Ptr(false),
324319 Values: []HeaderValue{
325320 {
326321 ClaimSource: &ClaimSource{
@@ -332,7 +327,7 @@ var _ = Describe("Legacy Options", func() {
332327
333328 xForwardedEmail := Header{
334329 Name: "X-Forwarded-Email",
335− PreserveRequestValue: ptr.To(false),
330+ PreserveRequestValue: ptr.Ptr(false),
336331 Values: []HeaderValue{
337332 {
338333 ClaimSource: &ClaimSource{
@@ -344,7 +339,7 @@ var _ = Describe("Legacy Options", func() {
344339
345340 xForwardedGroups := Header{
346341 Name: "X-Forwarded-Groups",
347− PreserveRequestValue: ptr.To(false),
342+ PreserveRequestValue: ptr.Ptr(false),
348343 Values: []HeaderValue{
349344 {
350345 ClaimSource: &ClaimSource{
@@ -356,7 +351,7 @@ var _ = Describe("Legacy Options", func() {
356351
357352 xForwardedPreferredUsername := Header{
358353 Name: "X-Forwarded-Preferred-Username",
359− PreserveRequestValue: ptr.To(false),
354+ PreserveRequestValue: ptr.Ptr(false),
360355 Values: []HeaderValue{
361356 {
362357 ClaimSource: &ClaimSource{
@@ -368,7 +363,7 @@ var _ = Describe("Legacy Options", func() {
368363
369364 basicAuthHeader := Header{
370365 Name: "Authorization",
371− PreserveRequestValue: ptr.To(false),
366+ PreserveRequestValue: ptr.Ptr(false),
372367 Values: []HeaderValue{
373368 {
374369 ClaimSource: &ClaimSource{
@@ -384,7 +379,7 @@ var _ = Describe("Legacy Options", func() {
384379
385380 xForwardedUserWithEmail := Header{
386381 Name: "X-Forwarded-User",
387− PreserveRequestValue: ptr.To(false),
382+ PreserveRequestValue: ptr.Ptr(false),
388383 Values: []HeaderValue{
389384 {
390385 ClaimSource: &ClaimSource{
@@ -396,7 +391,7 @@ var _ = Describe("Legacy Options", func() {
396391
397392 xForwardedAccessToken := Header{
398393 Name: "X-Forwarded-Access-Token",
399− PreserveRequestValue: ptr.To(false),
394+ PreserveRequestValue: ptr.Ptr(false),
400395 Values: []HeaderValue{
401396 {
402397 ClaimSource: &ClaimSource{
@@ -408,7 +403,7 @@ var _ = Describe("Legacy Options", func() {
408403
409404 basicAuthHeaderWithEmail := Header{
410405 Name: "Authorization",
411− PreserveRequestValue: ptr.To(false),
406+ PreserveRequestValue: ptr.Ptr(false),
412407 Values: []HeaderValue{
413408 {
414409 ClaimSource: &ClaimSource{
@@ -424,7 +419,7 @@ var _ = Describe("Legacy Options", func() {
424419
425420 xAuthRequestUser := Header{
426421 Name: "X-Auth-Request-User",
427− PreserveRequestValue: ptr.To(false),
422+ PreserveRequestValue: ptr.Ptr(false),
428423 Values: []HeaderValue{
429424 {
430425 ClaimSource: &ClaimSource{
@@ -436,7 +431,7 @@ var _ = Describe("Legacy Options", func() {
436431
437432 xAuthRequestEmail := Header{
438433 Name: "X-Auth-Request-Email",
439− PreserveRequestValue: ptr.To(false),
434+ PreserveRequestValue: ptr.Ptr(false),
440435 Values: []HeaderValue{
441436 {
442437 ClaimSource: &ClaimSource{
@@ -448,7 +443,7 @@ var _ = Describe("Legacy Options", func() {
448443
449444 xAuthRequestGroups := Header{
450445 Name: "X-Auth-Request-Groups",
451− PreserveRequestValue: ptr.To(false),
446+ PreserveRequestValue: ptr.Ptr(false),
452447 Values: []HeaderValue{
453448 {
454449 ClaimSource: &ClaimSource{
@@ -460,7 +455,7 @@ var _ = Describe("Legacy Options", func() {
460455
461456 xAuthRequestPreferredUsername := Header{
462457 Name: "X-Auth-Request-Preferred-Username",
463− PreserveRequestValue: ptr.To(false),
458+ PreserveRequestValue: ptr.Ptr(false),
464459 Values: []HeaderValue{
465460 {
466461 ClaimSource: &ClaimSource{
@@ -472,7 +467,7 @@ var _ = Describe("Legacy Options", func() {
472467
473468 xAuthRequestAccessToken := Header{
474469 Name: "X-Auth-Request-Access-Token",
475− PreserveRequestValue: ptr.To(false),
470+ PreserveRequestValue: ptr.Ptr(false),
476471 Values: []HeaderValue{
477472 {
478473 ClaimSource: &ClaimSource{
@@ -484,7 +479,7 @@ var _ = Describe("Legacy Options", func() {
484479
485480 authorizationHeader := Header{
486481 Name: "Authorization",
487− PreserveRequestValue: ptr.To(false),
482+ PreserveRequestValue: ptr.Ptr(false),
488483 Values: []HeaderValue{
489484 {
490485 ClaimSource: &ClaimSource{
@@ -949,51 +944,37 @@ var _ = Describe("Legacy Options", func() {
949944 {Name: "approval_prompt", Default: []string{"force"}},
950945 }
951946
952− defaultOIDCOptions := OIDCOptions{
953− SkipDiscovery: ptr.To(false),
954− InsecureSkipNonce: ptr.To(false),
955− InsecureAllowUnverifiedEmail: ptr.To(false),
956− InsecureSkipIssuerVerification: ptr.To(false),
957− }
958−
959− defaultGoogleOptions := GoogleOptions{
960− UseOrganizationID: ptr.To(false),
961− UseApplicationDefaultCredentials: ptr.To(false),
947+ defaultProvider := Provider{
948+ ID: "google=" + clientID,
949+ ClientID: clientID,
950+ Type: "google",
951+ LoginURLParameters: defaultURLParams,
962952 }
963−
964953 defaultLegacyProvider := LegacyProvider{
965954 ClientID: clientID,
966955 ProviderType: "google",
967956 }
968957
969− defaultProvider := Provider{
970− ID: "google=" + clientID,
971− ClientID: clientID,
972− Type: "google",
973− OIDCConfig: defaultOIDCOptions,
974− GoogleConfig: defaultGoogleOptions,
975− LoginURLParameters: defaultURLParams,
976− UseSystemTrustStore: ptr.To(false),
977− SkipClaimsFromProfileURL: ptr.To(false),
958+ defaultProviderWithPrompt := Provider{
959+ ID: "google=" + clientID,
960+ ClientID: clientID,
961+ Type: "google",
962+ LoginURLParameters: []LoginURLParameter{
963+ {Name: "prompt", Default: []string{"switch_user"}},
964+ },
978965 }
979−
980966 defaultLegacyProviderWithPrompt := LegacyProvider{
981967 ClientID: clientID,
982968 ProviderType: "google",
983969 Prompt: "switch_user",
984970 }
985971
986− defaultProviderWithPrompt := Provider{
987− ID: "google=" + clientID,
988− ClientID: clientID,
989− Type: "google",
990− OIDCConfig: defaultOIDCOptions,
991− GoogleConfig: defaultGoogleOptions,
992− LoginURLParameters: []LoginURLParameter{
993− {Name: "prompt", Default: []string{"switch_user"}},
994− },
995− UseSystemTrustStore: ptr.To(false),
996− SkipClaimsFromProfileURL: ptr.To(false),
972+ displayNameProvider := Provider{
973+ ID: "displayName",
974+ Name: "displayName",
975+ ClientID: clientID,
976+ Type: "google",
977+ LoginURLParameters: defaultURLParams,
997978 }
998979
999980 displayNameLegacyProvider := LegacyProvider{
@@ -1002,33 +983,16 @@ var _ = Describe("Legacy Options", func() {
1002983 ProviderType: "google",
1003984 }
1004985
1005− displayNameProvider := Provider{
1006− ID: "displayName",
1007− Name: "displayName",
1008− ClientID: clientID,
1009− Type: "google",
1010− OIDCConfig: defaultOIDCOptions,
1011− GoogleConfig: defaultGoogleOptions,
1012− LoginURLParameters: defaultURLParams,
1013− UseSystemTrustStore: ptr.To(false),
1014− SkipClaimsFromProfileURL: ptr.To(false),
1015− }
1016−
1017986 internalConfigProvider := Provider{
1018− ID: "google=" + clientID,
1019− ClientID: clientID,
1020− Type: "google",
1021− OIDCConfig: defaultOIDCOptions,
987+ ID: "google=" + clientID,
988+ ClientID: clientID,
989+ Type: "google",
1022990 GoogleConfig: GoogleOptions{
1023− AdminEmail: "email@email.com",
1024− ServiceAccountJSON: "test.json",
1025− Groups: []string{"1", "2"},
1026− UseOrganizationID: ptr.To(false),
1027− UseApplicationDefaultCredentials: ptr.To(false),
991+ AdminEmail: "email@email.com",
992+ ServiceAccountJSON: "test.json",
993+ Groups: []string{"1", "2"},
1028994 },
1029− LoginURLParameters: defaultURLParams,
1030− UseSystemTrustStore: ptr.To(false),
1031− SkipClaimsFromProfileURL: ptr.To(false),
995+ LoginURLParameters: defaultURLParams,
1032996 }
1033997
1034998 internalConfigLegacyProvider := LegacyProvider{
pkg/apis/options/load.go+3−3
@@ -95,10 +95,10 @@ func Decode(input interface{}, result interface{}) error {
9595 ),
9696 Metadata: nil, // Don't track any metadata
9797 Result: result, // Decode the result into the prefilled options
98− TagName: "yaml", // Parse all fields that use the yaml tag
98+ TagName: "yaml", // Parse all fields that use the json tag
9999 ZeroFields: false, // Don't clean the default values from the result map (options)
100100 ErrorUnused: true, // Throw an error if keys have been used that aren't mapped to any struct fields
101− IgnoreUntaggedFields: true, // Ignore fields in structures that aren't tagged with yaml
101+ IgnoreUntaggedFields: true, // Ignore fields in structures that aren't tagged with json
102102 })
103103 if err != nil {
104104 return fmt.Errorf("error creating decoder for config: %w", err)
@@ -145,7 +145,7 @@ func loadAndSubstituteEnvs(configFileName string) ([]byte, error) {
145145func registerFlags(v *viper.Viper, prefix string, flagSet *pflag.FlagSet, options interface{}) error {
146146 val := reflect.ValueOf(options)
147147 var typ reflect.Type
148− if val.Kind() == reflect.Pointer {
148+ if val.Kind() == reflect.Ptr {
149149 typ = val.Elem().Type()
150150 } else {
151151 typ = val.Type()
pkg/apis/options/load_test.go+2−2
@@ -282,7 +282,7 @@ var _ = Describe("Load", func() {
282282 Entry("with an invalid config file", &testOptionsTableInput{
283283 configFile: []byte(`slice_option = foo`),
284284 flagSet: func() *pflag.FlagSet { return testOptionsFlagSet },
285− expectedErr: fmt.Errorf("unable to load config file: While parsing config: toml: expected keyword \"false\""),
285+ expectedErr: fmt.Errorf("unable to load config file: While parsing config: toml: expected 'false'"),
286286 expectedOutput: &TestOptions{},
287287 }),
288288 Entry("with an invalid flagset", &testOptionsTableInput{
@@ -329,7 +329,7 @@ var _ = Describe("Load", func() {
329329 Entry("with an unknown option in the config file", &testOptionsTableInput{
330330 configFile: []byte(`unknown_option="foo"`),
331331 flagSet: func() *pflag.FlagSet { return testOptionsFlagSet },
332− expectedErr: fmt.Errorf("error unmarshalling config: decoding failed due to the following error(s):\n\n'options.TestOptions' has invalid keys: unknown_option"),
332+ expectedErr: fmt.Errorf("error unmarshalling config: decoding failed due to the following error(s):\n\n'' has invalid keys: unknown_option"),
333333 // Viper will unmarshal before returning the error, so this is the default output
334334 expectedOutput: &TestOptions{
335335 StringOption: "default",
pkg/apis/options/options.go−2
@@ -24,7 +24,6 @@ type Options struct {
2424 ReadyPath string `flag:"ready-path" cfg:"ready_path"`
2525 ReverseProxy bool `flag:"reverse-proxy" cfg:"reverse_proxy"`
2626 RealClientIPHeader string `flag:"real-client-ip-header" cfg:"real_client_ip_header"`
27− TrustedProxyIPs []string `flag:"trusted-proxy-ip" cfg:"trusted_proxy_ips"`
2827 TrustedIPs []string `flag:"trusted-ip" cfg:"trusted_ips"`
2928 ForceHTTPS bool `flag:"force-https" cfg:"force_https"`
3029 RawRedirectURL string `flag:"redirect-url" cfg:"redirect_url"`
@@ -120,7 +119,6 @@ func NewFlagSet() *pflag.FlagSet {
120119
121120 flagSet.Bool("reverse-proxy", false, "are we running behind a reverse proxy, controls whether headers like X-Real-Ip are accepted")
122121 flagSet.String("real-client-ip-header", "X-Real-IP", "Header used to determine the real IP of the client (one of: X-Forwarded-For, X-Real-IP, X-ProxyUser-IP, X-Envoy-External-Address, or CF-Connecting-IP)")
123− flagSet.StringSlice("trusted-proxy-ip", []string{}, "list of IPs or CIDR ranges that are allowed to set X-Forwarded-* headers when --reverse-proxy is enabled. Defaults to trusting all IPs for backwards compatibility; configure this to your reverse proxy addresses to prevent header spoofing.")
124122 flagSet.StringSlice("trusted-ip", []string{}, "list of IPs or CIDR ranges to allow to bypass authentication. WARNING: trusting by IP has inherent security flaws, read the configuration documentation for more information.")
125123 flagSet.Bool("force-https", false, "force HTTPS redirect for HTTP requests")
126124 flagSet.String("redirect-url", "", "the OAuth Redirect URL. ie: \"https://internalapp.yourcompany.com/oauth2/callback\"")
pkg/apis/options/providers.go+13−35
@@ -37,17 +37,13 @@ const (
3737 // for MicrosoftEntraIDOptions.FederatedTokenAuth
3838 DefaultMicrosoftEntraIDUseFederatedToken bool = false
3939
40− // DefaultGoogleUseOrganizationID is the default value
41− // for GoogleOptions.UseOrganizationID
42− DefaultGoogleUseOrganizationID bool = false
43−
4440 // DefaultGoogleUseApplicationDefaultCredentials is the default values
4541 // for GoogleOptions.UseApplicationDefaultCredentials
4642 DefaultUseApplicationDefaultCredentials bool = false
4743
4844 // DefaultUseSystemTrustStore is the default value
4945 // for Provider.UseSystemTrustStore
50− DefaultUseSystemTrustStore bool = false
46+ DefaultUseSystemTrustStore bool = true
5147)
5248
5349// OIDCAudienceClaims is the generic audience claim list used by the OIDC provider.
@@ -134,9 +130,6 @@ type Provider struct {
134130 // The code challenge method
135131 CodeChallengeMethod string `yaml:"code_challenge_method,omitempty"`
136132
137− // Additional claims to be obtained from the upstream IDP, either from the id_token or from the userinfo endpoint if configured.
138− AdditionalClaims []string `yaml:"additionalClaims,omitempty"`
139−
140133 // URL to call to perform backend logout, `{id_token}` would be replaced by the actual `id_token` if available in the session
141134 BackendLogoutURL string `yaml:"backendLogoutURL"`
142135}
@@ -151,9 +144,6 @@ const (
151144 // ADFSProvider is the provider type for ADFS
152145 ADFSProvider ProviderType = "adfs"
153146
154− // AtlassianProvider is the provider type for Atlassian Cloud
155− AtlassianProvider ProviderType = "atlassian"
156−
157147 // AzureProvider is the provider type for Azure
158148 AzureProvider ProviderType = "azure"
159149
@@ -169,9 +159,6 @@ const (
169159 // DigitalOceanProvider is the provider type for DigitalOcean
170160 DigitalOceanProvider ProviderType = "digitalocean"
171161
172− // DTTSSOProvider is the provider type for the DTT SSO
173− DTTSSOProvider ProviderType = "dtt-sso"
174−
175162 // FacebookProvider is the provider type for Facebook
176163 FacebookProvider ProviderType = "facebook"
177164
@@ -282,7 +269,7 @@ type GoogleOptions struct {
282269 // TargetPrincipal is the Google Service Account used for Application Default Credentials
283270 TargetPrincipal string `yaml:"targetPrincipal,omitempty"`
284271 // UseOrganizationId indicates whether to use the organization ID as the UserName claim
285− UseOrganizationID *bool `yaml:"useOrganizationID,omitempty"`
272+ UseOrganizationID bool `yaml:"useOrganizationID,omitempty"`
286273 // admin scope needed for fetching user organization information from admin api, can be one of cloud, user or defaults to readonly
287274 AdminAPIUserScope string `yaml:"adminAPIUserScope,omitempty"`
288275}
@@ -327,11 +314,6 @@ type OIDCOptions struct {
327314 // ExtraAudiences is a list of additional audiences that are allowed
328315 // to pass verification in addition to the client id.
329316 ExtraAudiences []string `yaml:"extraAudiences,omitempty"`
330− // EnabledSigningAlgs is a list of allowed JWT signing algorithms.
331− // When discovery is enabled, the effective set is the intersection
332− // between this list and the provider's discovered supported algorithms.
333− // By default `RS256` is used if nothing has been discovered or specified.
334− EnabledSigningAlgs []string `yaml:"enabledSigningAlgs,omitempty"`
335317}
336318
337319type LoginGovOptions struct {
@@ -352,9 +334,9 @@ func providerDefaults() Providers {
352334 Tenant: "common",
353335 },
354336 OIDCConfig: OIDCOptions{
355− InsecureAllowUnverifiedEmail: ptr.To(DefaultInsecureAllowUnverifiedEmail),
356− InsecureSkipNonce: ptr.To(DefaultInsecureSkipNonce),
357− SkipDiscovery: ptr.To(DefaultSkipDiscovery),
337+ InsecureAllowUnverifiedEmail: ptr.Ptr(DefaultInsecureAllowUnverifiedEmail),
338+ InsecureSkipNonce: ptr.Ptr(DefaultInsecureSkipNonce),
339+ SkipDiscovery: ptr.Ptr(DefaultSkipDiscovery),
358340 UserIDClaim: OIDCEmailClaim, // Deprecated: Use OIDCEmailClaim
359341 EmailClaim: OIDCEmailClaim,
360342 GroupsClaim: OIDCGroupsClaim,
@@ -376,10 +358,10 @@ func (p Providers) EnsureDefaults() {
376358// EnsureDefaults sets any default values for Provider fields.
377359func (p *Provider) EnsureDefaults() {
378360 if p.SkipClaimsFromProfileURL == nil {
379− p.SkipClaimsFromProfileURL = ptr.To(DefaultSkipClaimsFromProfileURL)
361+ p.SkipClaimsFromProfileURL = ptr.Ptr(DefaultSkipClaimsFromProfileURL)
380362 }
381363 if p.UseSystemTrustStore == nil {
382− p.UseSystemTrustStore = ptr.To(DefaultUseSystemTrustStore)
364+ p.UseSystemTrustStore = ptr.Ptr(DefaultUseSystemTrustStore)
383365 }
384366
385367 p.OIDCConfig.EnsureDefaults()
@@ -392,13 +374,13 @@ func (p *Provider) EnsureDefaults() {
392374func (o *OIDCOptions) EnsureDefaults() {
393375 // Ensure OIDC defaults
394376 if o.InsecureAllowUnverifiedEmail == nil {
395− o.InsecureAllowUnverifiedEmail = ptr.To(DefaultInsecureAllowUnverifiedEmail)
377+ o.InsecureAllowUnverifiedEmail = ptr.Ptr(DefaultInsecureAllowUnverifiedEmail)
396378 }
397379 if o.InsecureSkipNonce == nil {
398− o.InsecureSkipNonce = ptr.To(DefaultInsecureSkipNonce)
380+ o.InsecureSkipNonce = ptr.Ptr(DefaultInsecureSkipNonce)
399381 }
400382 if o.SkipDiscovery == nil {
401− o.SkipDiscovery = ptr.To(DefaultSkipDiscovery)
383+ o.SkipDiscovery = ptr.Ptr(DefaultSkipDiscovery)
402384 }
403385 if o.UserIDClaim == "" {
404386 o.UserIDClaim = OIDCEmailClaim
@@ -417,24 +399,20 @@ func (o *OIDCOptions) EnsureDefaults() {
417399// EnsureDefaults sets any default values for MicrosoftEntraIDOptions fields.
418400func (me *MicrosoftEntraIDOptions) EnsureDefaults() {
419401 if me.FederatedTokenAuth == nil {
420− me.FederatedTokenAuth = ptr.To(DefaultMicrosoftEntraIDUseFederatedToken)
402+ me.FederatedTokenAuth = ptr.Ptr(DefaultMicrosoftEntraIDUseFederatedToken)
421403 }
422404}
423405
424406// EnsureDefaults sets any default values for ADFSOptions fields.
425407func (a *ADFSOptions) EnsureDefaults() {
426408 if a.SkipScope == nil {
427− a.SkipScope = ptr.To(DefaultADFSSkipScope)
409+ a.SkipScope = ptr.Ptr(DefaultADFSSkipScope)
428410 }
429411}
430412
431413// EnsureDefaults sets any default values for GoogleOptions fields.
432414func (g *GoogleOptions) EnsureDefaults() {
433− if g.UseOrganizationID == nil {
434− g.UseOrganizationID = ptr.To(DefaultGoogleUseOrganizationID)
435− }
436−
437415 if g.UseApplicationDefaultCredentials == nil {
438− g.UseApplicationDefaultCredentials = ptr.To(DefaultUseApplicationDefaultCredentials)
416+ g.UseApplicationDefaultCredentials = ptr.Ptr(DefaultUseApplicationDefaultCredentials)
439417 }
440418}
pkg/apis/options/server.go−9
@@ -3,19 +3,10 @@ package options
33// Server represents the configuration for an HTTP(S) server
44type Server struct {
55 // BindAddress is the address on which to serve traffic.
6− // Different types of bind addresses are supported:
7− // * `[http://]<addr>:<port>`
8− // * `fd:<int>` (case insensitive)
9− // * `unix://<path>`
10− // Unix sockets are created with default system umask mode, which can be overridden, e.g.: `unix://my-socket,mode=0777`
11− // Square brackets are required for ipv6 address, e.g. `http://[::1]:4180`
126 // Leave blank or set to "-" to disable.
137 BindAddress string `yaml:"bindAddress,omitempty"`
148
159 // SecureBindAddress is the address on which to serve secure traffic.
16− // Secure bind addresses need to respond with valid SSL and use the following format:
17− // * `[https://]<addr>:<port>`
18− // Square brackets are required for ipv6 address, e.g. `https://[::1]:4180`
1910 // Leave blank or set to "-" to disable.
2011 SecureBindAddress string `yaml:"secureBindAddress,omitempty"`
2112
pkg/apis/options/upstreams.go+15−35
@@ -29,15 +29,9 @@ const (
2929 // DefaultUpstreamPassHostHeader determines if upstreams will pass the host header by default.
3030 DefaultUpstreamPassHostHeader bool = true
3131
32− // Static upstreams cannot pass the host header.
33− DefaultStaticPassHostHeader bool = false
34−
3532 // DefaultUpstreamProxyWebSockets determines if upstreams will proxy websockets by default.
3633 DefaultUpstreamProxyWebSockets bool = true
3734
38− // Static upstreams cannot proxy websockets.
39− DefaultStaticProxyWebSockets bool = false
40−
4135 // DefaultUpstreamDisableKeepAlives determines if upstreams will disable keep-alives by default.
4236 DefaultUpstreamDisableKeepAlives bool = false
4337)
@@ -62,14 +56,12 @@ type Upstream struct {
6256
6357 // Path is used to map requests to the upstream server.
6458 // The closest match will take precedence and all Paths must be unique.
65− // Without RewriteTarget, Path follows gorilla/mux route syntax.
59+ // Path can also take a pattern when used with RewriteTarget.
60+ // Path segments can be captured and matched using regular experessions.
6661 // Eg:
67− // - `/foo`: Match only the explicit path `/foo`
68− // - `/bar/`: Match any path prefixed with `/bar/`
69− // - `/baz/{path:.*}`: Match any path prefixed with `/baz/`
70− // When RewriteTarget is set, Path is treated as a regular expression.
71− // Eg: `^/baz/(.*)$` matches any path prefixed with `/baz` and captures the
72− // remaining path for use with RewriteTarget.
62+ // - `^/foo$`: Match only the explicit path `/foo`
63+ // - `^/bar/$`: Match any path prefixed with `/bar/`
64+ // - `^/baz/(.*)$`: Match any path prefixed with `/baz` and capture the remaining path for use with RewriteTarget
7365 Path string `yaml:"path,omitempty"`
7466
7567 // RewriteTarget allows users to rewrite the request path before it is sent to
@@ -136,7 +128,7 @@ type Upstream struct {
136128// EnsureDefaults sets any default values for UpstreamConfig fields.
137129func (uc *UpstreamConfig) EnsureDefaults() {
138130 if uc.ProxyRawPath == nil {
139− uc.ProxyRawPath = ptr.To(DefaultUpstreamProxyRawPath)
131+ uc.ProxyRawPath = ptr.Ptr(DefaultUpstreamProxyRawPath)
140132 }
141133 for i := range uc.Upstreams {
142134 uc.Upstreams[i].EnsureDefaults()
@@ -146,36 +138,24 @@ func (uc *UpstreamConfig) EnsureDefaults() {
146138// EnsureDefaults sets any default values for Upstream fields.
147139func (u *Upstream) EnsureDefaults() {
148140 if u.InsecureSkipTLSVerify == nil {
149− u.InsecureSkipTLSVerify = ptr.To(DefaultUpsteamInsecureSkipTLSVerify)
141+ u.InsecureSkipTLSVerify = ptr.Ptr(DefaultUpsteamInsecureSkipTLSVerify)
150142 }
151143 if u.Static == nil {
152− u.Static = ptr.To(DefaultUpstreamStatic)
144+ u.Static = ptr.Ptr(DefaultUpstreamStatic)
145+ }
146+ if u.FlushInterval == nil {
147+ u.FlushInterval = ptr.Ptr(DefaultUpstreamFlushInterval)
153148 }
154149 if u.PassHostHeader == nil {
155− u.PassHostHeader = ptr.To(DefaultUpstreamPassHostHeader)
150+ u.PassHostHeader = ptr.Ptr(DefaultUpstreamPassHostHeader)
156151 }
157152 if u.ProxyWebSockets == nil {
158− u.ProxyWebSockets = ptr.To(DefaultUpstreamProxyWebSockets)
159− }
160− if u.FlushInterval == nil {
161− u.FlushInterval = ptr.To(DefaultUpstreamFlushInterval)
153+ u.ProxyWebSockets = ptr.Ptr(DefaultUpstreamProxyWebSockets)
162154 }
163155 if u.Timeout == nil {
164− u.Timeout = ptr.To(DefaultUpstreamTimeout)
156+ u.Timeout = ptr.Ptr(DefaultUpstreamTimeout)
165157 }
166158 if u.DisableKeepAlives == nil {
167− u.DisableKeepAlives = ptr.To(DefaultUpstreamDisableKeepAlives)
168− }
169−
170− // Force defaults compatible with static upstreams.
171− // This overrides any user provided values to ensure static upstreams behave correctly.
172− if ptr.Deref(u.Static, DefaultUpstreamStatic) {
173− u.URI = ""
174− u.InsecureSkipTLSVerify = ptr.To(DefaultUpsteamInsecureSkipTLSVerify)
175− u.DisableKeepAlives = ptr.To(DefaultUpstreamDisableKeepAlives)
176− u.PassHostHeader = ptr.To(DefaultStaticPassHostHeader)
177− u.ProxyWebSockets = ptr.To(DefaultStaticProxyWebSockets)
178− u.FlushInterval = ptr.To(DefaultUpstreamFlushInterval)
179− u.Timeout = ptr.To(DefaultUpstreamTimeout)
159+ u.DisableKeepAlives = ptr.Ptr(DefaultUpstreamDisableKeepAlives)
180160 }
181161}
pkg/apis/sessions/session_state.go+1−17
@@ -8,7 +8,6 @@ import (
88 "time"
99
1010 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/encryption"
11− "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/util"
1211 "github.com/pierrec/lz4/v4"
1312 "github.com/vmihailenco/msgpack/v5"
1413)
@@ -29,9 +28,6 @@ type SessionState struct {
2928 Groups []string `msgpack:"g,omitempty"`
3029 PreferredUsername string `msgpack:"pu,omitempty"`
3130
32− // Additional claims
33− AdditionalClaims map[string]interface{} `msgpack:"ac,omitempty"`
34−
3531 // Internal helpers, not serialized
3632 Clock func() time.Time `msgpack:"-"` // override for time.Now, for testing
3733 Lock Lock `msgpack:"-"`
@@ -127,8 +123,6 @@ func (s *SessionState) String() string {
127123 }
128124 if s.RefreshToken != "" {
129125 o += " refresh_token:true"
130− } else {
131− o += " refresh_token:false"
132126 }
133127 if len(s.Groups) > 0 {
134128 o += fmt.Sprintf(" groups:%v", s.Groups)
@@ -162,18 +156,8 @@ func (s *SessionState) GetClaim(claim string) []string {
162156 case "preferred_username":
163157 return []string{s.PreferredUsername}
164158 default:
165− return s.getAdditionalClaim(claim)
166− }
167−}
168−
169−func (s *SessionState) getAdditionalClaim(claim string) []string {
170− if value, ok := s.AdditionalClaims[claim]; ok {
171− var result []string
172− if err := util.CoerceClaim(value, &result); err == nil {
173− return result
174− }
159+ return []string{}
175160 }
176− return []string{}
177161}
178162
179163// CheckNonce compares the Nonce against a potential hash of it
pkg/apis/sessions/session_state_test.go+12−102
@@ -4,17 +4,19 @@ import (
44 "crypto/rand"
55 "fmt"
66 "io"
7− "strings"
87 "testing"
98 "time"
109
1110 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/encryption"
12− "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/util/ptr"
1311 . "github.com/onsi/gomega"
1412 "github.com/stretchr/testify/assert"
1513 "github.com/stretchr/testify/require"
1614)
1715
16+func timePtr(t time.Time) *time.Time {
17+ return &t
18+}
19+
1820func TestCreatedAtNow(t *testing.T) {
1921 g := NewWithT(t)
2022 ss := &SessionState{}
@@ -58,7 +60,7 @@ func TestString(t *testing.T) {
5860 User: "some.user",
5961 PreferredUsername: "preferred.user",
6062 },
61− expected: "Session{email:email@email.email user:some.user PreferredUsername:preferred.user refresh_token:false}",
63+ expected: "Session{email:email@email.email user:some.user PreferredUsername:preferred.user}",
6264 },
6365 {
6466 name: "Full Session",
@@ -82,7 +84,7 @@ func TestString(t *testing.T) {
8284 PreferredUsername: "preferred.user",
8385 CreatedAt: &created,
8486 },
85− expected: "Session{email:email@email.email user:some.user PreferredUsername:preferred.user created:2000-01-01 00:00:00 +0000 UTC refresh_token:false}",
87+ expected: "Session{email:email@email.email user:some.user PreferredUsername:preferred.user created:2000-01-01 00:00:00 +0000 UTC}",
8688 },
8789 {
8890 name: "With an ExpiresOn",
@@ -92,7 +94,7 @@ func TestString(t *testing.T) {
9294 PreferredUsername: "preferred.user",
9395 ExpiresOn: &expires,
9496 },
95− expected: "Session{email:email@email.email user:some.user PreferredUsername:preferred.user expires:2000-01-01 01:00:00 +0000 UTC refresh_token:false}",
97+ expected: "Session{email:email@email.email user:some.user PreferredUsername:preferred.user expires:2000-01-01 01:00:00 +0000 UTC}",
9698 },
9799 {
98100 name: "With an AccessToken",
@@ -102,7 +104,7 @@ func TestString(t *testing.T) {
102104 PreferredUsername: "preferred.user",
103105 AccessToken: "access.token",
104106 },
105− expected: "Session{email:email@email.email user:some.user PreferredUsername:preferred.user token:true refresh_token:false}",
107+ expected: "Session{email:email@email.email user:some.user PreferredUsername:preferred.user token:true}",
106108 },
107109 {
108110 name: "With an IDToken",
@@ -112,7 +114,7 @@ func TestString(t *testing.T) {
112114 PreferredUsername: "preferred.user",
113115 IDToken: "id.token",
114116 },
115− expected: "Session{email:email@email.email user:some.user PreferredUsername:preferred.user id_token:true refresh_token:false}",
117+ expected: "Session{email:email@email.email user:some.user PreferredUsername:preferred.user id_token:true}",
116118 },
117119 {
118120 name: "With a RefreshToken",
@@ -135,10 +137,10 @@ func TestString(t *testing.T) {
135137}
136138
137139func TestIsExpired(t *testing.T) {
138− s := &SessionState{ExpiresOn: ptr.To(time.Now().Add(time.Duration(-1) * time.Minute))}
140+ s := &SessionState{ExpiresOn: timePtr(time.Now().Add(time.Duration(-1) * time.Minute))}
139141 assert.Equal(t, true, s.IsExpired())
140142
141− s = &SessionState{ExpiresOn: ptr.To(time.Now().Add(time.Duration(1) * time.Minute))}
143+ s = &SessionState{ExpiresOn: timePtr(time.Now().Add(time.Duration(1) * time.Minute))}
142144 assert.Equal(t, false, s.IsExpired())
143145
144146 s = &SessionState{}
@@ -152,7 +154,7 @@ func TestAge(t *testing.T) {
152154 assert.Equal(t, time.Duration(0), ss.Age())
153155
154156 // Set CreatedAt to 1 hour ago
155− ss.CreatedAt = ptr.To(time.Now().Add(-1 * time.Hour))
157+ ss.CreatedAt = timePtr(time.Now().Add(-1 * time.Hour))
156158 assert.Equal(t, time.Hour, ss.Age().Round(time.Minute))
157159}
158160
@@ -223,23 +225,6 @@ func TestEncodeAndDecodeSessionState(t *testing.T) {
223225 Nonce: []byte("abcdef1234567890abcdef1234567890"),
224226 Groups: []string{"group-a", "group-b"},
225227 },
226− "With additional claims": {
227− Email: "username@example.com",
228− User: "username",
229− PreferredUsername: "preferred.username",
230− AccessToken: "AccessToken.12349871293847fdsaihf9238h4f91h8fr.1349f831y98fd7",
231− IDToken: "IDToken.12349871293847fdsaihf9238h4f91h8fr.1349f831y98fd7",
232− CreatedAt: &created,
233− ExpiresOn: &expires,
234− RefreshToken: "RefreshToken.12349871293847fdsaihf9238h4f91h8fr.1349f831y98fd7",
235− Nonce: []byte("abcdef1234567890abcdef1234567890"),
236− Groups: []string{"group-a", "group-b"},
237− AdditionalClaims: map[string]interface{}{
238− "custom_claim_1": "value1",
239− "custom_claim_2": true,
240− "custom_claim_3": []interface{}{"item1", "item2"},
241− },
242− },
243228 }
244229
245230 for _, secretSize := range []int{16, 24, 32} {
@@ -307,78 +292,3 @@ func compareSessionStates(t *testing.T, expected *SessionState, actual *SessionS
307292 act.ExpiresOn = nil
308293 assert.Equal(t, exp, act)
309294}
310−
311−func TestGetClaim(t *testing.T) {
312− createdAt := time.Now()
313− expiresOn := createdAt.Add(1 * time.Hour)
314−
315− ss := &SessionState{
316− CreatedAt: &createdAt,
317− ExpiresOn: &expiresOn,
318− AccessToken: "AccessToken.12349871293847fdsaihf9238h4f91h8fr.1349f831y98fd7",
319− IDToken: "IDToken.12349871293847fdsaihf9238h4f91h8fr.1349f831y98fd7",
320− RefreshToken: "RefreshToken.12349871293847fdsaihf9238h4f91h8fr.1349f831y98fd7",
321− Email: "user@example.com",
322− User: "user123",
323− Groups: []string{"group1", "group2"},
324− PreferredUsername: "preferred_user",
325− AdditionalClaims: map[string]interface{}{
326− "custom_claim_1": "value1",
327− "custom_claim_2": true,
328− "custom_claim_3": []string{"item1", "item2"},
329− },
330− }
331−
332− tests := []struct {
333− claim string
334− want []string
335− }{
336− {"access_token", []string{"AccessToken.12349871293847fdsaihf9238h4f91h8fr.1349f831y98fd7"}},
337− {"id_token", []string{"IDToken.12349871293847fdsaihf9238h4f91h8fr.1349f831y98fd7"}},
338− {"refresh_token", []string{"RefreshToken.12349871293847fdsaihf9238h4f91h8fr.1349f831y98fd7"}},
339− {"created_at", []string{createdAt.String()}},
340− {"expires_on", []string{expiresOn.String()}},
341− {"email", []string{"user@example.com"}},
342− {"user", []string{"user123"}},
343− {"groups", []string{"group1", "group2"}},
344− {"preferred_username", []string{"preferred_user"}},
345− {"custom_claim_1", []string{"value1"}},
346− {"custom_claim_2", []string{"true"}},
347− {"custom_claim_3", []string{"[\"item1\",\"item2\"]"}},
348− }
349−
350− for _, tt := range tests {
351− t.Run(tt.claim, func(t *testing.T) {
352− gs := NewWithT(t)
353− gs.Expect(ss.GetClaim(tt.claim)).To(Equal(tt.want))
354− })
355− }
356−}
357−
358−func TestSessionState_String_RefreshTokenFalse(t *testing.T) {
359− session := &SessionState{
360− Email: "test@example.com",
361− User: "testuser",
362− // No RefreshToken set
363− }
364−
365− result := session.String()
366−
367− if !strings.Contains(result, "refresh_token:false") {
368− t.Errorf("Expected 'refresh_token:false' in output, got: %s", result)
369− }
370−}
371−
372−func TestSessionState_String_RefreshTokenTrue(t *testing.T) {
373− session := &SessionState{
374− Email: "test@example.com",
375− User: "testuser",
376− RefreshToken: "some-token",
377− }
378−
379− result := session.String()
380−
381− if !strings.Contains(result, "refresh_token:true") {
382− t.Errorf("Expected 'refresh_token:true' in output, got: %s", result)
383− }
384−}
pkg/app/redirect/director_test.go+2−33
@@ -4,7 +4,6 @@ import (
44 "net/http"
55
66 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/middleware"
7− "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/ip"
87 . "github.com/onsi/ginkgo/v2"
98 . "github.com/onsi/gomega"
109)
@@ -34,16 +33,9 @@ var _ = Describe("Director Suite", func() {
3433 req.Header.Add(header, value)
3534 }
3635 }
37− scope := &middleware.RequestScope{
36+ req = middleware.AddRequestScope(req, &middleware.RequestScope{
3837 ReverseProxy: in.reverseProxy,
39− }
40− if in.reverseProxy {
41− req.RemoteAddr = "127.0.0.1:4180"
42− trustedProxies, err := ip.ParseNetSet([]string{"127.0.0.1"})
43− Expect(err).ToNot(HaveOccurred())
44− scope.TrustedProxies = trustedProxies
45− }
46− req = middleware.AddRequestScope(req, scope)
38+ })
4739
4840 redirect, err := appDirector.GetRedirect(req)
4941 Expect(err).ToNot(HaveOccurred())
@@ -182,27 +174,4 @@ var _ = Describe("Director Suite", func() {
182174 expectedRedirect: "https://a-service.example.com/foo/bar",
183175 }),
184176 )
185−
186− It("ignores forwarded headers from an untrusted remote address", func() {
187− appDirector := NewAppDirector(AppDirectorOpts{
188− ProxyPrefix: testProxyPrefix,
189− Validator: testValidator(true),
190− })
191−
192− req, _ := http.NewRequest("GET", "https://oauth.example.com/foo?bar", nil)
193− req.RemoteAddr = "192.0.2.10:4180"
194− req.Header.Add("X-Forwarded-Proto", "https")
195− req.Header.Add("X-Forwarded-Host", "a-service.example.com")
196− req.Header.Add("X-Forwarded-Uri", fooBar)
197− trustedProxies, err := ip.ParseNetSet([]string{"127.0.0.1"})
198− Expect(err).ToNot(HaveOccurred())
199− req = middleware.AddRequestScope(req, &middleware.RequestScope{
200− ReverseProxy: true,
201− TrustedProxies: trustedProxies,
202− })
203−
204− redirect, err := appDirector.GetRedirect(req)
205− Expect(err).ToNot(HaveOccurred())
206− Expect(redirect).To(Equal("/foo?bar"))
207− })
208177})
pkg/authentication/hmacauth/hmacauth_test.go+1−1
@@ -286,7 +286,7 @@ func TestSendAuthenticatedPostRequestToServer(t *testing.T) {
286286 upstream := httptest.NewServer(
287287 http.HandlerFunc(authenticator.Authenticate))
288288
289− req, err := http.NewRequest(http.MethodPost, upstream.URL+"/foo/bar",
289+ req, err := http.NewRequest("POST", upstream.URL+"/foo/bar",
290290 io.NopCloser(&fakeNetConn{reqBody: payload}))
291291 if err != nil {
292292 panic(err)
pkg/cookies/cookies.go+8−18
@@ -7,24 +7,14 @@ import (
77 "strings"
88 "time"
99
10+ "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/options"
1011 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/logger"
1112 requestutil "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/requests/util"
1213)
1314
14−type CookieOptions struct {
15− Name string
16− Value string
17− Domains []string
18− Expiration time.Duration
19− SameSite string
20− Path string
21− HTTPOnly bool
22− Secure bool
23−}
24−
2515// MakeCookieFromOptions constructs a cookie based on the given *options.CookieOptions,
2616// value and creation time
27−func MakeCookieFromOptions(req *http.Request, opts *CookieOptions) *http.Cookie {
17+func MakeCookieFromOptions(req *http.Request, name string, value string, opts *options.Cookie, expiration time.Duration) *http.Cookie {
2818 domain := GetCookieDomain(req, opts.Domains)
2919 // If nothing matches, create the cookie with the shortest domain
3020 if domain == "" && len(opts.Domains) > 0 {
@@ -36,8 +26,8 @@ func MakeCookieFromOptions(req *http.Request, opts *CookieOptions) *http.Cookie
3626 }
3727
3828 c := &http.Cookie{
39− Name: opts.Name,
40− Value: opts.Value,
29+ Name: name,
30+ Value: value,
4131 Path: opts.Path,
4232 Domain: domain,
4333 HttpOnly: opts.HTTPOnly,
@@ -45,9 +35,9 @@ func MakeCookieFromOptions(req *http.Request, opts *CookieOptions) *http.Cookie
4535 SameSite: ParseSameSite(opts.SameSite),
4636 }
4737
48− if opts.Expiration > time.Duration(0) {
49− c.MaxAge = int(opts.Expiration.Seconds())
50− } else if opts.Expiration < time.Duration(0) {
38+ if expiration > time.Duration(0) {
39+ c.MaxAge = int(expiration.Seconds())
40+ } else if expiration < time.Duration(0) {
5141 c.MaxAge = -1
5242 }
5343
@@ -68,7 +58,7 @@ func GetCookieDomain(req *http.Request, cookieDomains []string) string {
6858 return ""
6959}
7060
71−// ParseSameSite a valid http.SameSite value from a user supplied string for use of making cookies.
61+// Parse a valid http.SameSite value from a user supplied string for use of making cookies.
7262func ParseSameSite(v string) http.SameSite {
7363 switch v {
7464 case "lax":
pkg/cookies/cookies_suite_test.go−4
@@ -17,10 +17,6 @@ const (
1717 cookieDomain = "o2p.cookies.test"
1818 cookiePath = "/cookie-tests"
1919
20− sameSiteLax = "lax"
21− sameSiteStrict = "strict"
22− sameSiteNone = "none"
23−
2420 nowEpoch = 1609366421
2521)
2622
pkg/cookies/cookies_test.go+51−39
@@ -5,8 +5,9 @@ import (
55 "net/http"
66 "time"
77
8+ "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/options"
9+
810 middlewareapi "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/middleware"
9− "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/ip"
1011 . "github.com/onsi/ginkgo/v2"
1112 . "github.com/onsi/gomega"
1213)
@@ -31,13 +32,8 @@ var _ = Describe("Cookie Tests", func() {
3132
3233 if in.xForwardedHost != "" {
3334 req.Header.Add("X-Forwarded-Host", in.xForwardedHost)
34− req.RemoteAddr = "127.0.0.1:4180"
35− trustedProxies, err := ip.ParseNetSet([]string{"127.0.0.1"})
36− Expect(err).ToNot(HaveOccurred())
37−
3835 req = middlewareapi.AddRequestScope(req, &middlewareapi.RequestScope{
39− ReverseProxy: true,
40− TrustedProxies: trustedProxies,
36+ ReverseProxy: true,
4137 })
4238 }
4339
@@ -86,12 +82,16 @@ var _ = Describe("Cookie Tests", func() {
8682 Context("MakeCookieFromOptions", func() {
8783 type makeCookieFromOptionsTableInput struct {
8884 host string
89− opts CookieOptions
85+ name string
86+ value string
87+ opts options.Cookie
88+ expiration time.Duration
9089 now time.Time
9190 expectedOutput int
9291 }
9392
9493 validName := "_oauth2_proxy"
94+ validSecret := "secretthirtytwobytes+abcdefghijk"
9595 domains := []string{"www.cookies.test"}
9696
9797 now := time.Now()
@@ -106,50 +106,62 @@ var _ = Describe("Cookie Tests", func() {
106106 )
107107 Expect(err).ToNot(HaveOccurred())
108108
109− Expect(MakeCookieFromOptions(req, &in.opts).MaxAge).To(Equal(in.expectedOutput))
109+ Expect(MakeCookieFromOptions(req, in.name, in.value, &in.opts, in.expiration).MaxAge).To(Equal(in.expectedOutput))
110110 },
111111 Entry("persistent cookie", makeCookieFromOptionsTableInput{
112− host: "www.cookies.test",
113− opts: CookieOptions{
114− Name: validName,
115− Value: "1",
116− Domains: domains,
117− Expiration: 15 * time.Minute,
118− SameSite: "",
119− Path: "",
120− HTTPOnly: false,
121− Secure: true,
112+ host: "www.cookies.test",
113+ name: validName,
114+ value: "1",
115+ opts: options.Cookie{
116+ Name: validName,
117+ Secret: validSecret,
118+ Domains: domains,
119+ Path: "",
120+ Expire: time.Hour,
121+ Refresh: 15 * time.Minute,
122+ Secure: true,
123+ HTTPOnly: false,
124+ SameSite: "",
122125 },
126+ expiration: 15 * time.Minute,
123127 now: now,
124128 expectedOutput: int((15 * time.Minute).Seconds()),
125129 }),
126130 Entry("persistent cookie to be cleared", makeCookieFromOptionsTableInput{
127− host: "www.cookies.test",
128− opts: CookieOptions{
129− Name: validName,
130− Value: "1",
131− Domains: domains,
132− Expiration: time.Hour * -1,
133− SameSite: "",
134− Path: "",
135− HTTPOnly: false,
136− Secure: true,
131+ host: "www.cookies.test",
132+ name: validName,
133+ value: "1",
134+ opts: options.Cookie{
135+ Name: validName,
136+ Secret: validSecret,
137+ Domains: domains,
138+ Path: "",
139+ Expire: time.Hour * -1,
140+ Refresh: 15 * time.Minute,
141+ Secure: true,
142+ HTTPOnly: false,
143+ SameSite: "",
137144 },
145+ expiration: time.Hour * -1,
138146 now: now,
139147 expectedOutput: -1,
140148 }),
141149 Entry("session cookie", makeCookieFromOptionsTableInput{
142− host: "www.cookies.test",
143− opts: CookieOptions{
144− Name: validName,
145− Value: "1",
146− Domains: domains,
147− Expiration: 0,
148− SameSite: "",
149− Path: "",
150− HTTPOnly: false,
151− Secure: true,
150+ host: "www.cookies.test",
151+ name: validName,
152+ value: "1",
153+ opts: options.Cookie{
154+ Name: validName,
155+ Secret: validSecret,
156+ Domains: domains,
157+ Path: "",
158+ Expire: 0,
159+ Refresh: 15 * time.Minute,
160+ Secure: true,
161+ HTTPOnly: false,
162+ SameSite: "",
152163 },
164+ expiration: 0,
153165 now: now,
154166 expectedOutput: expectedMaxAge,
155167 }),
pkg/cookies/csrf.go+15−34
@@ -134,15 +134,6 @@ func (c *csrf) SetSessionNonce(s *sessions.SessionState) {
134134 s.Nonce = c.OIDCNonce
135135}
136136
137−// getCSRFSameSite get the CSRF same site
138−func getCSRFSameSite(opts *options.Cookie) string {
139− sameSite := opts.CSRFSameSite
140− if sameSite == "" {
141− sameSite = opts.SameSite
142− }
143− return sameSite
144−}
145−
146137// SetCookie encodes the CSRF to a signed cookie and sets it on the ResponseWriter
147138func (c *csrf) SetCookie(rw http.ResponseWriter, req *http.Request) (*http.Cookie, error) {
148139 encoded, err := c.encodeCookie()
@@ -150,18 +141,13 @@ func (c *csrf) SetCookie(rw http.ResponseWriter, req *http.Request) (*http.Cooki
150141 return nil, err
151142 }
152143
153− csrfCookieOptions := &CookieOptions{
154− Name: c.cookieName(),
155− Value: encoded,
156− Domains: c.cookieOpts.Domains,
157− Expiration: c.cookieOpts.CSRFExpire,
158− SameSite: getCSRFSameSite(c.cookieOpts),
159− Path: c.cookieOpts.Path,
160− HTTPOnly: c.cookieOpts.HTTPOnly,
161− Secure: c.cookieOpts.Secure,
162− }
163−
164− cookie := MakeCookieFromOptions(req, csrfCookieOptions)
144+ cookie := MakeCookieFromOptions(
145+ req,
146+ c.cookieName(),
147+ encoded,
148+ c.cookieOpts,
149+ c.cookieOpts.CSRFExpire,
150+ )
165151 http.SetCookie(rw, cookie)
166152
167153 return cookie, nil
@@ -211,18 +197,13 @@ func ClearExtraCsrfCookies(opts *options.Cookie, rw http.ResponseWriter, req *ht
211197
212198// ClearCookie removes the CSRF cookie
213199func (c *csrf) ClearCookie(rw http.ResponseWriter, req *http.Request) {
214− csrfCookieOptions := &CookieOptions{
215− Name: c.cookieName(),
216− Value: "",
217− Domains: c.cookieOpts.Domains,
218− Expiration: time.Hour * -1,
219− SameSite: getCSRFSameSite(c.cookieOpts),
220− Path: c.cookieOpts.Path,
221− HTTPOnly: c.cookieOpts.HTTPOnly,
222− Secure: c.cookieOpts.Secure,
223− }
224−
225− http.SetCookie(rw, MakeCookieFromOptions(req, csrfCookieOptions))
200+ http.SetCookie(rw, MakeCookieFromOptions(
201+ req,
202+ c.cookieName(),
203+ "",
204+ c.cookieOpts,
205+ time.Hour*-1,
206+ ))
226207}
227208
228209// encodeCookie MessagePack encodes and encrypts the CSRF and then creates a
@@ -253,7 +234,7 @@ func decodeCSRFCookie(cookie *http.Cookie, opts *options.Cookie) (*csrf, error)
253234 return nil, fmt.Errorf("error getting cookie secret: %v", err)
254235 }
255236
256− val, t, ok := encryption.Validate(cookie, secret, opts.CSRFExpire)
237+ val, t, ok := encryption.Validate(cookie, secret, opts.Expire)
257238 if !ok {
258239 return nil, errors.New("CSRF cookie failed validation")
259240 }
pkg/cookies/csrf_per_request_test.go+7−12
@@ -216,18 +216,13 @@ var _ = Describe("CSRF Cookie with non-fixed name Tests", func() {
216216 for _, csrf := range []*csrf{privateCSRF1, privateCSRF2, privateCSRF3} {
217217 encoded, err := csrf.encodeCookie()
218218 Expect(err).ToNot(HaveOccurred())
219− csrfCookieOptions := &CookieOptions{
220− Name: csrf.cookieName(),
221− Value: encoded,
222− Domains: csrf.cookieOpts.Domains,
223− Expiration: csrf.cookieOpts.CSRFExpire,
224− SameSite: getCSRFSameSite(csrf.cookieOpts),
225− Path: csrf.cookieOpts.Path,
226− HTTPOnly: csrf.cookieOpts.HTTPOnly,
227− Secure: csrf.cookieOpts.Secure,
228− }
229−
230− cookie := MakeCookieFromOptions(req, csrfCookieOptions)
219+ cookie := MakeCookieFromOptions(
220+ req,
221+ csrf.cookieName(),
222+ encoded,
223+ csrf.cookieOpts,
224+ csrf.cookieOpts.CSRFExpire,
225+ )
231226 cookies = append(cookies, fmt.Sprintf("%v=%v", cookie.Name, cookie.Value))
232227 }
233228
pkg/cookies/csrf_test.go+1−284
@@ -119,33 +119,9 @@ var _ = Describe("CSRF Cookie Tests", func() {
119119 Value: encoded,
120120 }
121121
122− _, _, valid := encryption.Validate(cookie, cookieOpts.Secret, cookieOpts.CSRFExpire)
122+ _, _, valid := encryption.Validate(cookie, cookieOpts.Secret, cookieOpts.Expire)
123123 Expect(valid).To(BeTrue())
124124 })
125−
126− It("validates CSRF token using CSRFExpire when Expire is lower", func() {
127− // Set Expire to be much lower than CSRFExpire
128− cookieOpts.Expire = time.Second
129− cookieOpts.CSRFExpire = time.Hour
130−
131− privateCSRF.OAuthState = []byte(csrfState)
132− privateCSRF.OIDCNonce = []byte(csrfNonce)
133−
134− encoded, err := privateCSRF.encodeCookie()
135− Expect(err).ToNot(HaveOccurred())
136−
137− cookie := &http.Cookie{
138− Name: privateCSRF.cookieName(),
139− Value: encoded,
140− }
141−
142− // The cookie should still be valid even though Expire is only 1 second
143− decoded, err := decodeCSRFCookie(cookie, cookieOpts)
144− Expect(err).ToNot(HaveOccurred())
145− Expect(decoded).ToNot(BeNil())
146− Expect(decoded.OAuthState).To(Equal([]byte(csrfState)))
147− Expect(decoded.OIDCNonce).To(Equal([]byte(csrfNonce)))
148− })
149125 })
150126
151127 Context("Cookie Management", func() {
@@ -278,263 +254,4 @@ var _ = Describe("CSRF Cookie Tests", func() {
278254 })
279255 })
280256 })
281−
282− Context("Test Cookie SameSite", func() {
283− var req *http.Request
284− var cookieOpts *options.Cookie
285−
286− testNow := time.Unix(nowEpoch, 0)
287−
288− BeforeEach(func() {
289− // we need to reset the time to ensure the cookie is valid
290− privateCSRF.clock = time.Now
291−
292− req = &http.Request{
293− Method: http.MethodGet,
294− Proto: "HTTP/1.1",
295− Host: cookieDomain,
296−
297− URL: &url.URL{
298− Scheme: "https",
299− Host: cookieDomain,
300− Path: cookiePath,
301− },
302− }
303−
304− cookieOpts = &options.Cookie{
305− Name: cookieName,
306− Secret: cookieSecret,
307− Domains: []string{cookieDomain},
308− Path: cookiePath,
309− Expire: time.Hour,
310− Secure: true,
311− HTTPOnly: true,
312− CSRFPerRequest: false,
313− CSRFExpire: time.Hour,
314− }
315− })
316−
317− It("Call SetCookie when CSRF SameSite is not defined. Expected result: CSRF cookie SameSite is the same as session cookie.", func() {
318− // prepare
319− cookieOpts.SameSite = sameSiteLax
320− CSRF, _ := NewCSRF(cookieOpts, "verifier")
321− rw := httptest.NewRecorder()
322− CSRF.(*csrf).clock = func() time.Time { return testNow }
323−
324− // test
325− _, err := CSRF.SetCookie(rw, req)
326−
327− // validate
328− Expect(err).ToNot(HaveOccurred())
329− Expect(rw.Header().Get("Set-Cookie")).To(ContainSubstring(
330− fmt.Sprintf(
331− "; Path=%s; Domain=%s; Max-Age=%d; HttpOnly; Secure; SameSite=Lax",
332− cookiePath,
333− cookieDomain,
334− int(cookieOpts.CSRFExpire.Seconds()),
335− ),
336− ))
337− })
338−
339− It("Call SetCookie when CSRF SameSite is an empty string. Expected result: CSRF cookie SameSite is the same as session cookie.", func() {
340− // prepare
341− cookieOpts.SameSite = sameSiteLax
342− cookieOpts.CSRFSameSite = ""
343− CSRF, _ := NewCSRF(cookieOpts, "verifier")
344− rw := httptest.NewRecorder()
345− CSRF.(*csrf).clock = func() time.Time { return testNow }
346−
347− // test
348− _, err := CSRF.SetCookie(rw, req)
349−
350− // validate
351− Expect(err).ToNot(HaveOccurred())
352− Expect(rw.Header().Get("Set-Cookie")).To(ContainSubstring(
353− fmt.Sprintf(
354− "; Path=%s; Domain=%s; Max-Age=%d; HttpOnly; Secure; SameSite=Lax",
355− cookiePath,
356− cookieDomain,
357− int(cookieOpts.CSRFExpire.Seconds()),
358− ),
359− ))
360− })
361−
362− It("Call SetCookie when CSRF SameSite is 'none'. Expected result: CSRF cookie SameSite is None.", func() {
363− // prepare
364− cookieOpts.SameSite = sameSiteLax
365− cookieOpts.CSRFSameSite = sameSiteNone
366− CSRF, _ := NewCSRF(cookieOpts, "verifier")
367− rw := httptest.NewRecorder()
368− CSRF.(*csrf).clock = func() time.Time { return testNow }
369−
370− // test
371− _, err := CSRF.SetCookie(rw, req)
372−
373− // validate
374− Expect(err).ToNot(HaveOccurred())
375− Expect(rw.Header().Get("Set-Cookie")).To(ContainSubstring(
376− fmt.Sprintf(
377− "; Path=%s; Domain=%s; Max-Age=%d; HttpOnly; Secure; SameSite=None",
378− cookiePath,
379− cookieDomain,
380− int(cookieOpts.CSRFExpire.Seconds()),
381− ),
382− ))
383− })
384−
385− It("Call SetCookie when CSRF SameSite is 'strict'. Expected result: CSRF cookie SameSite is Strict.", func() {
386− // prepare
387− cookieOpts.SameSite = sameSiteLax
388− cookieOpts.CSRFSameSite = sameSiteStrict
389− CSRF, _ := NewCSRF(cookieOpts, "verifier")
390− rw := httptest.NewRecorder()
391− CSRF.(*csrf).clock = func() time.Time { return testNow }
392−
393− // test
394− _, err := CSRF.SetCookie(rw, req)
395−
396− // validate
397− Expect(err).ToNot(HaveOccurred())
398− Expect(rw.Header().Get("Set-Cookie")).To(ContainSubstring(
399− fmt.Sprintf(
400− "; Path=%s; Domain=%s; Max-Age=%d; HttpOnly; Secure; SameSite=Strict",
401− cookiePath,
402− cookieDomain,
403− int(cookieOpts.CSRFExpire.Seconds()),
404− ),
405− ))
406− })
407−
408− It("Call SetCookie when CSRF SameSite is 'lax'. Expected result: CSRF cookie SameSite is Lax.", func() {
409− // prepare
410− cookieOpts.SameSite = sameSiteStrict
411− cookieOpts.CSRFSameSite = sameSiteLax
412− CSRF, _ := NewCSRF(cookieOpts, "verifier")
413− rw := httptest.NewRecorder()
414− CSRF.(*csrf).clock = func() time.Time { return testNow }
415−
416− // test
417− _, err := CSRF.SetCookie(rw, req)
418−
419− // validate
420− Expect(err).ToNot(HaveOccurred())
421− Expect(rw.Header().Get("Set-Cookie")).To(ContainSubstring(
422− fmt.Sprintf(
423− "; Path=%s; Domain=%s; Max-Age=%d; HttpOnly; Secure; SameSite=Lax",
424− cookiePath,
425− cookieDomain,
426− int(cookieOpts.CSRFExpire.Seconds()),
427− ),
428− ))
429− })
430−
431− It("Call ClearCookie when CSRF SameSite is not defined. Expected result: CSRF cookie SameSite is the same as session cookie.", func() {
432− // prepare
433− cookieOpts.SameSite = sameSiteLax
434− CSRF, _ := NewCSRF(cookieOpts, "verifier")
435− rw := httptest.NewRecorder()
436− CSRF.(*csrf).clock = func() time.Time { return testNow }
437−
438− // test
439− CSRF.ClearCookie(rw, req)
440−
441− // validate
442− Expect(rw.Header().Get("Set-Cookie")).To(Equal(
443− fmt.Sprintf(
444− "%s=; Path=%s; Domain=%s; Max-Age=0; HttpOnly; Secure; SameSite=Lax",
445− CSRF.(*csrf).cookieName(),
446− cookiePath,
447− cookieDomain,
448− ),
449− ))
450− })
451−
452− It("Call ClearCookie when CSRF SameSite is an empty string. Expected result: CSRF cookie SameSite is the same as session cookie.", func() {
453− // prepare
454− cookieOpts.SameSite = sameSiteLax
455− cookieOpts.CSRFSameSite = ""
456− CSRF, _ := NewCSRF(cookieOpts, "verifier")
457− rw := httptest.NewRecorder()
458− CSRF.(*csrf).clock = func() time.Time { return testNow }
459−
460− // test
461− CSRF.ClearCookie(rw, req)
462−
463− // validate
464− Expect(rw.Header().Get("Set-Cookie")).To(Equal(
465− fmt.Sprintf(
466− "%s=; Path=%s; Domain=%s; Max-Age=0; HttpOnly; Secure; SameSite=Lax",
467− CSRF.(*csrf).cookieName(),
468− cookiePath,
469− cookieDomain,
470− ),
471− ))
472− })
473−
474− It("Call ClearCookie when CSRF SameSite is 'none'. Expected result: CSRF cookie SameSite is None.", func() {
475− // prepare
476− cookieOpts.SameSite = sameSiteLax
477− cookieOpts.CSRFSameSite = sameSiteNone
478− CSRF, _ := NewCSRF(cookieOpts, "verifier")
479− rw := httptest.NewRecorder()
480− CSRF.(*csrf).clock = func() time.Time { return testNow }
481−
482− // test
483− CSRF.ClearCookie(rw, req)
484−
485− // validate
486− Expect(rw.Header().Get("Set-Cookie")).To(Equal(
487− fmt.Sprintf(
488− "%s=; Path=%s; Domain=%s; Max-Age=0; HttpOnly; Secure; SameSite=None",
489− CSRF.(*csrf).cookieName(),
490− cookiePath,
491− cookieDomain,
492− ),
493− ))
494− })
495−
496− It("Call ClearCookie when CSRF SameSite is 'strict'. Expected result: CSRF cookie SameSite is Strict.", func() {
497− // prepare
498− cookieOpts.SameSite = sameSiteLax
499− cookieOpts.CSRFSameSite = sameSiteStrict
500− CSRF, _ := NewCSRF(cookieOpts, "verifier")
501− rw := httptest.NewRecorder()
502− CSRF.(*csrf).clock = func() time.Time { return testNow }
503−
504− // test
505− CSRF.ClearCookie(rw, req)
506−
507− // validate
508− Expect(rw.Header().Get("Set-Cookie")).To(Equal(
509− fmt.Sprintf(
510− "%s=; Path=%s; Domain=%s; Max-Age=0; HttpOnly; Secure; SameSite=Strict",
511− CSRF.(*csrf).cookieName(),
512− cookiePath,
513− cookieDomain,
514− ),
515− ))
516− })
517−
518− It("Call ClearCookie when CSRF SameSite is 'lax'. Expected result: CSRF cookie SameSite is Lax.", func() {
519− // prepare
520− cookieOpts.SameSite = sameSiteStrict
521− cookieOpts.CSRFSameSite = sameSiteLax
522− CSRF, _ := NewCSRF(cookieOpts, "verifier")
523− rw := httptest.NewRecorder()
524− CSRF.(*csrf).clock = func() time.Time { return testNow }
525−
526− // test
527− CSRF.ClearCookie(rw, req)
528−
529− // validate
530− Expect(rw.Header().Get("Set-Cookie")).To(Equal(
531− fmt.Sprintf(
532− "%s=; Path=%s; Domain=%s; Max-Age=0; HttpOnly; Secure; SameSite=Lax",
533− CSRF.(*csrf).cookieName(),
534− cookiePath,
535− cookieDomain,
536− ),
537− ))
538− })
539− })
540257})
pkg/proxyhttp/http_suite_test.go → pkg/http/http_suite_test.gorenamed+1−1
@@ -1,4 +1,4 @@
1−package proxyhttp
1+package http
22
33import (
44 "bytes"
pkg/proxyhttp/server.go → pkg/http/server.gorenamed+3−51
@@ -1,4 +1,4 @@
1−package proxyhttp
1+package http
22
33import (
44 "context"
@@ -8,7 +8,6 @@ import (
88 "net"
99 "net/http"
1010 "os"
11− "strconv"
1211 "strings"
1312 "time"
1413
@@ -96,60 +95,13 @@ func (s *server) setupListener(opts Opts) error {
9695 networkType := getNetworkScheme(opts.BindAddress)
9796 listenAddr := getListenAddress(opts.BindAddress)
9897
99− listener, err := func() (net.Listener, error) {
100− if networkType == "unix" {
101− return setupUnixSocketListener(networkType, listenAddr)
102− }
103− return net.Listen(networkType, listenAddr)
104− }()
105−
98+ listener, err := net.Listen(networkType, listenAddr)
10699 if err != nil {
107100 return fmt.Errorf("listen (%s, %s) failed: %w", networkType, listenAddr, err)
108101 }
109−
110102 s.listener = listener
111− return nil
112−}
113−
114−func setupUnixSocketListener(networkType string, address string) (net.Listener, error) {
115− socketOpts := strings.Split(address, ",")
116− if len(socketOpts) < 2 {
117− return net.Listen(networkType, address)
118− }
119−
120− socketPath := socketOpts[0]
121− var socketMode os.FileMode
122− hasSocketMode := false
123−
124− for _, socketOpt := range socketOpts[1:] {
125− socketOpt := strings.SplitN(socketOpt, "=", 2)
126− if len(socketOpt) != 2 {
127− return nil, fmt.Errorf("unix socket option %s expects a value", socketOpt[0])
128− }
129103
130− if socketOpt[0] == "mode" {
131− mode, err := strconv.ParseUint(socketOpt[1], 8, 32)
132− if err != nil {
133− return nil, fmt.Errorf("unix socket file mode has invalid value %s", socketOpt[1])
134− }
135− socketMode = os.FileMode(mode)
136− hasSocketMode = true
137− }
138− }
139−
140− listener, err := net.Listen(networkType, socketPath)
141− if err != nil {
142− return nil, err
143− }
144−
145− if hasSocketMode {
146− err = os.Chmod(socketPath, socketMode)
147− if err != nil {
148− return nil, fmt.Errorf("cannot set unix socket file mode on %s: %v", socketPath, err)
149− }
150− }
151−
152− return listener, nil
104+ return nil
153105}
154106
155107func parseCipherSuites(names []string) ([]uint16, error) {
pkg/proxyhttp/server_group.go → pkg/http/server_group.gorenamed+1−1
@@ -1,4 +1,4 @@
1−package proxyhttp
1+package http
22
33import (
44 "context"
pkg/proxyhttp/server_group_test.go → pkg/http/server_group_test.gorenamed+1−1
@@ -1,4 +1,4 @@
1−package proxyhttp
1+package http
22
33import (
44 "context"
pkg/proxyhttp/server_test.go → pkg/http/server_test.gorenamed+1−51
@@ -1,4 +1,4 @@
1−package proxyhttp
1+package http
22
33import (
44 "context"
@@ -28,8 +28,6 @@ var _ = Describe("Server", func() {
2828 expectedErr error
2929 expectHTTPListener bool
3030 expectTLSListener bool
31− expectedSocketMode os.FileMode
32− socketPath string
3331 fdAddr string
3432 ipv6 bool
3533 }
@@ -59,12 +57,6 @@ var _ = Describe("Server", func() {
5957 s, ok := srv.(*server)
6058 Expect(ok).To(BeTrue())
6159
62− if in.socketPath != "" {
63− fileInfo, err := os.Stat(in.socketPath)
64− Expect(err).ToNot(HaveOccurred())
65− Expect(fileInfo.Mode().Perm()).To(Equal(in.expectedSocketMode.Perm()))
66− }
67−
6860 Expect(s.listener != nil).To(Equal(in.expectHTTPListener))
6961 if in.expectHTTPListener {
7062 Expect(s.listener.Close()).To(Succeed())
@@ -656,48 +648,6 @@ var _ = Describe("Server", func() {
656648 expectTLSListener: true,
657649 ipv6: true,
658650 }),
659− Entry("with a valid unix socket path", &newServerTableInput{
660− opts: Opts{
661− Handler: handler,
662− BindAddress: "unix:///tmp/oauth2-proxy.sock",
663− },
664− expectedErr: nil,
665− expectHTTPListener: true,
666− expectTLSListener: false,
667− ipv6: false,
668− }),
669− Entry("with a valid unix socket path and a valid socket file mode", &newServerTableInput{
670− opts: Opts{
671− Handler: handler,
672− BindAddress: "unix:///tmp/oauth2-proxy.sock,mode=0777",
673− },
674− expectedErr: nil,
675− expectHTTPListener: true,
676− expectTLSListener: false,
677− expectedSocketMode: 0o777,
678− socketPath: "/tmp/oauth2-proxy.sock",
679− ipv6: false,
680− }),
681− Entry("with a valid unix socket path and a value-less socket file mode argument", &newServerTableInput{
682− opts: Opts{
683− Handler: handler,
684− BindAddress: "unix:///tmp/oauth2-proxy.sock,mode",
685− },
686− expectedErr: errors.New("error setting up listener: listen (unix, /tmp/oauth2-proxy.sock,mode) failed: unix socket option mode expects a value"),
687− expectHTTPListener: false,
688− expectTLSListener: false,
689− ipv6: false,
690− }),
691− Entry("with a valid unix socket path and an invalid socket file mode value", &newServerTableInput{
692− opts: Opts{
693− Handler: handler,
694− BindAddress: "unix:///tmp/oauth2-proxy.sock,mode=-1",
695− },
696− expectedErr: errors.New("error setting up listener: listen (unix, /tmp/oauth2-proxy.sock,mode=-1) failed: unix socket file mode has invalid value -1"),
697− expectHTTPListener: false,
698− expectTLSListener: false,
699− ipv6: false,
700− }),
701651 )
702652 })
703653
pkg/proxyhttp/systemd_socket.go → pkg/http/systemd_socket.gorenamed+1−1
@@ -1,7 +1,7 @@
11//go:build !windows
22// +build !windows
33
4−package proxyhttp
4+package http
55
66import (
77 "errors"
pkg/proxyhttp/systemd_unsupported.go → pkg/http/systemd_unsupported.gorenamed+1−1
@@ -1,7 +1,7 @@
11//go:build windows
22// +build windows
33
4−package proxyhttp
4+package http
55
66import (
77 "fmt"
pkg/ip/parse_ip_net.go−16
@@ -1,7 +1,6 @@
11package ip
22
33import (
4− "fmt"
54 "net"
65 "strings"
76)
@@ -38,18 +37,3 @@ func ParseIPNet(s string) *net.IPNet {
3837 return ipNet
3938 }
4039}
41−
42−func ParseNetSet(ipStrs []string) (*NetSet, error) {
43− netSet := NewNetSet()
44−
45− for _, ipStr := range ipStrs {
46− ipNet := ParseIPNet(ipStr)
47− if ipNet == nil {
48− return nil, fmt.Errorf("could not parse IP network (%s)", ipStr)
49− }
50−
51− netSet.AddIPNet(*ipNet)
52− }
53−
54− return netSet, nil
55−}
pkg/ip/parse_ip_net_test.godeleted−118
@@ -1,118 +0,0 @@
1−package ip
2−
3−import (
4− "net"
5− "testing"
6−
7− "github.com/stretchr/testify/assert"
8−)
9−
10−func TestParseIPNet(t *testing.T) {
11− tests := []struct {
12− name string
13− input string
14− expectedIP net.IP
15− expectedMask net.IPMask
16− }{
17− {
18− name: "ipv4 address",
19− input: "127.0.0.1",
20− expectedIP: net.ParseIP("127.0.0.1"),
21− expectedMask: net.CIDRMask(32, 32),
22− },
23− {
24− name: "ipv6 address",
25− input: "::1",
26− expectedIP: net.ParseIP("::1"),
27− expectedMask: net.CIDRMask(128, 128),
28− },
29− {
30− name: "ipv4 cidr",
31− input: "10.0.0.0/24",
32− expectedIP: net.ParseIP("10.0.0.0"),
33− expectedMask: net.CIDRMask(24, 32),
34− },
35− {
36− name: "ipv6 cidr",
37− input: "2001:db8::/64",
38− expectedIP: net.ParseIP("2001:db8::"),
39− expectedMask: net.CIDRMask(64, 128),
40− },
41− }
42−
43− for _, test := range tests {
44− t.Run(test.name, func(t *testing.T) {
45− ipNet := ParseIPNet(test.input)
46−
47− assert.NotNil(t, ipNet)
48− if ipNet == nil {
49− return
50− }
51−
52− assert.True(t, test.expectedIP.Equal(ipNet.IP))
53− assert.Equal(t, test.expectedMask, ipNet.Mask)
54− })
55− }
56−}
57−
58−func TestParseIPNetRejectsInvalidNetworks(t *testing.T) {
59− tests := []struct {
60− name string
61− input string
62− }{
63− {
64− name: "invalid ip",
65− input: "not-an-ip",
66− },
67− {
68− name: "ipv4 cidr with host bits set",
69− input: "10.0.0.1/24",
70− },
71− {
72− name: "ipv6 cidr with host bits set",
73− input: "2001:db8::1/64",
74− },
75− {
76− name: "invalid cidr mask",
77− input: "10.0.0.0/33",
78− },
79− }
80−
81− for _, test := range tests {
82− t.Run(test.name, func(t *testing.T) {
83− assert.Nil(t, ParseIPNet(test.input))
84− })
85− }
86−}
87−
88−func TestParseNetSet(t *testing.T) {
89− netSet, err := ParseNetSet([]string{
90− "127.0.0.1",
91− "10.0.0.0/24",
92− "::1",
93− "2001:db8::/64",
94− })
95−
96− assert.NoError(t, err)
97− assert.NotNil(t, netSet)
98− if netSet == nil {
99− return
100− }
101−
102− assert.True(t, netSet.Has(net.ParseIP("127.0.0.1")))
103− assert.True(t, netSet.Has(net.ParseIP("10.0.0.55")))
104− assert.True(t, netSet.Has(net.ParseIP("::1")))
105− assert.True(t, netSet.Has(net.ParseIP("2001:db8::abcd")))
106−
107− assert.False(t, netSet.Has(net.ParseIP("127.0.0.2")))
108− assert.False(t, netSet.Has(net.ParseIP("10.0.1.1")))
109− assert.False(t, netSet.Has(net.ParseIP("::2")))
110− assert.False(t, netSet.Has(net.ParseIP("2001:db9::1")))
111−}
112−
113−func TestParseNetSetReturnsErrorForInvalidNetwork(t *testing.T) {
114− netSet, err := ParseNetSet([]string{"127.0.0.1", "10.0.0.1/24"})
115−
116− assert.Nil(t, netSet)
117− assert.EqualError(t, err, "could not parse IP network (10.0.0.1/24)")
118−}
pkg/ip/realclientip.go+1−7
@@ -73,12 +73,6 @@ func GetClientIP(p ipapi.RealClientIPParser, req *http.Request) (net.IP, error)
7373
7474// getRemoteIP obtains the IP of the low-level connected network host
7575func getRemoteIP(req *http.Request) (net.IP, error) {
76− // Unix domain sockets set RemoteAddr to "@" which has no meaningful IP.
77− // https://github.com/golang/go/blob/0fa53e41f122b1661d0678a6d36d71b7b5ad031d/src/syscall/syscall_linux.go#L506-L511
78− if req.RemoteAddr == "@" {
79− return nil, nil
80− }
81−
8276 //revive:disable:indent-error-flow
8377 if ipStr, _, err := net.SplitHostPort(req.RemoteAddr); err != nil {
8478 return nil, fmt.Errorf("unable to get ip and port from http.RemoteAddr (%s)", req.RemoteAddr)
@@ -100,7 +94,7 @@ func GetClientString(p ipapi.RealClientIPParser, req *http.Request, full bool) (
10094 }
10195
10296 var remoteIPStr string
103− if remoteIP, err := getRemoteIP(req); err == nil && remoteIP != nil {
97+ if remoteIP, err := getRemoteIP(req); err == nil {
10498 remoteIPStr = remoteIP.String()
10599 }
106100
pkg/ip/realclientip_test.go−4
@@ -112,8 +112,6 @@ func TestGetRemoteIP(t *testing.T) {
112112 errString string
113113 expectedIP net.IP
114114 }{
115− // Unix domain sockets set RemoteAddr to "@"
116− {"@", "", nil},
117115 {"", "unable to get ip and port from http.RemoteAddr ()", nil},
118116 {"nil", "unable to get ip and port from http.RemoteAddr (nil)", nil},
119117 {"235.28.129.186", "unable to get ip and port from http.RemoteAddr (235.28.129.186)", nil},
@@ -157,8 +155,6 @@ func TestGetClientString(t *testing.T) {
157155 }{
158156 // Should fail quietly, only printing warnings to the log
159157 {nil, "", "", "", ""},
160− // Unix domain socket — no IP available
161− {nil, "@", "", "", ""},
162158 {p, "127.0.0.1:11950", "", "127.0.0.1", "127.0.0.1"},
163159 {p, "[::1]:28660", "99.103.56.12", "99.103.56.12", "::1 (99.103.56.12)"},
164160 {nil, "10.254.244.165:62750", "", "10.254.244.165", "10.254.244.165"},
pkg/middleware/headers.go+1−1
@@ -54,7 +54,7 @@ func flattenHeaders(headers http.Header) {
5454func stripHeaders(headers []options.Header, next http.Handler) http.Handler {
5555 return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
5656 for _, header := range headers {
57− if ptr.Deref(header.InsecureSkipHeaderNormalization, options.DefaultInsecureSkipHeaderNormalization) {
57+ if header.InsecureSkipHeaderNormalization {
5858 req.Header.Del(header.Name)
5959 continue
6060 }
pkg/middleware/headers_test.go+5−5
@@ -116,7 +116,7 @@ var _ = Describe("Headers Suite", func() {
116116 headers: []options.Header{
117117 {
118118 Name: "Claim",
119− PreserveRequestValue: ptr.To(true),
119+ PreserveRequestValue: ptr.Ptr(true),
120120 Values: []options.HeaderValue{
121121 {
122122 ClaimSource: &options.ClaimSource{
@@ -161,7 +161,7 @@ var _ = Describe("Headers Suite", func() {
161161 headers: []options.Header{
162162 {
163163 Name: "Claim",
164− PreserveRequestValue: ptr.To(true),
164+ PreserveRequestValue: ptr.Ptr(true),
165165 Values: []options.HeaderValue{
166166 {
167167 ClaimSource: &options.ClaimSource{
@@ -231,7 +231,7 @@ var _ = Describe("Headers Suite", func() {
231231 headers: []options.Header{
232232 {
233233 Name: "X-Auth-Request-User",
234− InsecureSkipHeaderNormalization: ptr.To(true),
234+ InsecureSkipHeaderNormalization: true,
235235 Values: []options.HeaderValue{
236236 {
237237 ClaimSource: &options.ClaimSource{Claim: "user"},
@@ -386,7 +386,7 @@ var _ = Describe("Headers Suite", func() {
386386 headers: []options.Header{
387387 {
388388 Name: "Claim",
389− PreserveRequestValue: ptr.To(true),
389+ PreserveRequestValue: ptr.Ptr(true),
390390 Values: []options.HeaderValue{
391391 {
392392 ClaimSource: &options.ClaimSource{
@@ -433,7 +433,7 @@ var _ = Describe("Headers Suite", func() {
433433 headers: []options.Header{
434434 {
435435 Name: "Claim",
436− PreserveRequestValue: ptr.To(true),
436+ PreserveRequestValue: ptr.Ptr(true),
437437 Values: []options.HeaderValue{
438438 {
439439 ClaimSource: &options.ClaimSource{
pkg/middleware/healthcheck.go+4−7
@@ -43,13 +43,10 @@ func healthCheck(paths, userAgents []string, next http.Handler) http.Handler {
4343
4444func isHealthCheckRequest(paths, userAgents map[string]struct{}, req *http.Request) bool {
4545 if _, ok := paths[req.URL.EscapedPath()]; ok {
46− if len(userAgents) == 0 {
47− return true
48− }
49−
50− if _, ok := userAgents[req.Header.Get("User-Agent")]; ok {
51− return true
52− }
46+ return true
47+ }
48+ if _, ok := userAgents[req.Header.Get("User-Agent")]; ok {
49+ return true
5350 }
5451 return false
5552}
pkg/middleware/healthcheck_test.go+9−31
@@ -45,16 +45,6 @@ var _ = Describe("HealthCheck suite", func() {
4545 healthCheckPaths: []string{"/ping"},
4646 healthCheckUserAgents: []string{"hc/1.0"},
4747 requestString: "http://example.com/ping",
48− headers: map[string]string{
49− "User-Agent": "hc/1.0",
50− },
51− expectedStatus: 200,
52− expectedBody: "OK",
53− }),
54− Entry("when requesting the healthcheck path with no health check user agents configured", &requestTableInput{
55− healthCheckPaths: []string{"/ping"},
56− healthCheckUserAgents: []string{},
57− requestString: "http://example.com/ping",
5848 headers: map[string]string{},
5949 expectedStatus: 200,
6050 expectedBody: "OK",
@@ -95,25 +85,15 @@ var _ = Describe("HealthCheck suite", func() {
9585 expectedStatus: 404,
9686 expectedBody: "404 page not found\n",
9787 }),
98− Entry("with a request from the health check user agent on a non-healthcheck path", &requestTableInput{
88+ Entry("with a request from the health check user agent", &requestTableInput{
9989 healthCheckPaths: []string{"/ping"},
10090 healthCheckUserAgents: []string{"hc/1.0"},
10191 requestString: "http://example.com/abc",
10292 headers: map[string]string{
10393 "User-Agent": "hc/1.0",
10494 },
105− expectedStatus: 404,
106− expectedBody: "404 page not found\n",
107− }),
108− Entry("when an auth_request endpoint receives the configured health check user agent", &requestTableInput{
109− healthCheckPaths: []string{"/ping"},
110− healthCheckUserAgents: []string{"GoogleHC/1.0"},
111− requestString: "http://example.com/oauth2/auth",
112− headers: map[string]string{
113− "User-Agent": "GoogleHC/1.0",
114− },
115− expectedStatus: 404,
116− expectedBody: "404 page not found\n",
95+ expectedStatus: 200,
96+ expectedBody: "OK",
11797 }),
11898 Entry("when a blank string is configured as a health check agent and a request has no user agent", &requestTableInput{
11999 healthCheckPaths: []string{"/ping"},
@@ -127,11 +107,9 @@ var _ = Describe("HealthCheck suite", func() {
127107 healthCheckPaths: []string{"/ping", "/liveness_check", "/readiness_check"},
128108 healthCheckUserAgents: []string{"hc/1.0"},
129109 requestString: "http://example.com/readiness_check",
130− headers: map[string]string{
131− "User-Agent": "hc/1.0",
132− },
133− expectedStatus: 200,
134− expectedBody: "OK",
110+ headers: map[string]string{},
111+ expectedStatus: 200,
112+ expectedBody: "OK",
135113 }),
136114 Entry("with multiple paths, request none of the healthcheck paths", &requestTableInput{
137115 healthCheckPaths: []string{"/ping", "/liveness_check", "/readiness_check"},
@@ -143,15 +121,15 @@ var _ = Describe("HealthCheck suite", func() {
143121 expectedStatus: 404,
144122 expectedBody: "404 page not found\n",
145123 }),
146− Entry("with multiple user agents, request from a health check user agent on a non-healthcheck path", &requestTableInput{
124+ Entry("with multiple user agents, request from a health check user agent", &requestTableInput{
147125 healthCheckPaths: []string{"/ping"},
148126 healthCheckUserAgents: []string{"hc/1.0", "GoogleHC/1.0"},
149127 requestString: "http://example.com/abc",
150128 headers: map[string]string{
151129 "User-Agent": "GoogleHC/1.0",
152130 },
153− expectedStatus: 404,
154− expectedBody: "404 page not found\n",
131+ expectedStatus: 200,
132+ expectedBody: "OK",
155133 }),
156134 Entry("with multiple user agents, request from none of the health check user agents", &requestTableInput{
157135 healthCheckPaths: []string{"/ping"},
pkg/middleware/jwt_session_test.go+2−2
@@ -304,7 +304,7 @@ Nnc3a3lGVWFCNUMxQnNJcnJMTWxka1dFaHluYmI4Ongtb2F1dGgtYmFzaWM=`
304304 authorizationHeader: fmt.Sprintf("Bearer %s", nonVerifiedToken),
305305 expectedErr: k8serrors.NewAggregate([]error{
306306 errors.New("unable to verify bearer token"),
307− errors.New("oidc: malformed jwt: illegal base64 data at input byte 8"),
307+ errors.New("oidc: malformed jwt: oidc: malformed jwt payload: illegal base64 data at input byte 8"),
308308 }),
309309 expectedSession: nil,
310310 }),
@@ -317,7 +317,7 @@ Nnc3a3lGVWFCNUMxQnNJcnJMTWxka1dFaHluYmI4Ongtb2F1dGgtYmFzaWM=`
317317 authorizationHeader: "Basic ZXlKZm9vYmFyLmV5SmZvb2Jhci4xMjM0NWFzZGY6",
318318 expectedErr: k8serrors.NewAggregate([]error{
319319 errors.New("unable to verify bearer token"),
320− errors.New("oidc: malformed jwt: illegal base64 data at input byte 8"),
320+ errors.New("oidc: malformed jwt: oidc: malformed jwt payload: illegal base64 data at input byte 8"),
321321 }),
322322 expectedSession: nil,
323323 }),
pkg/middleware/redirect_to_https_test.go−15
@@ -6,7 +6,6 @@ import (
66 "net/http/httptest"
77
88 middlewareapi "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/middleware"
9− "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/ip"
109 . "github.com/onsi/ginkgo/v2"
1110 . "github.com/onsi/gomega"
1211)
@@ -40,10 +39,6 @@ var _ = Describe("RedirectToHTTPS suite", func() {
4039 scope := &middlewareapi.RequestScope{
4140 ReverseProxy: in.reverseProxy,
4241 }
43− if in.reverseProxy {
44− req.RemoteAddr = "127.0.0.1:4180"
45− scope.TrustedProxies = newRedirectTrustedProxySet("127.0.0.1")
46− }
4742 req = middlewareapi.AddRequestScope(req, scope)
4843
4944 rw := httptest.NewRecorder()
@@ -212,13 +207,3 @@ var _ = Describe("RedirectToHTTPS suite", func() {
212207 }),
213208 )
214209})
215−
216−func newRedirectTrustedProxySet(cidrs ...string) *ip.NetSet {
217− set := ip.NewNetSet()
218− for _, cidr := range cidrs {
219− ipNet := ip.ParseIPNet(cidr)
220− Expect(ipNet).ToNot(BeNil())
221− set.AddIPNet(*ipNet)
222− }
223− return set
224−}
pkg/middleware/scope.go+3−5
@@ -6,16 +6,14 @@ import (
66 "github.com/google/uuid"
77 "github.com/justinas/alice"
88 middlewareapi "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/middleware"
9− "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/ip"
109)
1110
12−func NewScope(reverseProxy bool, idHeader string, trustedProxies *ip.NetSet) alice.Constructor {
11+func NewScope(reverseProxy bool, idHeader string) alice.Constructor {
1312 return func(next http.Handler) http.Handler {
1413 return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
1514 scope := &middlewareapi.RequestScope{
16− ReverseProxy: reverseProxy,
17− TrustedProxies: trustedProxies,
18− RequestID: genRequestID(req, idHeader),
15+ ReverseProxy: reverseProxy,
16+ RequestID: genRequestID(req, idHeader),
1917 }
2018 req = middlewareapi.AddRequestScope(req, scope)
2119 next.ServeHTTP(rw, req)
pkg/middleware/scope_test.go+4−18
@@ -6,7 +6,6 @@ import (
66
77 "github.com/google/uuid"
88 middlewareapi "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/middleware"
9− "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/ip"
109 . "github.com/onsi/ginkgo/v2"
1110 . "github.com/onsi/gomega"
1211)
@@ -33,7 +32,7 @@ var _ = Describe("Scope Suite", func() {
3332
3433 Context("ReverseProxy is false", func() {
3534 BeforeEach(func() {
36− handler := NewScope(false, testRequestHeader, nil)(
35+ handler := NewScope(false, testRequestHeader)(
3736 http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
3837 nextRequest = r
3938 w.WriteHeader(200)
@@ -61,15 +60,8 @@ var _ = Describe("Scope Suite", func() {
6160 })
6261
6362 Context("ReverseProxy is true", func() {
64− var trustedProxies *ip.NetSet
65−
6663 BeforeEach(func() {
67− var err error
68−
69− trustedProxies, err = ip.ParseNetSet([]string{"127.0.0.1"})
70− Expect(err).ToNot(HaveOccurred())
71−
72− handler := NewScope(true, testRequestHeader, trustedProxies)(
64+ handler := NewScope(true, testRequestHeader)(
7365 http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
7466 nextRequest = r
7567 w.WriteHeader(200)
@@ -82,18 +74,12 @@ var _ = Describe("Scope Suite", func() {
8274 Expect(scope).ToNot(BeNil())
8375 Expect(scope.ReverseProxy).To(BeTrue())
8476 })
85−
86− It("stores the trusted proxies on the scope", func() {
87− scope := middlewareapi.GetRequestScope(nextRequest)
88− Expect(scope).ToNot(BeNil())
89− Expect(scope.TrustedProxies).To(BeIdenticalTo(trustedProxies))
90− })
9177 })
9278
9379 Context("Request ID header is present", func() {
9480 BeforeEach(func() {
9581 request.Header.Add(testRequestHeader, testRequestID)
96− handler := NewScope(false, testRequestHeader, nil)(
82+ handler := NewScope(false, testRequestHeader)(
9783 http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
9884 nextRequest = r
9985 w.WriteHeader(200)
@@ -111,7 +97,7 @@ var _ = Describe("Scope Suite", func() {
11197 BeforeEach(func() {
11298 uuid.SetRand(mockRand{})
11399
114− handler := NewScope(true, testRequestHeader, nil)(
100+ handler := NewScope(true, testRequestHeader)(
115101 http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
116102 nextRequest = r
117103 w.WriteHeader(200)
pkg/middleware/stored_session.go+2−46
@@ -5,7 +5,6 @@ import (
55 "errors"
66 "fmt"
77 "net/http"
8− "strings"
98 "time"
109
1110 "github.com/justinas/alice"
@@ -32,33 +31,6 @@ const (
3231 sessionRefreshRetryPeriod = 10 * time.Millisecond
3332)
3433
35−// isFatalRefreshError checks if a refresh error indicates a revoked or
36−// non-existent session that should be immediately invalidated.
37−// Fatal errors indicate the session is no longer valid at the provider level.
38−// Non-fatal errors (network issues, timeouts) should not invalidate the session.
39−//
40−// Only checks standard OAuth2 error codes (RFC 6749 Section 5.2).
41−// Does NOT check error_description strings as they are optional and provider-specific.
42−func isFatalRefreshError(err error) bool {
43− if err == nil {
44− return false
45− }
46−
47− // Only check standard OAuth2 error codes (RFC 6749 Section 5.2)
48− // Do NOT check error_description strings as they are optional and provider-specific
49− fatalErrors := []string{
50− "invalid_grant", // refresh token revoked, expired, or session terminated
51− "invalid_client", // client credentials no longer valid
52− }
53−
54− for _, fe := range fatalErrors {
55− if strings.Contains(err.Error(), fe) {
56− return true
57− }
58− }
59− return false
60−}
61−
6234// StoredSessionLoaderOptions contains all of the requirements to construct
6335// a stored session loader.
6436// All options must be provided.
@@ -216,24 +188,9 @@ func (s *storedSessionLoader) refreshSessionIfNeeded(rw http.ResponseWriter, req
216188 // We are holding the lock and the session needs a refresh
217189 logger.Printf("Refreshing session - User: %s; SessionAge: %s", session.User, session.Age())
218190 if err := s.refreshSession(rw, req, session); err != nil {
191+ // If a preemptive refresh fails, we still keep the session
192+ // if validateSession succeeds.
219193 logger.Errorf("Unable to refresh session: %v", err)
220−
221− // Check if this is a fatal error that indicates the session is revoked
222− // or no longer valid at the provider level
223− if isFatalRefreshError(err) {
224− logger.Printf("Fatal refresh error detected (session revoked or invalid), clearing session for user: %s", session.User)
225−
226− // Clear the session from storage (Redis) and remove the cookie
227− if err := s.store.Clear(rw, req); err != nil {
228− logger.Errorf("failed clearing session: %v", err)
229− }
230−
231− // Return error immediately to force re-authentication
232− return fmt.Errorf("session invalidated due to fatal refresh error: %w", err)
233− }
234−
235− // For non-fatal errors (network issues, timeouts), keep the session
236− // and let validateSession determine if it's still usable
237194 }
238195
239196 // Validate all sessions after any Redeem/Refresh operation (fail or success)
@@ -265,7 +222,6 @@ func (s *storedSessionLoader) refreshSession(rw http.ResponseWriter, req *http.R
265222
266223 // Session not refreshed, nothing to persist.
267224 if !refreshed {
268− logger.Printf("Session not refreshed - User: %s; no refresh token available or provider returned false", session.User)
269225 return nil
270226 }
271227
pkg/middleware/stored_session_test.go−51
@@ -7,7 +7,6 @@ import (
77 "net/http"
88 "net/http/httptest"
99 "sync"
10− "testing"
1110 "time"
1211
1312 middlewareapi "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/middleware"
@@ -802,53 +801,3 @@ func (f *fakeSessionStore) Clear(rw http.ResponseWriter, req *http.Request) erro
802801func (f *fakeSessionStore) VerifyConnection(_ context.Context) error {
803802 return nil
804803}
805−
806−// TestIsFatalRefreshError tests the isFatalRefreshError function to ensure
807−// it correctly identifies fatal OAuth2 errors that should invalidate a session.
808−func TestIsFatalRefreshError(t *testing.T) {
809− tests := []struct {
810− name string
811− err error
812− expected bool
813− }{
814− {
815− name: "nil error",
816− err: nil,
817− expected: false,
818− },
819− {
820− name: "invalid_grant error",
821− err: fmt.Errorf("failed to get token: oauth2: \"invalid_grant\" \"Session not active\""),
822− expected: true,
823− },
824− {
825− name: "invalid_client error",
826− err: fmt.Errorf("invalid_client: client not found"),
827− expected: true,
828− },
829− {
830− name: "network timeout - not fatal",
831− err: fmt.Errorf("Post \"https://keycloak/token\": dial tcp: connect: connection refused"),
832− expected: false,
833− },
834− {
835− name: "server error - not fatal",
836− err: fmt.Errorf("unexpected status code 500"),
837− expected: false,
838− },
839− {
840− name: "generic refresh error - not fatal",
841− err: fmt.Errorf("error refreshing tokens: context deadline exceeded"),
842− expected: false,
843− },
844− }
845−
846− for _, tt := range tests {
847− t.Run(tt.name, func(t *testing.T) {
848− result := isFatalRefreshError(tt.err)
849− if result != tt.expected {
850− t.Errorf("isFatalRefreshError(%v) = %v, want %v", tt.err, result, tt.expected)
851− }
852− })
853− }
854−}
pkg/providers/oidc/provider_verifier.go+1−36
@@ -155,48 +155,13 @@ func getVerifierBuilder(ctx context.Context, opts ProviderVerifierOptions) (veri
155155 return nil, nil, fmt.Errorf("error while discovery OIDC configuration: %w", err)
156156 }
157157
158− supportedSigningAlgs, err := intersectSigningAlgs(provider.SupportedSigningAlgs(), opts.SupportedSigningAlgs)
159− if err != nil {
160− return nil, nil, fmt.Errorf("error while determining supported signing algorithms: %w", err)
161− }
162−
163158 return newVerifierBuilder(
164159 opts.IssuerURL,
165160 oidc.NewRemoteKeySet(ctx, provider.Endpoints().JWKsURL),
166− supportedSigningAlgs,
161+ provider.SupportedSigningAlgs(),
167162 ), provider, nil
168163}
169164
170−// intersectSigningAlgs returns the intersecting list of signing algorithms from the oidc discovery
171−// and the signing algorithms provided through the options.
172−func intersectSigningAlgs(discoveredSigningAlgs, configuredSigningAlgs []string) ([]string, error) {
173− if len(configuredSigningAlgs) == 0 {
174− return discoveredSigningAlgs, nil
175− }
176−
177− if len(discoveredSigningAlgs) == 0 {
178− return configuredSigningAlgs, nil
179− }
180−
181− discovered := make(map[string]struct{}, len(discoveredSigningAlgs))
182− for _, signingAlg := range discoveredSigningAlgs {
183− discovered[signingAlg] = struct{}{}
184− }
185−
186− intersection := make([]string, 0, len(configuredSigningAlgs))
187− for _, signingAlg := range configuredSigningAlgs {
188− if _, ok := discovered[signingAlg]; ok {
189− intersection = append(intersection, signingAlg)
190− }
191− }
192−
193− if len(intersection) == 0 {
194− return nil, fmt.Errorf("no supported signing algorithms in common between provider and configuration: discovered=%v, configured=%v", discoveredSigningAlgs, configuredSigningAlgs)
195− }
196−
197− return intersection, nil
198−}
199−
200165// GetPublicKeyFromBytes parses a PEM-encoded public key from a byte array
201166// and returns a crypto.PublicKey object.
202167func getPublicKeyFromBytes(bytes []byte) (crypto.PublicKey, error) {
pkg/providers/oidc/provider_verifier_test.go−92
@@ -2,9 +2,6 @@ package oidc
22
33import (
44 "context"
5− "encoding/json"
6− "net"
7− "net/http"
85 "os"
96 "path/filepath"
107 "time"
@@ -198,21 +195,6 @@ var _ = Describe("ProviderVerifier", func() {
198195 Expect(idToken.Subject).To(Equal(claims.Subject))
199196 },
200197 Entry("with the default opts and claims", &verifierTableInput{}),
201− Entry("with skip discovery and an allowed signing algorithm", &verifierTableInput{
202− modifyOpts: func(p *ProviderVerifierOptions) {
203− p.SkipDiscovery = true
204− p.JWKsURL = m.JWKSEndpoint()
205− p.SupportedSigningAlgs = []string{"RS256"}
206− },
207− }),
208− Entry("with skip discovery and a disallowed signing algorithm", &verifierTableInput{
209− modifyOpts: func(p *ProviderVerifierOptions) {
210− p.SkipDiscovery = true
211− p.JWKsURL = m.JWKSEndpoint()
212− p.SupportedSigningAlgs = []string{"HS256"}
213− },
214− expectedError: "failed to verify token: oidc: malformed jwt: unexpected signature algorithm \"RS256\"; expected [\"HS256\"]",
215− }),
216198 Entry("when the audience is mismatched", &verifierTableInput{
217199 modifyClaims: func(j *jwt.RegisteredClaims) {
218200 j.Audience = jwt.ClaimStrings{"OtherClient"}
@@ -248,78 +230,4 @@ var _ = Describe("ProviderVerifier", func() {
248230 expectedError: "failed to verify token: oidc: token is expired",
249231 }),
250232 )
251−
252− Describe("intersectSigningAlgs", func() {
253− DescribeTable("when determining allowed signing algorithms", func(discoveredSigningAlgs, configuredSigningAlgs, expected []string, expectedError string) {
254− actual, err := intersectSigningAlgs(discoveredSigningAlgs, configuredSigningAlgs)
255− Expect(actual).To(Equal(expected))
256− if len(expectedError) > 0 {
257− Expect(err).To(HaveOccurred())
258− Expect(err.Error()).To(Equal(expectedError))
259− }
260− },
261− Entry("returns discovered values when no configured values are provided", []string{"RS256", "HS256"}, []string(nil), []string{"RS256", "HS256"}, ""),
262− Entry("returns configured values when no discovered values are provided", []string(nil), []string{"RS256"}, []string{"RS256"}, ""),
263− Entry("returns the configured order of the intersection", []string{"RS256", "HS256", "EdDSA"}, []string{"EdDSA", "RS256"}, []string{"EdDSA", "RS256"}, ""),
264− Entry("returns an error when there is no intersection", []string{"RS256", "HS256"}, []string{"EdDSA"}, nil, "no supported signing algorithms in common between provider and configuration: discovered=[RS256 HS256], configured=[EdDSA]"),
265− )
266− })
267−
268− It("uses the intersection between discovered and configured signing algorithms", func() {
269− customServer, err := mockoidc.NewServer(nil)
270− Expect(err).ToNot(HaveOccurred())
271− customServer.AddMiddleware(newConfiguredSigningAlgsIssuerMiddleware(customServer, []string{"RS256", "HS256"}))
272−
273− listener, err := net.Listen("tcp", "127.0.0.1:0")
274− Expect(err).ToNot(HaveOccurred())
275−
276− Expect(customServer.Start(listener, nil)).To(Succeed())
277− defer func() {
278− Expect(customServer.Shutdown()).To(Succeed())
279− }()
280−
281− pv, err := NewProviderVerifier(context.Background(), ProviderVerifierOptions{
282− AudienceClaims: []string{"aud"},
283− ClientID: customServer.Config().ClientID,
284− ExtraAudiences: []string{},
285− IssuerURL: customServer.Issuer(),
286− SupportedSigningAlgs: []string{"HS256"},
287− })
288− Expect(err).ToNot(HaveOccurred())
289−
290− rawIDToken, err := customServer.Keypair.SignJWT(jwt.RegisteredClaims{
291− Audience: jwt.ClaimStrings{customServer.Config().ClientID},
292− Issuer: customServer.Issuer(),
293− ExpiresAt: jwt.NewNumericDate(time.Now().Add(1 * time.Hour)),
294− IssuedAt: jwt.NewNumericDate(time.Now()),
295− Subject: "user",
296− })
297− Expect(err).ToNot(HaveOccurred())
298−
299− _, err = pv.Verifier().Verify(context.Background(), rawIDToken)
300− Expect(err).To(MatchError(HavePrefix("failed to verify token: oidc: malformed jwt: unexpected signature algorithm \"RS256\"; expected [\"HS256\"]")))
301− })
302233})
303−
304−func newConfiguredSigningAlgsIssuerMiddleware(m *mockoidc.MockOIDC, supportedSigningAlgs []string) func(http.Handler) http.Handler {
305− return func(next http.Handler) http.Handler {
306− return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
307− provider := providerJSON{
308− Issuer: m.Issuer(),
309− AuthURL: m.AuthorizationEndpoint(),
310− TokenURL: m.TokenEndpoint(),
311− JWKsURL: m.JWKSEndpoint(),
312− UserInfoURL: m.UserinfoEndpoint(),
313− SupportedSigningAlgs: supportedSigningAlgs,
314− }
315−
316− data, err := json.Marshal(provider)
317− if err != nil {
318− rw.WriteHeader(http.StatusInternalServerError)
319− return
320− }
321−
322− _, _ = rw.Write(data)
323− })
324− }
325−}
pkg/providers/util/claim_extractor.go+74−10
@@ -3,6 +3,7 @@ package util
33import (
44 "context"
55 "encoding/base64"
6+ "encoding/json"
67 "fmt"
78 "mime"
89 "net/http"
@@ -11,17 +12,17 @@ import (
1112
1213 "github.com/bitly/go-simplejson"
1314 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/requests"
14− "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/util"
15+ "github.com/spf13/cast"
1516)
1617
1718// ClaimExtractor is used to extract claim values from an ID Token, or, if not
1819// present, from the profile URL.
1920type ClaimExtractor interface {
2021 // GetClaim fetches a named claim and returns the value.
21− GetClaim(claim string) (any, bool, error)
22+ GetClaim(claim string) (interface{}, bool, error)
2223
2324 // GetClaimInto fetches a named claim and puts the value into the destination.
24− GetClaimInto(claim string, dst any) (bool, error)
25+ GetClaimInto(claim string, dst interface{}) (bool, error)
2526}
2627
2728// NewClaimExtractor constructs a new ClaimExtractor from the raw ID Token.
@@ -30,12 +31,12 @@ type ClaimExtractor interface {
3031func NewClaimExtractor(ctx context.Context, idToken string, profileURL *url.URL, profileRequestHeaders http.Header) (ClaimExtractor, error) {
3132 payload, err := parseJWT(idToken)
3233 if err != nil {
33− return nil, fmt.Errorf("failed to parse ID Token: %w", err)
34+ return nil, fmt.Errorf("failed to parse ID Token: %v", err)
3435 }
3536
3637 tokenClaims, err := simplejson.NewJson(payload)
3738 if err != nil {
38− return nil, fmt.Errorf("failed to parse ID Token payload: %w", err)
39+ return nil, fmt.Errorf("failed to parse ID Token payload: %v", err)
3940 }
4041
4142 return &claimExtractor{
@@ -58,7 +59,7 @@ type claimExtractor struct {
5859// GetClaim will return the value claim if it exists.
5960// It will only return an error if the profile URL needs to be fetched due to
6061// the claim not being present in the ID Token.
61−func (c *claimExtractor) GetClaim(claim string) (any, bool, error) {
62+func (c *claimExtractor) GetClaim(claim string) (interface{}, bool, error) {
6263 if claim == "" {
6364 return nil, false, nil
6465 }
@@ -123,7 +124,7 @@ func (c *claimExtractor) loadProfileClaims() (*simplejson.Json, error) {
123124// GetClaimInto loads a claim and places it into the destination interface.
124125// This will attempt to coerce the claim into the specified type.
125126// If it cannot be coerced, an error may be returned.
126−func (c *claimExtractor) GetClaimInto(claim string, dst any) (bool, error) {
127+func (c *claimExtractor) GetClaimInto(claim string, dst interface{}) (bool, error) {
127128 value, exists, err := c.GetClaim(claim)
128129 if err != nil {
129130 return false, fmt.Errorf("could not get claim %q: %v", claim, err)
@@ -131,8 +132,8 @@ func (c *claimExtractor) GetClaimInto(claim string, dst any) (bool, error) {
131132 if !exists {
132133 return false, nil
133134 }
134− if err := util.CoerceClaim(value, dst); err != nil {
135− return false, fmt.Errorf("could not coerce claim: %v", err)
135+ if err := coerceClaim(value, dst); err != nil {
136+ return false, fmt.Errorf("could no coerce claim: %v", err)
136137 }
137138
138139 return true, nil
@@ -155,10 +156,73 @@ func parseJWT(p string) ([]byte, error) {
155156// getClaimFrom gets a claim from a Json object.
156157// It can accept either a single claim name or a json path. The claim is always evaluated first as a single claim name.
157158// Paths with indexes are not supported.
158−func getClaimFrom(claim string, src *simplejson.Json) any {
159+func getClaimFrom(claim string, src *simplejson.Json) interface{} {
159160 if value, ok := src.CheckGet(claim); ok {
160161 return value.Interface()
161162 }
162163 claimParts := strings.Split(claim, ".")
163164 return src.GetPath(claimParts...).Interface()
164165}
166+
167+// coerceClaim tries to convert the value into the destination interface type.
168+// If it can convert the value, it will then store the value in the destination
169+// interface.
170+func coerceClaim(value, dst interface{}) error {
171+ switch d := dst.(type) {
172+ case *string:
173+ str, err := toString(value)
174+ if err != nil {
175+ return fmt.Errorf("could not convert value to string: %v", err)
176+ }
177+ *d = str
178+ case *[]string:
179+ strSlice, err := toStringSlice(value)
180+ if err != nil {
181+ return fmt.Errorf("could not convert value to string slice: %v", err)
182+ }
183+ *d = strSlice
184+ case *bool:
185+ *d = cast.ToBool(value)
186+ default:
187+ return fmt.Errorf("unknown type for destination: %T", dst)
188+ }
189+ return nil
190+}
191+
192+// toStringSlice converts an interface (either a slice or single value) into
193+// a slice of strings.
194+func toStringSlice(value interface{}) ([]string, error) {
195+ var sliceValues []interface{}
196+ switch v := value.(type) {
197+ case []interface{}:
198+ sliceValues = v
199+ case interface{}:
200+ sliceValues = []interface{}{v}
201+ default:
202+ sliceValues = cast.ToSlice(value)
203+ }
204+
205+ out := []string{}
206+ for _, v := range sliceValues {
207+ str, err := toString(v)
208+ if err != nil {
209+ return nil, fmt.Errorf("could not convert slice entry to string %v: %v", v, err)
210+ }
211+ out = append(out, str)
212+ }
213+ return out, nil
214+}
215+
216+// toString coerces a value into a string.
217+// If it is non-string, marshal it into JSON.
218+func toString(value interface{}) (string, error) {
219+ if str, err := cast.ToStringE(value); err == nil {
220+ return str, nil
221+ }
222+
223+ jsonStr, err := json.Marshal(value)
224+ if err != nil {
225+ return "", err
226+ }
227+ return string(jsonStr), nil
228+}
pkg/providers/util/claim_extractor_test.go+53−2
@@ -76,7 +76,7 @@ var _ = Describe("Claim Extractor Suite", func() {
7676 func(in newClaimExtractorTableInput) {
7777 _, err := NewClaimExtractor(context.Background(), in.idToken, nil, nil)
7878 if in.expectedError != nil {
79− Expect(err).To(MatchError(in.expectedError.Error()))
79+ Expect(err).To(MatchError(in.expectedError))
8080 } else {
8181 Expect(err).ToNot(HaveOccurred())
8282 }
@@ -405,7 +405,7 @@ var _ = Describe("Claim Extractor Suite", func() {
405405 into: "",
406406 expectExists: false,
407407 expectedValue: "",
408− expectedError: errors.New("could not coerce claim: unknown type for destination: string"),
408+ expectedError: errors.New("could no coerce claim: unknown type for destination: string"),
409409 }),
410410 Entry("flattens a complex claim value into a JSON string", getClaimIntoTableInput{
411411 testClaimExtractorOpts: testClaimExtractorOpts{
@@ -451,6 +451,53 @@ var _ = Describe("Claim Extractor Suite", func() {
451451 }),
452452 )
453453
454+ type coerceClaimTableInput struct {
455+ value interface{}
456+ dst interface{}
457+ expectedDst interface{}
458+ expectedError error
459+ }
460+
461+ DescribeTable("coerceClaim",
462+ func(in coerceClaimTableInput) {
463+ err := coerceClaim(in.value, in.dst)
464+ if in.expectedError != nil {
465+ Expect(err).To(MatchError(in.expectedError))
466+ return
467+ }
468+
469+ Expect(err).ToNot(HaveOccurred())
470+ Expect(in.dst).To(Equal(in.expectedDst))
471+ },
472+ Entry("coerces a string to a string", coerceClaimTableInput{
473+ value: "some_string",
474+ dst: stringPointer(""),
475+ expectedDst: stringPointer("some_string"),
476+ }),
477+ Entry("coerces a slice to a string slice", coerceClaimTableInput{
478+ value: []interface{}{"a", "b"},
479+ dst: stringSlicePointer([]string{}),
480+ expectedDst: stringSlicePointer([]string{"a", "b"}),
481+ }),
482+ Entry("coerces a bool to a bool", coerceClaimTableInput{
483+ value: true,
484+ dst: boolPointer(false),
485+ expectedDst: boolPointer(true),
486+ }),
487+ Entry("coerces a string to a bool", coerceClaimTableInput{
488+ value: "true",
489+ dst: boolPointer(false),
490+ expectedDst: boolPointer(true),
491+ }),
492+ Entry("coerces a map to a string", coerceClaimTableInput{
493+ value: map[string]interface{}{
494+ "foo": []interface{}{"bar", "baz"},
495+ },
496+ dst: stringPointer(""),
497+ expectedDst: stringPointer("{\"foo\":[\"bar\",\"baz\"]}"),
498+ }),
499+ )
500+
454501 It("should extract claims from a JWT response", func() {
455502 jwtResponsePayload := `{
456503 "user": "jwtUser",
@@ -558,6 +605,10 @@ func stringSlicePointer(in []string) *[]string {
558605 return &in
559606}
560607
608+func boolPointer(in bool) *bool {
609+ return &in
610+}
611+
561612// ******************************
562613// Different profile URL handlers
563614// ******************************
pkg/requests/builder_test.go+15−15
@@ -31,7 +31,7 @@ var _ = Describe("Builder suite", func() {
3131
3232 Context("with a basic request", func() {
3333 assertSuccessfulRequest(getBuilder, testHTTPRequest{
34− Method: http.MethodGet,
34+ Method: "GET",
3535 Header: baseHeaders,
3636 Body: []byte{},
3737 RequestURI: "/json/path",
@@ -52,7 +52,7 @@ var _ = Describe("Builder suite", func() {
5252 })
5353
5454 assertSuccessfulRequest(getBuilder, testHTTPRequest{
55− Method: http.MethodGet,
55+ Method: "GET",
5656 Header: baseHeaders,
5757 Body: []byte{},
5858 RequestURI: "/json/path",
@@ -78,7 +78,7 @@ var _ = Describe("Builder suite", func() {
7878 })
7979
8080 assertSuccessfulRequest(getBuilder, testHTTPRequest{
81− Method: http.MethodGet,
81+ Method: "GET",
8282 Header: header,
8383 Body: []byte(body),
8484 RequestURI: "/json/path",
@@ -93,11 +93,11 @@ var _ = Describe("Builder suite", func() {
9393
9494 BeforeEach(func() {
9595 buf := bytes.NewBuffer([]byte(body))
96− b = b.WithMethod(http.MethodPost).WithBody(buf)
96+ b = b.WithMethod("POST").WithBody(buf)
9797 })
9898
9999 assertSuccessfulRequest(getBuilder, testHTTPRequest{
100− Method: http.MethodPost,
100+ Method: "POST",
101101 Header: header,
102102 Body: []byte(body),
103103 RequestURI: "/json/path",
@@ -109,11 +109,11 @@ var _ = Describe("Builder suite", func() {
109109 header.Set("Content-Length", "0")
110110
111111 BeforeEach(func() {
112− b = b.WithMethod(http.MethodPost)
112+ b = b.WithMethod("POST")
113113 })
114114
115115 assertSuccessfulRequest(getBuilder, testHTTPRequest{
116− Method: http.MethodPost,
116+ Method: "POST",
117117 Header: header,
118118 Body: []byte{},
119119 RequestURI: "/json/path",
@@ -122,11 +122,11 @@ var _ = Describe("Builder suite", func() {
122122
123123 Context("OPTIONS", func() {
124124 BeforeEach(func() {
125− b = b.WithMethod(http.MethodOptions)
125+ b = b.WithMethod("OPTIONS")
126126 })
127127
128128 assertSuccessfulRequest(getBuilder, testHTTPRequest{
129− Method: http.MethodOptions,
129+ Method: "OPTIONS",
130130 Header: baseHeaders,
131131 Body: []byte{},
132132 RequestURI: "/json/path",
@@ -152,7 +152,7 @@ var _ = Describe("Builder suite", func() {
152152 })
153153
154154 assertSuccessfulRequest(getBuilder, testHTTPRequest{
155− Method: http.MethodGet,
155+ Method: "GET",
156156 Header: header,
157157 Body: []byte{},
158158 RequestURI: "/json/path",
@@ -170,7 +170,7 @@ var _ = Describe("Builder suite", func() {
170170 })
171171
172172 assertSuccessfulRequest(getBuilder, testHTTPRequest{
173− Method: http.MethodGet,
173+ Method: "GET",
174174 Header: replacementHeaders,
175175 Body: []byte{},
176176 RequestURI: "/json/path",
@@ -190,7 +190,7 @@ var _ = Describe("Builder suite", func() {
190190 })
191191
192192 assertSuccessfulRequest(getBuilder, testHTTPRequest{
193− Method: http.MethodGet,
193+ Method: "GET",
194194 Header: replacementHeaders,
195195 Body: []byte{},
196196 RequestURI: "/json/path",
@@ -205,7 +205,7 @@ var _ = Describe("Builder suite", func() {
205205 })
206206
207207 assertSuccessfulRequest(getBuilder, testHTTPRequest{
208− Method: http.MethodGet,
208+ Method: "GET",
209209 Header: header,
210210 Body: []byte{},
211211 RequestURI: "/json/path",
@@ -219,12 +219,12 @@ var _ = Describe("Builder suite", func() {
219219 result := b.Do()
220220 Expect(result.Error()).ToNot(HaveOccurred())
221221
222− b.WithMethod(http.MethodPost)
222+ b.WithMethod("POST")
223223 })
224224
225225 Context("should not redo the request", func() {
226226 assertSuccessfulRequest(getBuilder, testHTTPRequest{
227− Method: http.MethodGet,
227+ Method: "GET",
228228 Header: baseHeaders,
229229 Body: []byte{},
230230 RequestURI: "/json/path",
pkg/requests/util/util.go+15−28
@@ -15,30 +15,30 @@ const (
1515)
1616
1717// GetRequestProto returns the request scheme or X-Forwarded-Proto if present
18−// and the request came from a trusted reverse proxy.
18+// and the request is proxied.
1919func GetRequestProto(req *http.Request) string {
2020 proto := req.Header.Get(XForwardedProto)
21− if !CanTrustForwardedHeaders(req) || proto == "" {
21+ if !IsProxied(req) || proto == "" {
2222 proto = req.URL.Scheme
2323 }
2424 return proto
2525}
2626
2727// GetRequestHost returns the request host header or X-Forwarded-Host if
28−// present and the request came from a trusted reverse proxy.
28+// present and the request is proxied.
2929func GetRequestHost(req *http.Request) string {
3030 host := req.Header.Get(XForwardedHost)
31− if !CanTrustForwardedHeaders(req) || host == "" {
31+ if !IsProxied(req) || host == "" {
3232 host = req.Host
3333 }
3434 return host
3535}
3636
3737// GetRequestURI return the request URI or X-Forwarded-Uri if present and the
38−// request came from a trusted reverse proxy.
38+// request is proxied.
3939func GetRequestURI(req *http.Request) string {
4040 uri := req.Header.Get(XForwardedURI)
41− if !CanTrustForwardedHeaders(req) || uri == "" {
41+ if !IsProxied(req) || uri == "" {
4242 // Use RequestURI to preserve ?query
4343 uri = req.URL.RequestURI()
4444 }
@@ -46,29 +46,17 @@ func GetRequestURI(req *http.Request) string {
4646}
4747
4848// GetRequestPath returns the request URI or X-Forwarded-Uri if present and the
49−// request came from a trusted reverse proxy but always strips the query
50−// parameters and fragment suffixes and only returns the pure path.
49+// request is proxied but always strips the query parameters and only returns
50+// the pure path
5151func GetRequestPath(req *http.Request) string {
52− uri := stripRequestFragment(GetRequestURI(req))
52+ uri := GetRequestURI(req)
5353
5454 // Parse URI and return only the path component
5555 if parsedURL, err := url.Parse(uri); err == nil {
56− return stripRequestFragment(parsedURL.Path)
56+ return parsedURL.Path
5757 }
5858
5959 // Fallback: strip query parameters manually
60− return stripRequestQuery(uri)
61−}
62−
63−func stripRequestFragment(uri string) string {
64− if idx := strings.Index(uri, "#"); idx != -1 {
65− return uri[:idx]
66− }
67−
68− return uri
69−}
70−
71−func stripRequestQuery(uri string) string {
7260 if idx := strings.Index(uri, "?"); idx != -1 {
7361 return uri[:idx]
7462 }
@@ -76,18 +64,17 @@ func stripRequestQuery(uri string) string {
7664 return uri
7765}
7866
79−// CanTrustForwardedHeaders determines if forwarded headers should be processed
80−// based on the RequestScope and the direct caller's address.
81−func CanTrustForwardedHeaders(req *http.Request) bool {
67+// IsProxied determines if a request was from a proxy based on the RequestScope
68+// ReverseProxy tracker.
69+func IsProxied(req *http.Request) bool {
8270 scope := middlewareapi.GetRequestScope(req)
8371 if scope == nil {
8472 return false
8573 }
86−
87− return scope.CanTrustForwardedHeaders(req)
74+ return scope.ReverseProxy
8875}
8976
9077func IsForwardedRequest(req *http.Request) bool {
91− return CanTrustForwardedHeaders(req) &&
78+ return IsProxied(req) &&
9279 req.Host != GetRequestHost(req)
9380}
pkg/requests/util/util_test.go+12−74
@@ -6,7 +6,6 @@ import (
66 "net/http/httptest"
77
88 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/middleware"
9− "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/ip"
109 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/requests/util"
1110 . "github.com/onsi/ginkgo/v2"
1211 . "github.com/onsi/gomega"
@@ -20,13 +19,8 @@ var _ = Describe("Util Suite", func() {
2019 uriNoQueryParams = "/test/endpoint"
2120 )
2221 var req *http.Request
23− var trustedProxies *ip.NetSet
2422
2523 BeforeEach(func() {
26− var err error
27− trustedProxies, err = ip.ParseNetSet([]string{"127.0.0.1"})
28− Expect(err).ToNot(HaveOccurred())
29−
3024 req = httptest.NewRequest(
3125 http.MethodGet,
3226 fmt.Sprintf("%s://%s%s", proto, host, uriWithQueryParams),
@@ -35,7 +29,7 @@ var _ = Describe("Util Suite", func() {
3529 })
3630
3731 Context("GetRequestHost", func() {
38− Context("trusted forwarded headers are disabled", func() {
32+ Context("IsProxied is false", func() {
3933 BeforeEach(func() {
4034 req = middleware.AddRequestScope(req, &middleware.RequestScope{})
4135 })
@@ -50,12 +44,10 @@ var _ = Describe("Util Suite", func() {
5044 })
5145 })
5246
53− Context("trusted forwarded headers are enabled", func() {
47+ Context("IsProxied is true", func() {
5448 BeforeEach(func() {
55− req.RemoteAddr = "127.0.0.1:4180"
5649 req = middleware.AddRequestScope(req, &middleware.RequestScope{
57− ReverseProxy: true,
58− TrustedProxies: trustedProxies,
50+ ReverseProxy: true,
5951 })
6052 })
6153
@@ -71,7 +63,7 @@ var _ = Describe("Util Suite", func() {
7163 })
7264
7365 Context("GetRequestProto", func() {
74− Context("trusted forwarded headers are disabled", func() {
66+ Context("IsProxied is false", func() {
7567 BeforeEach(func() {
7668 req = middleware.AddRequestScope(req, &middleware.RequestScope{})
7769 })
@@ -86,12 +78,10 @@ var _ = Describe("Util Suite", func() {
8678 })
8779 })
8880
89− Context("trusted forwarded headers are enabled", func() {
81+ Context("IsProxied is true", func() {
9082 BeforeEach(func() {
91− req.RemoteAddr = "127.0.0.1:4180"
9283 req = middleware.AddRequestScope(req, &middleware.RequestScope{
93− ReverseProxy: true,
94− TrustedProxies: trustedProxies,
84+ ReverseProxy: true,
9585 })
9686 })
9787
@@ -107,7 +97,7 @@ var _ = Describe("Util Suite", func() {
10797 })
10898
10999 Context("GetRequestURI", func() {
110− Context("trusted forwarded headers are disabled", func() {
100+ Context("IsProxied is false", func() {
111101 BeforeEach(func() {
112102 req = middleware.AddRequestScope(req, &middleware.RequestScope{})
113103 })
@@ -122,12 +112,10 @@ var _ = Describe("Util Suite", func() {
122112 })
123113 })
124114
125− Context("trusted forwarded headers are enabled", func() {
115+ Context("IsProxied is true", func() {
126116 BeforeEach(func() {
127− req.RemoteAddr = "127.0.0.1:4180"
128117 req = middleware.AddRequestScope(req, &middleware.RequestScope{
129− ReverseProxy: true,
130− TrustedProxies: trustedProxies,
118+ ReverseProxy: true,
131119 })
132120 })
133121
@@ -143,7 +131,7 @@ var _ = Describe("Util Suite", func() {
143131 })
144132
145133 Context("GetRequestPath", func() {
146− Context("trusted forwarded headers are disabled", func() {
134+ Context("IsProxied is false", func() {
147135 BeforeEach(func() {
148136 req = middleware.AddRequestScope(req, &middleware.RequestScope{})
149137 })
@@ -152,35 +140,16 @@ var _ = Describe("Util Suite", func() {
152140 Expect(util.GetRequestPath(req)).To(Equal(uriNoQueryParams))
153141 })
154142
155− It("drops fragment content from a parsed request path", func() {
156− // Simulate net/http ParseRequestURI preserving '#' in URL.Path.
157− req.URL.Path = "/foo/secret#/bar"
158− req.URL.RawPath = "/foo/secret%23/bar"
159− Expect(util.GetRequestPath(req)).To(Equal("/foo/secret"))
160− })
161−
162− It("drops fragment-like suffixes from encoded number signs", func() {
163− req = httptest.NewRequest(
164− http.MethodGet,
165− fmt.Sprintf("%s://%s/foo/secret%%23/bar?query=param", proto, host),
166− nil,
167− )
168− req = middleware.AddRequestScope(req, &middleware.RequestScope{})
169− Expect(util.GetRequestPath(req)).To(Equal("/foo/secret"))
170− })
171−
172143 It("ignores X-Forwarded-Uri and returns the URI (without query params)", func() {
173144 req.Header.Add("X-Forwarded-Uri", "/some/other/path?query=param")
174145 Expect(util.GetRequestPath(req)).To(Equal(uriNoQueryParams))
175146 })
176147 })
177148
178− Context("trusted forwarded headers are enabled", func() {
149+ Context("IsProxied is true", func() {
179150 BeforeEach(func() {
180− req.RemoteAddr = "127.0.0.1:4180"
181151 req = middleware.AddRequestScope(req, &middleware.RequestScope{
182− ReverseProxy: true,
183− TrustedProxies: trustedProxies,
152+ ReverseProxy: true,
184153 })
185154 })
186155
@@ -192,37 +161,6 @@ var _ = Describe("Util Suite", func() {
192161 req.Header.Add("X-Forwarded-Uri", "/some/other/path?query=param")
193162 Expect(util.GetRequestPath(req)).To(Equal("/some/other/path"))
194163 })
195−
196− It("drops fragment-like suffixes from the X-Forwarded-Uri", func() {
197− req.Header.Add("X-Forwarded-Uri", "/foo/secret%23/bar?query=param")
198− Expect(util.GetRequestPath(req)).To(Equal("/foo/secret"))
199− })
200− })
201− })
202−
203− Context("CanTrustForwardedHeaders", func() {
204− It("returns false when no scope is present", func() {
205− Expect(util.CanTrustForwardedHeaders(req)).To(BeFalse())
206− })
207−
208− It("returns true when the remote address is trusted", func() {
209− req.RemoteAddr = "127.0.0.1:4180"
210− req = middleware.AddRequestScope(req, &middleware.RequestScope{
211− ReverseProxy: true,
212− TrustedProxies: trustedProxies,
213− })
214−
215− Expect(util.CanTrustForwardedHeaders(req)).To(BeTrue())
216− })
217−
218− It("returns false when the remote address is untrusted", func() {
219− req.RemoteAddr = "192.0.2.10:4180"
220− req = middleware.AddRequestScope(req, &middleware.RequestScope{
221− ReverseProxy: true,
222− TrustedProxies: trustedProxies,
223− })
224−
225− Expect(util.CanTrustForwardedHeaders(req)).To(BeFalse())
226164 })
227165 })
228166})
pkg/sessions/cookie/session_store.go+13−23
@@ -76,17 +76,7 @@ func (s *SessionStore) Clear(rw http.ResponseWriter, req *http.Request) error {
7676
7777 for _, c := range req.Cookies() {
7878 if cookieNameRegex.MatchString(c.Name) {
79− sessionCookieOptions := &pkgcookies.CookieOptions{
80− Name: c.Name,
81− Value: "",
82− Domains: s.Cookie.Domains,
83− Expiration: time.Hour * -1,
84− SameSite: s.Cookie.SameSite,
85− Path: s.Cookie.Path,
86− HTTPOnly: s.Cookie.HTTPOnly,
87− Secure: s.Cookie.Secure,
88− }
89− clearCookie := pkgcookies.MakeCookieFromOptions(req, sessionCookieOptions)
79+ clearCookie := s.makeCookie(req, c.Name, "", time.Hour*-1)
9080
9181 http.SetCookie(rw, clearCookie)
9282 }
@@ -127,7 +117,7 @@ func (s *SessionStore) setSessionCookie(rw http.ResponseWriter, req *http.Reques
127117 return nil
128118}
129119
130−// makeSessionCookie creates a http.Cookie containing the authenticated user's
120+// makeSessionCookie creates an http.Cookie containing the authenticated user's
131121// authentication details
132122func (s *SessionStore) makeSessionCookie(req *http.Request, value []byte, now time.Time) ([]*http.Cookie, error) {
133123 strValue := string(value)
@@ -142,23 +132,23 @@ func (s *SessionStore) makeSessionCookie(req *http.Request, value []byte, now ti
142132 return nil, err
143133 }
144134 }
145− sessionCookieOptions := &pkgcookies.CookieOptions{
146− Name: s.Cookie.Name,
147− Value: strValue,
148− Domains: s.Cookie.Domains,
149− Expiration: s.Cookie.Expire,
150− SameSite: s.Cookie.SameSite,
151− Path: s.Cookie.Path,
152− HTTPOnly: s.Cookie.HTTPOnly,
153− Secure: s.Cookie.Secure,
154− }
155− c := pkgcookies.MakeCookieFromOptions(req, sessionCookieOptions)
135+ c := s.makeCookie(req, s.Cookie.Name, strValue, s.Cookie.Expire)
156136 if len(c.String()) > maxCookieLength {
157137 return splitCookie(c), nil
158138 }
159139 return []*http.Cookie{c}, nil
160140}
161141
142+func (s *SessionStore) makeCookie(req *http.Request, name string, value string, expiration time.Duration) *http.Cookie {
143+ return pkgcookies.MakeCookieFromOptions(
144+ req,
145+ name,
146+ value,
147+ s.Cookie,
148+ expiration,
149+ )
150+}
151+
162152// NewCookieSessionStore initialises a new instance of the SessionStore from
163153// the configuration given
164154func NewCookieSessionStore(opts *options.SessionOptions, cookieOpts *options.Cookie) (sessions.SessionStore, error) {
pkg/sessions/persistence/ticket.go+14−23
@@ -221,17 +221,13 @@ func (t *ticket) setCookie(rw http.ResponseWriter, req *http.Request, s *session
221221// clearCookie removes any cookies that would be where this ticket
222222// would set them
223223func (t *ticket) clearCookie(rw http.ResponseWriter, req *http.Request) {
224− cookieOptions := &cookies.CookieOptions{
225− Name: t.options.Name,
226− Value: "",
227− Domains: t.options.Domains,
228− Expiration: time.Hour * -1,
229− SameSite: t.options.SameSite,
230− Path: t.options.Path,
231− HTTPOnly: t.options.HTTPOnly,
232− Secure: t.options.Secure,
233− }
234− http.SetCookie(rw, cookies.MakeCookieFromOptions(req, cookieOptions))
224+ http.SetCookie(rw, cookies.MakeCookieFromOptions(
225+ req,
226+ t.options.Name,
227+ "",
228+ t.options,
229+ time.Hour*-1,
230+ ))
235231}
236232
237233// makeCookie makes a cookie, signing the value if present
@@ -248,18 +244,13 @@ func (t *ticket) makeCookie(req *http.Request, value string, expires time.Durati
248244 }
249245 }
250246
251− cookieOptions := &cookies.CookieOptions{
252− Name: t.options.Name,
253− Value: value,
254− Domains: t.options.Domains,
255− Expiration: expires,
256− SameSite: t.options.SameSite,
257− Path: t.options.Path,
258− HTTPOnly: t.options.HTTPOnly,
259− Secure: t.options.Secure,
260− }
261−
262− return cookies.MakeCookieFromOptions(req, cookieOptions), nil
247+ return cookies.MakeCookieFromOptions(
248+ req,
249+ t.options.Name,
250+ value,
251+ t.options,
252+ expires,
253+ ), nil
263254}
264255
265256// makeCipher makes a AES-GCM cipher out of the ticket's secret
pkg/sessions/redis/redis_store.go+8−15
@@ -109,9 +109,6 @@ func buildSentinelClient(opts options.RedisStoreOptions) (Client, error) {
109109 if opts.Username != "" {
110110 opt.Username = opts.Username
111111 }
112− if opts.IdleTimeout > 0 {
113− opt.ConnMaxIdleTime = time.Duration(opts.IdleTimeout) * time.Second
114− }
115112
116113 if err := setupTLSConfig(opts, opt); err != nil {
117114 return nil, err
@@ -121,10 +118,10 @@ func buildSentinelClient(opts options.RedisStoreOptions) (Client, error) {
121118 MasterName: opts.SentinelMasterName,
122119 SentinelAddrs: addrs,
123120 SentinelPassword: opts.SentinelPassword,
124− Username: opt.Username,
125− Password: opt.Password,
121+ Username: opts.Username,
122+ Password: opts.Password,
126123 TLSConfig: opt.TLSConfig,
127− ConnMaxIdleTime: opt.ConnMaxIdleTime,
124+ ConnMaxIdleTime: time.Duration(opts.IdleTimeout) * time.Second,
128125 })
129126 return newClient(client), nil
130127}
@@ -142,9 +139,6 @@ func buildClusterClient(opts options.RedisStoreOptions) (Client, error) {
142139 if opts.Username != "" {
143140 opt.Username = opts.Username
144141 }
145− if opts.IdleTimeout > 0 {
146− opt.ConnMaxIdleTime = time.Duration(opts.IdleTimeout) * time.Second
147− }
148142
149143 if err := setupTLSConfig(opts, opt); err != nil {
150144 return nil, err
@@ -152,10 +146,10 @@ func buildClusterClient(opts options.RedisStoreOptions) (Client, error) {
152146
153147 client := redis.NewClusterClient(&redis.ClusterOptions{
154148 Addrs: addrs,
155− Username: opt.Username,
156− Password: opt.Password,
149+ Username: opts.Username,
150+ Password: opts.Password,
157151 TLSConfig: opt.TLSConfig,
158− ConnMaxIdleTime: opt.ConnMaxIdleTime,
152+ ConnMaxIdleTime: time.Duration(opts.IdleTimeout) * time.Second,
159153 })
160154 return newClusterClient(client), nil
161155}
@@ -174,14 +168,13 @@ func buildStandaloneClient(opts options.RedisStoreOptions) (Client, error) {
174168 if opts.Username != "" {
175169 opt.Username = opts.Username
176170 }
177− if opts.IdleTimeout > 0 {
178− opt.ConnMaxIdleTime = time.Duration(opts.IdleTimeout) * time.Second
179− }
180171
181172 if err := setupTLSConfig(opts, opt); err != nil {
182173 return nil, err
183174 }
184175
176+ opt.ConnMaxIdleTime = time.Duration(opts.IdleTimeout) * time.Second
177+
185178 client := redis.NewClient(opt)
186179 return newClient(client), nil
187180}
pkg/sessions/redis/redis_store_test.go−50
@@ -1,7 +1,6 @@
11package redis
22
33import (
4− "fmt"
54 "time"
65
76 "github.com/Bose/minisentinel"
@@ -247,55 +246,6 @@ var _ = Describe("Redis SessionStore Tests", func() {
247246 })
248247
249248 Describe("Redis URL Parsing", func() {
250− It("should prefer configured username password and timeout over URL parameters", func() {
251− configuredUsername := "configured-user"
252− configuredPassword := "configured-password"
253− configuredIdleTimeout := 90
254−
255− urlUsername := "url-user"
256− urlPassword := "url-password"
257− urlIdleTimeout := 30
258−
259− redisClient, err := buildStandaloneClient(options.RedisStoreOptions{
260− ConnectionURL: fmt.Sprintf("redis://%s:%s@localhost:6379?conn_max_idle_time=%d", urlUsername, urlPassword, urlIdleTimeout),
261− Username: configuredUsername,
262− Password: configuredPassword,
263− IdleTimeout: configuredIdleTimeout,
264− })
265− Expect(err).ToNot(HaveOccurred())
266−
267− rc, ok := redisClient.(*client)
268− Expect(ok).To(BeTrue())
269− Expect(rc.Close()).To(Succeed())
270−
271− redisOptions := rc.Options()
272− Expect(redisOptions.Username).To(Equal(configuredUsername))
273− Expect(redisOptions.Password).To(Equal(configuredPassword))
274− Expect(redisOptions.ConnMaxIdleTime).To(Equal(time.Duration(configuredIdleTimeout) * time.Second))
275− })
276− It("should prefer URL username password and timeout when configured values are empty", func() {
277− urlUsername := "url-user"
278− urlPassword := "url-password"
279− urlIdleTimeout := 30
280−
281− redisClient, err := buildStandaloneClient(options.RedisStoreOptions{
282− ConnectionURL: fmt.Sprintf("redis://%s:%s@localhost:6379?conn_max_idle_time=%d", urlUsername, urlPassword, urlIdleTimeout),
283− Username: "",
284− Password: "",
285− IdleTimeout: 0,
286− })
287− Expect(err).ToNot(HaveOccurred())
288−
289− rc, ok := redisClient.(*client)
290− Expect(ok).To(BeTrue())
291− Expect(rc.Close()).To(Succeed())
292−
293− redisOptions := rc.Options()
294− Expect(redisOptions.Username).To(Equal(urlUsername))
295− Expect(redisOptions.Password).To(Equal(urlPassword))
296− Expect(redisOptions.ConnMaxIdleTime).To(Equal(time.Duration(urlIdleTimeout) * time.Second))
297− })
298−
299249 It("should parse valid redis URL", func() {
300250 addrs, opts, err := parseRedisURLs([]string{"redis://localhost:6379"})
301251 Expect(err).ToNot(HaveOccurred())
pkg/sessions/tests/session_store_tests.go+1−11
@@ -422,17 +422,7 @@ func SessionStoreInterfaceTests(in *testInput) {
422422 broken := "BrokenSessionFromADifferentSessionImplementation"
423423 value, err := encryption.SignedValue(in.cookieOpts.Secret, in.cookieOpts.Name, []byte(broken), time.Now())
424424 Expect(err).ToNot(HaveOccurred())
425− cookieOptions := &cookiesapi.CookieOptions{
426− Name: in.cookieOpts.Name,
427− Value: value,
428− Domains: in.cookieOpts.Domains,
429− Expiration: in.cookieOpts.Expire,
430− SameSite: in.cookieOpts.SameSite,
431− Path: in.cookieOpts.Path,
432− HTTPOnly: in.cookieOpts.HTTPOnly,
433− Secure: in.cookieOpts.Secure,
434− }
435− cookie := cookiesapi.MakeCookieFromOptions(in.request, cookieOptions)
425+ cookie := cookiesapi.MakeCookieFromOptions(in.request, in.cookieOpts.Name, value, in.cookieOpts, in.cookieOpts.Expire)
436426 in.request.AddCookie(cookie)
437427
438428 err = in.ss().Save(in.response, in.request, in.session)
pkg/upstream/http.go+18−66
@@ -55,7 +55,7 @@ func newHTTPUpstreamProxy(upstream options.Upstream, u *url.URL, sigData *option
5555 // Set up a WebSocket proxy if required
5656 var wsProxy http.Handler
5757 if ptr.Deref(upstream.ProxyWebSockets, options.DefaultUpstreamProxyWebSockets) {
58− wsProxy = newWebSocketReverseProxy(u, upstream.InsecureSkipTLSVerify, upstream.PassHostHeader)
58+ wsProxy = newWebSocketReverseProxy(u, upstream.InsecureSkipTLSVerify)
5959 }
6060
6161 var auth hmacauth.HmacAuth
@@ -123,7 +123,7 @@ func (t *unixRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)
123123// The proxy should render an error page if there are failures connecting to the
124124// upstream server.
125125func newReverseProxy(target *url.URL, upstream options.Upstream, errorHandler ProxyErrorHandler) http.Handler {
126− proxy := newSingleHostReverseProxy(target)
126+ proxy := httputil.NewSingleHostReverseProxy(target)
127127
128128 // Inherit default transport options from Go's stdlib
129129 transport := http.DefaultTransport.(*http.Transport).Clone()
@@ -155,10 +155,8 @@ func newReverseProxy(target *url.URL, upstream options.Upstream, errorHandler Pr
155155 }
156156
157157 // Ensure we always pass the original request path
158− setProxyRewrite(proxy)
158+ setProxyDirector(proxy)
159159
160− // TODO (@tuunit) - this should be inverted or get a better name in the future to set the upstream host header
161− // only if PassHostHeader is explicitly set to true. Currently this would be a breaking change.
162160 if !ptr.Deref(upstream.PassHostHeader, options.DefaultUpstreamPassHostHeader) {
163161 setProxyUpstreamHostHeader(proxy, target)
164162 }
@@ -179,71 +177,32 @@ func newReverseProxy(target *url.URL, upstream options.Upstream, errorHandler Pr
179177 return proxy
180178}
181179
182−func newSingleHostReverseProxy(target *url.URL) *httputil.ReverseProxy {
183− return &httputil.ReverseProxy{
184− Rewrite: func(proxyReq *httputil.ProxyRequest) {
185− proxyReq.SetURL(target)
186− proxyReq.Out.Host = proxyReq.In.Host
187− setProxyForwardingHeaders(proxyReq)
188− },
189− }
190−}
191−
192−// setProxyUpstreamHostHeader sets the proxy.Rewrite so that upstream requests
180+// setProxyUpstreamHostHeader sets the proxy.Director so that upstream requests
193181// receive a host header matching the target URL.
194182func setProxyUpstreamHostHeader(proxy *httputil.ReverseProxy, target *url.URL) {
195− rewrite := proxy.Rewrite
196− proxy.Rewrite = func(proxyReq *httputil.ProxyRequest) {
197− rewrite(proxyReq)
198− proxyReq.Out.Host = target.Host
183+ director := proxy.Director
184+ proxy.Director = func(req *http.Request) {
185+ director(req)
186+ req.Host = target.Host
199187 }
200188}
201189
202−// setProxyRewrite sets the proxy.Rewrite so that request URIs are escaped
190+// setProxyDirector sets the proxy.Director so that request URIs are escaped
203191// when proxying to usptream servers.
204−func setProxyRewrite(proxy *httputil.ReverseProxy) {
205− rewrite := proxy.Rewrite
206− proxy.Rewrite = func(proxyReq *httputil.ProxyRequest) {
207− rewrite(proxyReq)
192+func setProxyDirector(proxy *httputil.ReverseProxy) {
193+ director := proxy.Director
194+ proxy.Director = func(req *http.Request) {
195+ director(req)
208196 // use RequestURI so that we aren't unescaping encoded slashes in the request path
209− proxyReq.Out.URL.Opaque = proxyReq.In.RequestURI
210− proxyReq.Out.URL.RawQuery = ""
211− proxyReq.Out.URL.ForceQuery = false
212− }
213−}
214−
215−func setProxyForwardingHeaders(proxyReq *httputil.ProxyRequest) {
216− // TODO (@tuunit): Preserve the legacy Director-based forwarding header behavior
217− // for backwards compatibility. Harden this with saner defaults and/or
218− // explicit flags in the future.
219− for _, header := range []string{"Forwarded", "X-Forwarded-Host", "X-Forwarded-Proto"} {
220− if values, ok := proxyReq.In.Header[header]; ok {
221− proxyReq.Out.Header[header] = append([]string(nil), values...)
222− }
223− }
224−
225− prior, ok := proxyReq.In.Header["X-Forwarded-For"]
226− if ok {
227− proxyReq.Out.Header["X-Forwarded-For"] = append([]string(nil), prior...)
228− }
229−
230− clientIP, _, err := net.SplitHostPort(proxyReq.In.RemoteAddr)
231− if err != nil {
232− return
233− }
234−
235− omit := ok && prior == nil
236− if len(prior) > 0 {
237− clientIP = strings.Join(prior, ", ") + ", " + clientIP
238− }
239− if !omit {
240− proxyReq.Out.Header.Set("X-Forwarded-For", clientIP)
197+ req.URL.Opaque = req.RequestURI
198+ req.URL.RawQuery = ""
199+ req.URL.ForceQuery = false
241200 }
242201}
243202
244203// newWebSocketReverseProxy creates a new reverse proxy for proxying websocket connections.
245−func newWebSocketReverseProxy(u *url.URL, skipTLSVerify *bool, passHostHeader *bool) http.Handler {
246− wsProxy := newSingleHostReverseProxy(u)
204+func newWebSocketReverseProxy(u *url.URL, skipTLSVerify *bool) http.Handler {
205+ wsProxy := httputil.NewSingleHostReverseProxy(u)
247206
248207 // Inherit default transport options from Go's stdlib
249208 transport := http.DefaultTransport.(*http.Transport).Clone()
@@ -256,12 +215,5 @@ func newWebSocketReverseProxy(u *url.URL, skipTLSVerify *bool, passHostHeader *b
256215 // Apply the customized transport to our proxy before returning it
257216 wsProxy.Transport = transport
258217
259− // TODO (@tuunit) - this should be inverted or get a better name in the future to set the upstream host header
260− // only if PassHostHeader is explicitly set to true. Currently this would be a breaking change.
261− // Set upstream host header if PassHostHeader is false (same as regular HTTP proxy)
262− if !ptr.Deref(passHostHeader, options.DefaultUpstreamPassHostHeader) {
263− setProxyUpstreamHostHeader(wsProxy, u)
264− }
265−
266218 return wsProxy
267219}
pkg/upstream/http_test.go+14−109
@@ -63,8 +63,8 @@ var _ = Describe("HTTP Upstream Suite", func() {
6363 upstream := options.Upstream{
6464 ID: in.id,
6565 PassHostHeader: &in.passUpstreamHostHeader,
66− ProxyWebSockets: ptr.To(false),
67− InsecureSkipTLSVerify: ptr.To(false),
66+ ProxyWebSockets: ptr.Ptr(false),
67+ InsecureSkipTLSVerify: ptr.Ptr(false),
6868 FlushInterval: &flush,
6969 Timeout: &timeout,
7070 }
@@ -342,9 +342,9 @@ var _ = Describe("HTTP Upstream Suite", func() {
342342
343343 upstream := options.Upstream{
344344 ID: "noPassHost",
345− PassHostHeader: ptr.To(false),
346− ProxyWebSockets: ptr.To(false),
347− InsecureSkipTLSVerify: ptr.To(false),
345+ PassHostHeader: ptr.Ptr(false),
346+ ProxyWebSockets: ptr.Ptr(false),
347+ InsecureSkipTLSVerify: ptr.Ptr(false),
348348 FlushInterval: &defaultFlushInterval,
349349 Timeout: &defaultTimeout,
350350 }
@@ -361,12 +361,7 @@ var _ = Describe("HTTP Upstream Suite", func() {
361361 return http.HandlerFunc(func(_ http.ResponseWriter, req *http.Request) {
362362 proxy, ok := h.(*httputil.ReverseProxy)
363363 Expect(ok).To(BeTrue())
364− outReq := req.Clone(req.Context())
365− proxy.Rewrite(&httputil.ProxyRequest{
366− In: req,
367− Out: outReq,
368− })
369− req.Host = outReq.Host
364+ proxy.Director(req)
370365 })
371366 }
372367 httpUpstream.handler = requestInterceptor(httpUpstream.handler)
@@ -375,54 +370,6 @@ var _ = Describe("HTTP Upstream Suite", func() {
375370 Expect(req.Host).To(Equal(strings.TrimPrefix(serverAddr, "http://")))
376371 })
377372
378− It("ServeHTTP preserves forwarding headers when using Rewrite", func() {
379− req := httptest.NewRequest("", "http://example.localhost/foo", nil)
380− req.RemoteAddr = "192.0.2.10:1234"
381− req.Header.Set("Forwarded", "for=192.0.2.1;proto=https;host=example.localhost")
382− req.Header.Set("X-Forwarded-Host", "forwarded.example.localhost")
383− req.Header.Set("X-Forwarded-Proto", "https")
384− req.Header.Set("X-Forwarded-For", "192.0.2.1")
385− req = middlewareapi.AddRequestScope(req, &middlewareapi.RequestScope{})
386− rw := httptest.NewRecorder()
387−
388− upstream := options.Upstream{
389− ID: "preserveForwardedHeaders",
390− PassHostHeader: ptr.To(true),
391− ProxyWebSockets: ptr.To(false),
392− InsecureSkipTLSVerify: ptr.To(false),
393− FlushInterval: &defaultFlushInterval,
394− Timeout: &defaultTimeout,
395− }
396−
397− u, err := url.Parse(serverAddr)
398− Expect(err).ToNot(HaveOccurred())
399−
400− handler := newHTTPUpstreamProxy(upstream, u, nil, nil)
401− httpUpstream, ok := handler.(*httpUpstreamProxy)
402− Expect(ok).To(BeTrue())
403−
404− requestInterceptor := func(h http.Handler) http.Handler {
405− return http.HandlerFunc(func(_ http.ResponseWriter, req *http.Request) {
406− proxy, ok := h.(*httputil.ReverseProxy)
407− Expect(ok).To(BeTrue())
408−
409− outReq := req.Clone(req.Context())
410− proxy.Rewrite(&httputil.ProxyRequest{
411− In: req,
412− Out: outReq,
413− })
414−
415− Expect(outReq.Header.Values("Forwarded")).To(Equal([]string{"for=192.0.2.1;proto=https;host=example.localhost"}))
416− Expect(outReq.Header.Values("X-Forwarded-Host")).To(Equal([]string{"forwarded.example.localhost"}))
417− Expect(outReq.Header.Values("X-Forwarded-Proto")).To(Equal([]string{"https"}))
418− Expect(outReq.Header.Values("X-Forwarded-For")).To(Equal([]string{"192.0.2.1, 192.0.2.10"}))
419− })
420− }
421− httpUpstream.handler = requestInterceptor(httpUpstream.handler)
422−
423− httpUpstream.ServeHTTP(rw, req)
424− })
425−
426373 type newUpstreamTableInput struct {
427374 proxyWebSockets bool
428375 flushInterval time.Duration
@@ -458,7 +405,6 @@ var _ = Describe("HTTP Upstream Suite", func() {
458405
459406 proxy, ok := upstreamProxy.handler.(*httputil.ReverseProxy)
460407 Expect(ok).To(BeTrue())
461− Expect(proxy.Rewrite).ToNot(BeNil())
462408 Expect(proxy.FlushInterval).To(Equal(in.flushInterval))
463409 transport, ok := proxy.Transport.(*http.Transport)
464410 Expect(ok).To(BeTrue())
@@ -540,9 +486,9 @@ var _ = Describe("HTTP Upstream Suite", func() {
540486 timeout := options.DefaultUpstreamTimeout
541487 upstream := options.Upstream{
542488 ID: "websocketProxy",
543− PassHostHeader: ptr.To(true),
544− ProxyWebSockets: ptr.To(true),
545− InsecureSkipTLSVerify: ptr.To(false),
489+ PassHostHeader: ptr.Ptr(true),
490+ ProxyWebSockets: ptr.Ptr(true),
491+ InsecureSkipTLSVerify: ptr.Ptr(false),
546492 FlushInterval: &flush,
547493 Timeout: &timeout,
548494 }
@@ -552,7 +498,7 @@ var _ = Describe("HTTP Upstream Suite", func() {
552498
553499 handler := newHTTPUpstreamProxy(upstream, u, nil, nil)
554500
555− proxyServer = httptest.NewServer(middleware.NewScope(false, "X-Request-Id", nil)(handler))
501+ proxyServer = httptest.NewServer(middleware.NewScope(false, "X-Request-Id")(handler))
556502 })
557503
558504 AfterEach(func() {
@@ -573,11 +519,10 @@ var _ = Describe("HTTP Upstream Suite", func() {
573519 Expect(websocket.Message.Send(ws, []byte(message))).To(Succeed())
574520 var response testWebSocketResponse
575521 Expect(websocket.JSON.Receive(ws, &response)).To(Succeed())
576−
577− // When PassHostHeader=true (default), the Host should be the client's original request host
578− Expect(response.Message).To(Equal(message))
579− Expect(response.Origin).To(Equal(origin))
580− Expect(response.Host).To(Equal(proxyURL.Host))
522+ Expect(response).To(Equal(testWebSocketResponse{
523+ Message: message,
524+ Origin: origin,
525+ }))
581526 })
582527
583528 It("will proxy HTTP requests", func() {
@@ -585,45 +530,5 @@ var _ = Describe("HTTP Upstream Suite", func() {
585530 Expect(err).ToNot(HaveOccurred())
586531 Expect(response.StatusCode).To(Equal(200))
587532 })
588−
589− It("will proxy websockets respecting PassHostHeader=false", func() {
590− // Create a new proxy server with PassHostHeader=false
591− flush := 1 * time.Second
592− timeout := options.DefaultUpstreamTimeout
593− upstream := options.Upstream{
594− ID: "websocketProxyNoPassHost",
595− PassHostHeader: ptr.To(false),
596− ProxyWebSockets: ptr.To(true),
597− InsecureSkipTLSVerify: ptr.To(false),
598− FlushInterval: &flush,
599− Timeout: &timeout,
600− }
601−
602− u, err := url.Parse(serverAddr)
603− Expect(err).ToNot(HaveOccurred())
604−
605− handler := newHTTPUpstreamProxy(upstream, u, nil, nil)
606− noPassHostServer := httptest.NewServer(middleware.NewScope(false, "X-Request-Id", nil)(handler))
607− defer noPassHostServer.Close()
608−
609− origin := "http://example.localhost"
610− message := "Hello, world!"
611−
612− proxyURL, err := url.Parse(fmt.Sprintf("http://%s", noPassHostServer.Listener.Addr().String()))
613− Expect(err).ToNot(HaveOccurred())
614−
615− wsAddr := fmt.Sprintf("ws://%s/", proxyURL.Host)
616− ws, err := websocket.Dial(wsAddr, "", origin)
617− Expect(err).ToNot(HaveOccurred())
618−
619− Expect(websocket.Message.Send(ws, []byte(message))).To(Succeed())
620− var response testWebSocketResponse
621− Expect(websocket.JSON.Receive(ws, &response)).To(Succeed())
622−
623− // When PassHostHeader=false, the Host should be the upstream server address
624− Expect(response.Host).To(Equal(u.Host))
625− Expect(response.Message).To(Equal(message))
626− Expect(response.Origin).To(Equal(origin))
627− })
628533 })
629534})
pkg/upstream/proxy.go+14−14
@@ -58,9 +58,7 @@ func NewProxy(upstreams options.UpstreamConfig, sigData *options.SignatureData,
5858 }
5959 }
6060
61− if err := registerTrailingSlashHandler(m.serveMux); err != nil {
62− return nil, fmt.Errorf("could not register trailing slash handler: %w", err)
63− }
61+ registerTrailingSlashHandler(m.serveMux)
6462 return m, nil
6563}
6664
@@ -96,7 +94,8 @@ func (m *multiUpstreamProxy) registerHTTPUpstreamProxy(upstream options.Upstream
9694// registerHandler ensures the given handler is regiestered with the serveMux.
9795func (m *multiUpstreamProxy) registerHandler(upstream options.Upstream, handler http.Handler, writer pagewriter.Writer) error {
9896 if upstream.RewriteTarget == "" {
99− return m.registerSimpleHandler(upstream.Path, handler)
97+ m.registerSimpleHandler(upstream.Path, handler)
98+ return nil
10099 }
101100
102101 return m.registerRewriteHandler(upstream, handler, writer)
@@ -104,12 +103,12 @@ func (m *multiUpstreamProxy) registerHandler(upstream options.Upstream, handler
104103
105104// registerSimpleHandler maintains the behaviour of the go standard serveMux
106105// by ensuring any path with a trailing `/` matches all paths under that prefix.
107−func (m *multiUpstreamProxy) registerSimpleHandler(path string, handler http.Handler) error {
106+func (m *multiUpstreamProxy) registerSimpleHandler(path string, handler http.Handler) {
108107 if strings.HasSuffix(path, "/") {
109− return m.serveMux.PathPrefix(path).Handler(handler).GetError()
108+ m.serveMux.PathPrefix(path).Handler(handler)
109+ } else {
110+ m.serveMux.Path(path).Handler(handler)
110111 }
111−
112− return m.serveMux.Path(path).Handler(handler).GetError()
113112}
114113
115114// registerRewriteHandler ensures the handler is registered for all paths
@@ -124,18 +123,19 @@ func (m *multiUpstreamProxy) registerRewriteHandler(upstream options.Upstream, h
124123
125124 rewrite := newRewritePath(rewriteRegExp, upstream.RewriteTarget, writer)
126125 h := alice.New(rewrite).Then(handler)
127−
128− return m.serveMux.MatcherFunc(func(req *http.Request, _ *mux.RouteMatch) bool {
126+ m.serveMux.MatcherFunc(func(req *http.Request, _ *mux.RouteMatch) bool {
129127 return rewriteRegExp.MatchString(req.URL.Path)
130− }).Handler(h).GetError()
128+ }).Handler(h)
129+
130+ return nil
131131}
132132
133133// registerTrailingSlashHandler creates a new matcher that will check if the
134134// requested path would match if it had a trailing slash appended.
135135// If the path matches with a trailing slash, we send back a redirect.
136136// This allows us to be consistent with the built in go servemux implementation.
137−func registerTrailingSlashHandler(serveMux *mux.Router) error {
138− return serveMux.MatcherFunc(func(req *http.Request, _ *mux.RouteMatch) bool {
137+func registerTrailingSlashHandler(serveMux *mux.Router) {
138+ serveMux.MatcherFunc(func(req *http.Request, _ *mux.RouteMatch) bool {
139139 if strings.HasSuffix(req.URL.Path, "/") {
140140 return false
141141 }
@@ -149,7 +149,7 @@ func registerTrailingSlashHandler(serveMux *mux.Router) error {
149149 return serveMux.Match(slashReq, m)
150150 }).Handler(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
151151 http.Redirect(rw, req, req.URL.String()+"/", http.StatusMovedPermanently)
152− })).GetError()
152+ }))
153153}
154154
155155// sortByPathLongest ensures that the upstreams are sorted by longest path.
pkg/upstream/proxy_test.go+6−38
@@ -61,30 +61,30 @@ var _ = Describe("Proxy Suite", func() {
6161 {
6262 ID: "static-backend",
6363 Path: "/static/",
64− Static: ptr.To(true),
64+ Static: ptr.Ptr(true),
6565 StaticCode: &ok,
6666 },
6767 {
6868 ID: "static-backend-no-trailing-slash",
6969 Path: "/static",
70− Static: ptr.To(true),
70+ Static: ptr.Ptr(true),
7171 StaticCode: &accepted,
7272 },
7373 {
7474 ID: "static-backend-long",
7575 Path: "/static/long",
76− Static: ptr.To(true),
76+ Static: ptr.Ptr(true),
7777 StaticCode: &accepted,
7878 },
7979 {
8080 ID: "bad-http-backend",
8181 Path: "/bad-http/",
82− URI: invalidServer,
82+ URI: "http://::1",
8383 },
8484 {
8585 ID: "single-path-backend",
8686 Path: "/single-path",
87− Static: ptr.To(true),
87+ Static: ptr.Ptr(true),
8888 StaticCode: &ok,
8989 },
9090 {
@@ -347,7 +347,7 @@ var _ = Describe("Proxy Suite", func() {
347347 upstream: "",
348348 }),
349349 Entry("containing an escaped '/' with ProxyRawPath", &proxyTableInput{
350− upstreams: options.UpstreamConfig{ProxyRawPath: ptr.To(true)},
350+ upstreams: options.UpstreamConfig{ProxyRawPath: ptr.Ptr(true)},
351351 target: "http://example.localhost/%2F/test1/%2F/test2",
352352 response: testHTTPResponse{
353353 code: 404,
@@ -383,38 +383,6 @@ var _ = Describe("Proxy Suite", func() {
383383 )
384384 })
385385
386− Context("multiUpstreamProxy errors", func() {
387− type proxyErrorTableInput struct {
388− upstreams options.UpstreamConfig
389− expectedError string
390− }
391−
392− DescribeTable("NewProxy", func(in *proxyErrorTableInput) {
393− sigData := &options.SignatureData{Hash: crypto.SHA256, Key: "secret"}
394−
395− writer := &pagewriter.WriterFuncs{
396− ProxyErrorFunc: func(rw http.ResponseWriter, _ *http.Request, _ error) {
397− rw.WriteHeader(502)
398− rw.Write([]byte("Proxy Error"))
399− },
400− }
401−
402− _, err := NewProxy(in.upstreams, sigData, writer)
403− Expect(err).To(MatchError(in.expectedError))
404− },
405− Entry("regex matcher without rewrite target", &proxyErrorTableInput{
406− upstreams: options.UpstreamConfig{
407− Upstreams: []options.Upstream{{
408− ID: "api",
409− Path: "^/api/$",
410− URI: "http://example.com",
411− }},
412− },
413− expectedError: `could not register http upstream "api": mux: path must start with a slash, got "^/api/$"`,
414− }),
415− )
416− })
417−
418386 Context("sortByPathLongest", func() {
419387 type sortByPathLongestTableInput struct {
420388 input []options.Upstream
pkg/upstream/upstream_suite_test.go+1−3
@@ -24,7 +24,7 @@ var (
2424 serverAddr string
2525 unixServer *httptest.Server
2626 unixServerAddr string
27− invalidServer = "http://127.0.0.1:1"
27+ invalidServer = "http://::1"
2828)
2929
3030func TestUpstreamSuite(t *testing.T) {
@@ -96,7 +96,6 @@ type testHTTPRequest struct {
9696type testWebSocketResponse struct {
9797 Message string
9898 Origin string
99− Host string
10099}
101100
102101type testHTTPUpstream struct{}
@@ -139,7 +138,6 @@ func (t *testHTTPUpstream) websocketHandler() http.Handler {
139138 wsResponse := testWebSocketResponse{
140139 Message: string(data),
141140 Origin: ws.Request().Header.Get("Origin"),
142− Host: ws.Request().Host,
143141 }
144142 err = websocket.JSON.Send(ws, wsResponse)
145143 if err != nil {
pkg/util/ptr/ptr.go+2−2
@@ -1,7 +1,7 @@
11package ptr
22
3−// To generically returns a pointer to the given value.
4−func To[T any](v T) *T {
3+// Ptr generically returns a pointer to the given value.
4+func Ptr[T any](v T) *T {
55 return &v
66}
77
pkg/util/ptr/ptr_test.go+6−6
@@ -6,22 +6,22 @@ import (
66 "github.com/stretchr/testify/assert"
77)
88
9−func TestTo(t *testing.T) {
10− p := To(42)
9+func TestPtr(t *testing.T) {
10+ p := Ptr(42)
1111 assert.NotNil(t, p)
1212 assert.Equal(t, 42, *p)
1313
14− s := To("hello")
14+ s := Ptr("hello")
1515 assert.NotNil(t, s)
1616 assert.Equal(t, "hello", *s)
1717
18− b := To(true)
18+ b := Ptr(true)
1919 assert.NotNil(t, b)
2020 assert.True(t, *b)
2121}
2222
2323func TestDeref(t *testing.T) {
24− v := Deref(To(99), 0)
24+ v := Deref(Ptr(99), 0)
2525 assert.Equal(t, 99, v)
2626
2727 v = Deref[int](nil, 123)
@@ -30,7 +30,7 @@ func TestDeref(t *testing.T) {
3030 s := Deref[string](nil, "default")
3131 assert.Equal(t, "default", s)
3232
33− b := Deref(To(true), false)
33+ b := Deref(Ptr(true), false)
3434 assert.True(t, b)
3535
3636 b = Deref[bool](nil, false)
pkg/util/util.go−64

This diff is too big to show here.

pkg/util/util_test.go−70

This diff is too big to show here.

pkg/validation/allowlist.go−13

This diff is too big to show here.

pkg/validation/allowlist_test.go−30

This diff is too big to show here.

pkg/validation/header.go−1

This diff is too big to show here.

pkg/validation/options_test.go+2−2

This diff is too big to show here.

pkg/validation/providers.go+1−35

This diff is too big to show here.

pkg/validation/providers_test.go−53

This diff is too big to show here.

pkg/validation/upstreams.go+3−4

This diff is too big to show here.

pkg/validation/upstreams_test.go+6−24

This diff is too big to show here.

providers/adfs_test.go+1−1

This diff is too big to show here.

providers/atlassian-cloud.godeleted−99

This diff is too big to show here.

providers/atlassian-cloud_test.godeleted−93

This diff is too big to show here.

providers/azure.go+2−3

This diff is too big to show here.

providers/dtt_sso.godeleted−202

This diff is too big to show here.

providers/dtt_sso_test.godeleted−237

This diff is too big to show here.

providers/google.go+4−4

This diff is too big to show here.

providers/internal_util.go+1−2

This diff is too big to show here.

providers/internal_util_test.go−6

This diff is too big to show here.

providers/keycloak_oidc.go−1

This diff is too big to show here.

providers/logingov.go+1−2

This diff is too big to show here.

providers/ms_entra_id.go+1−4

This diff is too big to show here.

providers/ms_entra_id_test.go+3−3

This diff is too big to show here.

providers/oidc.go+7−5

This diff is too big to show here.

providers/provider_data.go+5−44

This diff is too big to show here.

providers/provider_data_test.go−23

This diff is too big to show here.

providers/provider_default.go+1−3

This diff is too big to show here.

providers/provider_default_test.go−12

This diff is too big to show here.

providers/providers.go+3−9

This diff is too big to show here.

providers/providers_test.go+4−94

This diff is too big to show here.

providers/srht.go+1−2

This diff is too big to show here.

providers/util_test.go−33

This diff is too big to show here.

validator.go+1−4

This diff is too big to show here.

validator_test.go−21

This diff is too big to show here.