git.iko.soy/typeable/oauth2-proxy
on master help sign in
Merge pull request #3308 from oauth2-proxy/release/v7.14.0

release v7.14.0

commit707e6c4a1cb757b575eeb4603bfcd00406a2e3b4 authorJan Larwig <jan@larwig.com> dateSat 17 Jan 2026, 11:15 (8 months ago) parent86c24691f29953
71 files changed+5110−491
ADOPTERS.md−28 CHANGELOG.md+88−1 CODE_OF_CONDUCT.md+81−103 DCO.md+34 MAINTAINERS+2−5 MAINTAINERS.md+33 README.md+31−16 contrib/local-environment/docker-compose-alpha-config.yaml+1−1 contrib/local-environment/docker-compose-gitea.yaml+1−1 contrib/local-environment/docker-compose-keycloak.yaml+1−1 contrib/local-environment/docker-compose-nginx.yaml+1−1 contrib/local-environment/docker-compose-traefik.yaml+1−1 contrib/local-environment/docker-compose.yaml+1−1 docs/docs/community/contribution.md+3−3 docs/docs/community/security.md+1−1 docs/docs/configuration/alpha_config.md+85−6 docs/docs/configuration/alpha_config.md.tmpl+85−6 docs/docs/configuration/sessions.md+2−2 docs/docs/installation.md+1−1 docs/docs/welcome.md+10 docs/docusaurus.config.js+1−1 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+107 docs/versioned_docs/version-7.13.x/configuration/integrations/traefik.md+184 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+107 docs/versioned_docs/version-7.14.x/configuration/integrations/traefik.md+184 docs/versioned_docs/version-7.14.x/configuration/overview.md+406 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_sidebars/version-7.13.x-sidebars.json+15−1 docs/versioned_sidebars/version-7.14.x-sidebars.json+100 docs/versions.json+1 pkg/upstream/http.go+4
ADOPTERS.mddeleted−28
@@ -1,28 +0,0 @@
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+88−1
@@ -6,14 +6,101 @@
66
77## Breaking Changes
88
9+## Changes since v7.14.0
10+
11+# V7.14.0
12+
13+## Release Highlights
14+
15+- 🕵️‍♀️ Vulnerabilities have been addressed
16+ - [CVE-2025-61729](https://access.redhat.com/security/cve/cve-2025-61729)
17+ - [CVE-2025-61727](https://access.redhat.com/security/cve/cve-2025-61727)
18+ - [CVE-2025-47914](https://access.redhat.com/security/cve/cve-2025-47914)
19+ - [CVE-2025-58181](https://access.redhat.com/security/cve/cve-2025-58181)
20+- 🗂️ AMajor Alpha Config YAML parsing revamped for better extensibility and preparing v8
21+- 🐛 Squashed some bugs
22+
23+## Important Notes
24+
25+This release introduces a breaking change for Alpha Config users and moves us significantly
26+closer to removing legacy configuration parameters, making the codebase of OAuth2 Proxy more
27+future proof and extensible.
28+
29+From v7.14.0 onward, header injection sources must be explicitly nested. If you
30+previously relied on squashed fields, update to the new structure before upgrading:
31+
32+```yaml
33+# before v7.14.0
34+injectRequestHeaders:
35+- name: X-Forwarded-User
36+ values:
37+ - claim: user
38+- name: X-Custom-Secret-header
39+ values:
40+ - value: my-super-secret
41+
42+# v7.14.0 and later
43+injectRequestHeaders:
44+- name: X-Forwarded-User
45+ values:
46+ - claimSource:
47+ claim: user
48+- name: X-Custom-Secret-header
49+ values:
50+ - secretSource:
51+ value: my-super-secret
52+```
53+
54+Furthermore, Alpha Config now fully supports configuring the `Server` struct using YAML.
55+
56+```yaml
57+// Server represents the configuration for the Proxy HTTP(S) configuration.
58+type Server struct {
59+ // BindAddress is the address on which to serve traffic.
60+ BindAddress string `yaml:"bindAddress,omitempty"`
61+
62+ // SecureBindAddress is the address on which to serve secure traffic.
63+ SecureBindAddress string `yaml:"secureBindAddress,omitempty"`
64+
65+ // TLS contains the information for loading the certificate and key for the
66+ // secure traffic and further configuration for the TLS server.
67+ TLS *TLS `yaml:"tls,omitempty"`
68+}
69+
70+// TLS contains the information for loading a TLS certificate and key
71+// as well as an optional minimal TLS version that is acceptable.
72+type TLS struct {
73+ // Key is the TLS key data to use.
74+ Key *SecretSource `yaml:"key,omitempty"`
75+ // Cert is the TLS certificate data to use.
76+ Cert *SecretSource `yaml:"cert,omitempty"`
77+ // MinVersion is the minimal TLS version that is acceptable.
78+ MinVersion string `yaml:"minVersion,omitempty"`
79+ // CipherSuites is a list of TLS cipher suites that are allowed.
80+ CipherSuites []string `yaml:"cipherSuites,omitempty"`
81+}
82+```
83+
84+More about how to use Alpha Config can be found in the [documentation](https://oauth2-proxy.github.io/oauth2-proxy/configuration/alpha-config#server).
85+
86+We are committed to Semantic Versioning and usually avoid breaking changes without a major version release.
87+Advancing Alpha Config toward its Beta stage required this exception, and even for the Alpha Config we try
88+to keep breaking changes in v7 to a minium. Thank you for understanding the need for this step to prepare
89+the project for future maintainability and future improvements like structured logging.
90+
91+## Breaking Changes
92+
93+- Alpha Config: header injection no longer supports squashed claim/secret sources; they must now be set explicitly (see example above).
94+
995## Changes since v7.13.0
1096
11−- [#3290](https://github.com/oauth2-proxy/oauth2-proxy/pull/3290) fix: WebSocket proxy to respect PassHostHeader setting (@UnsignedLong)
97+- [#2628](https://github.com/oauth2-proxy/oauth2-proxy/pull/2628) feat(structured config): revamp of yaml parsing using mapstructure decoder and custom decoders (@tuunit)
1298- [#3197](https://github.com/oauth2-proxy/oauth2-proxy/pull/3197) fix: NewRemoteKeySet is not using DefaultHTTPClient (@rsrdesarrollo / @tuunit)
1399- [#3292](https://github.com/oauth2-proxy/oauth2-proxy/pull/3292) chore(deps): upgrade gomod and bump to golang v1.25.5 (@tuunit)
14100- [#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)
15101- [#3264](https://github.com/oauth2-proxy/oauth2-proxy/pull/3264) fix: more aggressively truncate logged access_token (@MartinNowak / @tuunit)
16102- [#3267](https://github.com/oauth2-proxy/oauth2-proxy/pull/3267) fix: Session refresh handling in OIDC provider (@gysel)
103+- [#3290](https://github.com/oauth2-proxy/oauth2-proxy/pull/3290) fix: WebSocket proxy to respect PassHostHeader setting (@UnsignedLong)
17104
18105# V7.13.0
19106
CODE_OF_CONDUCT.md+81−103
@@ -1,134 +1,112 @@
1−# Contributor Covenant Code of Conduct
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.
235
3−## Our Pledge
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.
441
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.
42+### CNCF Events
1143
12−We pledge to act and interact in ways that contribute to an open, welcoming,
13−diverse, inclusive, and healthy community.
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.
1445
1546## Our Standards
1647
17−Examples of behavior that contributes to a positive environment for our
18−community include:
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:
1951
2052* Demonstrating empathy and kindness toward other people
2153* Being respectful of differing opinions, viewpoints, and experiences
2254* Giving and gracefully accepting constructive feedback
2355* Accepting responsibility and apologizing to those affected by our mistakes,
2456 and learning from the experience
25−* Focusing on what is best not just for us as individuals, but for the overall
26− community
57+* Focusing on what is best not just for us as individuals, but for the
58+ overall community
59+* Using welcoming and inclusive language
2760
28−Examples of unacceptable behavior include:
2961
30−* The use of sexualized language or imagery, and sexual attention or advances of
31− any kind
62+Examples of unacceptable behavior include but are not limited to:
63+
64+* The use of sexualized language or imagery
3265* Trolling, insulting or derogatory comments, and personal or political attacks
33−* Public or private harassment
34−* Publishing others' private information, such as a physical or email address,
35− without their explicit permission
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.
3675* Other conduct which could reasonably be considered inappropriate in a
3776 professional setting
3877
39−## Enforcement Responsibilities
40−
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.
45−
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.
50−
51−## Scope
52−
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.
58−
59−## Enforcement
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.
6081
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.
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.
6686
67−All community leaders are obligated to respect the privacy and security of the
68−reporter of any incident.
87+## Reporting
6988
70−## Enforcement Guidelines
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.
7190
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:
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.
7492
75−### 1. Correction
93+For incidents occurring at CNCF event that is produced by the Linux Foundation, please contact <eventconduct@cncf.io>.
7694
77−**Community Impact**: Use of inappropriate language or other behavior deemed
78−unprofessional or unwelcome in the community.
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/).
7997
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.
98+## Enforcement
11599
116−## Attribution
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.
117101
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].
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).
121103
122−Community Impact Guidelines were inspired by
123−[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
104+## Amendments
124105
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].
106+Consistent with the CNCF Charter, any substantive changes to this Code of Conduct must be approved by the Technical Oversight Committee.
128107
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
108+## Acknowledgements
134109
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.mdnew file+34
@@ -0,0 +1,34 @@
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+2−5
@@ -1,5 +1,2 @@
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)
1+
2+Moved to https://github.com/oauth2-proxy/oauth2-proxy/blob/master/MAINTAINERS.md
MAINTAINERS.mdnew file+33
@@ -0,0 +1,33 @@
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 | IONOS Cloud |
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
README.md+31−16
@@ -1,22 +1,24 @@
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)
3−[![GoDoc](https://godoc.org/github.com/oauth2-proxy/oauth2-proxy?status.svg)](https://godoc.org/github.com/oauth2-proxy/oauth2-proxy)
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)
44[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
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)
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)
79[![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)
810
911![OAuth2 Proxy](docs/static/img/logos/OAuth2_Proxy_horizontal.svg)
1012
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.
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.
1214
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.
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.
1416
1517![Simplified Architecture](docs/static/img/simplified-architecture.svg)
1618
1719## Get Started
1820
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).
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).
2022
2123## Releases
2224
@@ -35,24 +37,26 @@ Since 2023-11-18 we build nightly images directly from the `master` branch and p
3537These images are considered unstable and therefore should **NOT** be used for production purposes unless you know what you're doing.
3638
3739## Sponsors
40+Would you like to sponsor the project then please contact us at [sponsors@oauth2-proxy.dev](mailto:sponsors@oauth2-proxy.dev)
3841
39−![Microsoft](https://upload.wikimedia.org/wikipedia/commons/9/96/Microsoft_logo_%282012%29.svg)
40−Microsoft Azure credits for open source projects
42+![SAP](https://avatars.githubusercontent.com/u/2531208?s=300&v=4)
4143
42−Would you like to sponsor the project then please contact us at [sponsors@oauth2-proxy.dev](mailto:sponsors@oauth2-proxy.dev)
44+SAP Open Source Program
45+
46+## Former Sponsors
47+![Microsoft](https://avatars.githubusercontent.com/u/6154722?s=100&v=4)
48+
49+Microsoft Azure credits for open source projects
4350
4451## Getting Involved
4552[![Slack](https://img.shields.io/badge/slack-Gopher_%23oauth2--proxy-red?logo=slack)](https://gophers.slack.com/archives/CM2RSS25N)
4653
4754Join 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.
4855
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.
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.
5057
5158If you want to contribute to the project. Please see our [Contributing](https://oauth2-proxy.github.io/oauth2-proxy/community/contribution) guide.
5259
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−
5660Thanks to all the people who already contributed ❤
5761
5862<a href="https://github.com/oauth2-proxy/oauth2-proxy/graphs/contributors">
@@ -66,7 +70,7 @@ Made with [contrib.rocks](https://contrib.rocks).
6670
6771If 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.
6872
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.
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.
7074
7175For more details read our full [Security Docs](https://oauth2-proxy.github.io/oauth2-proxy/community/security#security-disclosures)
7276
@@ -82,9 +86,20 @@ See [open redirect vulnerability](https://github.com/oauth2-proxy/oauth2-proxy/s
8286
8387**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`.
8488
89+## Code of Conduct
90+Participation in the OAuth2 Proxy project is governed by the [CNCF Code of Conduct](CODE_OF_CONDUCT.md).
91+
8592## License
8693
87−OAuth2-Proxy is distributed under [The MIT License](LICENSE).
94+OAuth2 Proxy is distributed under [The MIT License](LICENSE).
8895
8996
9097[![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/docker-compose-alpha-config.yaml+1−1
@@ -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.13.0
17+ image: quay.io/oauth2-proxy/oauth2-proxy:v7.14.0
1818 command: --config /oauth2-proxy.cfg --alpha-config /oauth2-proxy-alpha-config.yaml
1919 hostname: oauth2-proxy
2020 volumes:
contrib/local-environment/docker-compose-gitea.yaml+1−1
@@ -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.13.0
17+ image: quay.io/oauth2-proxy/oauth2-proxy:v7.14.0
1818 command: --config /oauth2-proxy.cfg
1919 hostname: oauth2-proxy
2020 volumes:
contrib/local-environment/docker-compose-keycloak.yaml+1−1
@@ -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.13.0
17+ image: quay.io/oauth2-proxy/oauth2-proxy:v7.14.0
1818 command: --config /oauth2-proxy.cfg
1919 hostname: oauth2-proxy
2020 volumes:
contrib/local-environment/docker-compose-nginx.yaml+1−1
@@ -22,7 +22,7 @@
2222version: '3.0'
2323services:
2424 oauth2-proxy:
25− image: quay.io/oauth2-proxy/oauth2-proxy:v7.13.0
25+ image: quay.io/oauth2-proxy/oauth2-proxy:v7.14.0
2626 ports: []
2727 hostname: oauth2-proxy
2828 container_name: oauth2-proxy
contrib/local-environment/docker-compose-traefik.yaml+1−1
@@ -23,7 +23,7 @@ version: '3.0'
2323services:
2424
2525 oauth2-proxy:
26− image: quay.io/oauth2-proxy/oauth2-proxy:v7.13.0
26+ image: quay.io/oauth2-proxy/oauth2-proxy:v7.14.0
2727 ports: []
2828 hostname: oauth2-proxy
2929 volumes:
contrib/local-environment/docker-compose.yaml+1−1
@@ -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.13.0
16+ image: quay.io/oauth2-proxy/oauth2-proxy:v7.14.0
1717 command: --config /oauth2-proxy.cfg
1818 hostname: oauth2-proxy
1919 volumes:
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](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/MAINTAINERS) file.
24+list of maintainers in our [MAINTAINERS.md](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/MAINTAINERS.md) file.
2525
2626Please include as much detail as possible.
2727Ideally, your disclosure should include:
docs/docs/configuration/alpha_config.md+85−6
@@ -24,17 +24,56 @@ When using alpha configuration, your config file will look something like below:
2424upstreams:
2525 - id: ...
2626 ...: ...
27−injectRequestHeaders:
28− - name: ...
27+providers:
28+ - id: ...
2929 ...: ...
30+cookie:
31+ secret: ...
32+ ...: ...
33+injectRequestHeaders:
34+ - secretSource:
35+ ...: ...
3036injectResponseHeaders:
31− - name: ...
32− ...: ...
37+ - claimSource:
38+ ...: ...
3339```
3440
3541Please browse the [reference](#configuration-reference) below for the structure
3642of the new configuration format.
3743
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+
3877## Using Alpha Configuration
3978
4079To use the new **alpha** configuration, generate a YAML file based on the format
@@ -67,9 +106,9 @@ the new config.
67106oauth2-proxy --alpha-config ./path/to/new/config.yaml --config ./path/to/existing/config.cfg
68107```
69108
70−## Using ENV variables in the alpha configuration
109+### How to use environment variables
71110
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.
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.
73112When using environment variables, your yaml will look like this:
74113
75114```yaml
@@ -81,6 +120,46 @@ When using environment variables, your yaml will look like this:
81120Where CLIENT_SECRET is an environment variable.
82121More information and available patterns can be found [here](https://github.com/a8m/envsubst#docs)
83122
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+
84163## Removed options
85164
86165The following flags/options and their respective environment variables are no
docs/docs/configuration/alpha_config.md.tmpl+85−6
@@ -24,17 +24,56 @@ When using alpha configuration, your config file will look something like below:
2424upstreams:
2525 - id: ...
2626 ...: ...
27−injectRequestHeaders:
28− - name: ...
27+providers:
28+ - id: ...
2929 ...: ...
30+cookie:
31+ secret: ...
32+ ...: ...
33+injectRequestHeaders:
34+ - secretSource:
35+ ...: ...
3036injectResponseHeaders:
31− - name: ...
32− ...: ...
37+ - claimSource:
38+ ...: ...
3339```
3440
3541Please browse the [reference](#configuration-reference) below for the structure
3642of the new configuration format.
3743
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+
3877## Using Alpha Configuration
3978
4079To use the new **alpha** configuration, generate a YAML file based on the format
@@ -67,9 +106,9 @@ the new config.
67106oauth2-proxy --alpha-config ./path/to/new/config.yaml --config ./path/to/existing/config.cfg
68107```
69108
70−## Using ENV variables in the alpha configuration
109+### How to use environment variables
71110
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.
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.
73112When using environment variables, your yaml will look like this:
74113
75114```yaml
@@ -81,6 +120,46 @@ When using environment variables, your yaml will look like this:
81120Where CLIENT_SECRET is an environment variable.
82121More information and available patterns can be found [here](https://github.com/a8m/envsubst#docs)
83122
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+
84163## Removed options
85164
86165The following flags/options and their respective environment variables are no
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/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.13.0`)
8+ a. Using a [Prebuilt Binary](https://github.com/oauth2-proxy/oauth2-proxy/releases) (current release is `v7.14.0`)
99
1010 b. Using Go to install the latest release
1111 ```bash
docs/docs/welcome.md+10
@@ -21,3 +21,13 @@ 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+1−1
@@ -118,7 +118,7 @@ const config = {
118118 },
119119 footer: {
120120 style: 'dark',
121− copyright: `Copyright © ${new Date().getFullYear()} OAuth2 Proxy.`,
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/`,
122122 },
123123 prism: {
124124 theme: prismThemes.github,
docs/versioned_docs/version-7.13.x/configuration/integration.mddeleted−310
@@ -1,310 +0,0 @@
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.mdnew file+63
@@ -0,0 +1,63 @@
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.mdnew file+105
@@ -0,0 +1,105 @@
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.mdnew file+41
@@ -0,0 +1,41 @@
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.mdnew file+289
@@ -0,0 +1,289 @@
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.mdnew file+107
@@ -0,0 +1,107 @@
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 =403 /oauth2/sign_in;
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+```
87+
88+When you use ingress-nginx in Kubernetes, you can configure the same behavior with the following annotations on your Ingress resource:
89+
90+```yaml
91+nginx.ingress.kubernetes.io/auth-url: "https://<oauth2-proxy-fqdn>/oauth2/auth"
92+nginx.ingress.kubernetes.io/auth-signin: "https://<oauth2-proxy-fqdn>/oauth2/start?rd=$escaped_request_uri"
93+```
94+
95+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/.
96+
97+It is recommended to use `--session-store-type=redis` when expecting large sessions/OIDC tokens (_e.g._ with MS Azure).
98+
99+:::tip Kubernetes Dashboard with Azure Entra ID
100+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.
101+:::
102+
103+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=".
104+
105+:::note
106+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.
107+:::
docs/versioned_docs/version-7.13.x/configuration/integrations/traefik.mdnew file+184
@@ -0,0 +1,184 @@
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+```
83+
84+### ForwardAuth with static upstreams configuration
85+
86+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
87+
88+**Following options need to be set on `oauth2-proxy`:**
89+- `--upstream=static://202`: Configures a static response for authenticated sessions
90+- `--reverse-proxy=true`: Enables the use of `X-Forwarded-*` headers to determine redirects correctly
91+
92+```yaml
93+http:
94+ routers:
95+ a-service-route-1:
96+ rule: "Host(`a-service.example.com`, `b-service.example.com`) && PathPrefix(`/`)"
97+ service: a-service-backend
98+ middlewares:
99+ - oauth-auth-redirect # redirects all unauthenticated to oauth2 signin
100+ tls:
101+ certResolver: default
102+ domains:
103+ - main: "example.com"
104+ sans:
105+ - "*.example.com"
106+ a-service-route-2:
107+ rule: "Host(`a-service.example.com`) && PathPrefix(`/no-auto-redirect`)"
108+ service: a-service-backend
109+ middlewares:
110+ - oauth-auth-wo-redirect # unauthenticated session will return a 401
111+ tls:
112+ certResolver: default
113+ domains:
114+ - main: "example.com"
115+ sans:
116+ - "*.example.com"
117+ services-oauth2-route:
118+ rule: "Host(`a-service.example.com`, `b-service.example.com`) && PathPrefix(`/oauth2/`)"
119+ middlewares:
120+ - auth-headers
121+ service: oauth-backend
122+ tls:
123+ certResolver: default
124+ domains:
125+ - main: "example.com"
126+ sans:
127+ - "*.example.com"
128+ oauth2-proxy-route:
129+ rule: "Host(`oauth.example.com`) && PathPrefix(`/`)"
130+ middlewares:
131+ - auth-headers
132+ service: oauth-backend
133+ tls:
134+ certResolver: default
135+ domains:
136+ - main: "example.com"
137+ sans:
138+ - "*.example.com"
139+
140+ services:
141+ a-service-backend:
142+ loadBalancer:
143+ servers:
144+ - url: http://172.16.0.2:7555
145+ b-service-backend:
146+ loadBalancer:
147+ servers:
148+ - url: http://172.16.0.3:7555
149+ oauth-backend:
150+ loadBalancer:
151+ servers:
152+ - url: http://172.16.0.1:4180
153+
154+ middlewares:
155+ auth-headers:
156+ headers:
157+ sslRedirect: true
158+ stsSeconds: 315360000
159+ browserXssFilter: true
160+ contentTypeNosniff: true
161+ forceSTSHeader: true
162+ sslHost: example.com
163+ stsIncludeSubdomains: true
164+ stsPreload: true
165+ frameDeny: true
166+ oauth-auth-redirect:
167+ forwardAuth:
168+ address: https://oauth.example.com/
169+ trustForwardHeader: true
170+ authResponseHeaders:
171+ - X-Auth-Request-Access-Token
172+ - Authorization
173+ oauth-auth-wo-redirect:
174+ forwardAuth:
175+ address: https://oauth.example.com/oauth2/auth
176+ trustForwardHeader: true
177+ authResponseHeaders:
178+ - X-Auth-Request-Access-Token
179+ - Authorization
180+```
181+
182+:::note
183+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.
184+:::
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/integration#configuring-for-use-with-the-nginx-auth_request-directive)
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)
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.mdnew file+26
@@ -0,0 +1,26 @@
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.mdnew file+91
@@ -0,0 +1,91 @@
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.mdnew file+49
@@ -0,0 +1,49 @@
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.mdnew file+637
@@ -0,0 +1,637 @@
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.tmplnew file+218
@@ -0,0 +1,218 @@
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.mdnew file+63
@@ -0,0 +1,63 @@
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.mdnew file+105
@@ -0,0 +1,105 @@
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.mdnew file+41
@@ -0,0 +1,41 @@
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.mdnew file+289
@@ -0,0 +1,289 @@
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.mdnew file+107
@@ -0,0 +1,107 @@
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 =403 /oauth2/sign_in;
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+```
87+
88+When you use ingress-nginx in Kubernetes, you can configure the same behavior with the following annotations on your Ingress resource:
89+
90+```yaml
91+nginx.ingress.kubernetes.io/auth-url: "https://<oauth2-proxy-fqdn>/oauth2/auth"
92+nginx.ingress.kubernetes.io/auth-signin: "https://<oauth2-proxy-fqdn>/oauth2/start?rd=$escaped_request_uri"
93+```
94+
95+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/.
96+
97+It is recommended to use `--session-store-type=redis` when expecting large sessions/OIDC tokens (_e.g._ with MS Azure).
98+
99+:::tip Kubernetes Dashboard with Azure Entra ID
100+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.
101+:::
102+
103+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=".
104+
105+:::note
106+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.
107+:::
docs/versioned_docs/version-7.14.x/configuration/integrations/traefik.mdnew file+184
@@ -0,0 +1,184 @@
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+```
83+
84+### ForwardAuth with static upstreams configuration
85+
86+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
87+
88+**Following options need to be set on `oauth2-proxy`:**
89+- `--upstream=static://202`: Configures a static response for authenticated sessions
90+- `--reverse-proxy=true`: Enables the use of `X-Forwarded-*` headers to determine redirects correctly
91+
92+```yaml
93+http:
94+ routers:
95+ a-service-route-1:
96+ rule: "Host(`a-service.example.com`, `b-service.example.com`) && PathPrefix(`/`)"
97+ service: a-service-backend
98+ middlewares:
99+ - oauth-auth-redirect # redirects all unauthenticated to oauth2 signin
100+ tls:
101+ certResolver: default
102+ domains:
103+ - main: "example.com"
104+ sans:
105+ - "*.example.com"
106+ a-service-route-2:
107+ rule: "Host(`a-service.example.com`) && PathPrefix(`/no-auto-redirect`)"
108+ service: a-service-backend
109+ middlewares:
110+ - oauth-auth-wo-redirect # unauthenticated session will return a 401
111+ tls:
112+ certResolver: default
113+ domains:
114+ - main: "example.com"
115+ sans:
116+ - "*.example.com"
117+ services-oauth2-route:
118+ rule: "Host(`a-service.example.com`, `b-service.example.com`) && PathPrefix(`/oauth2/`)"
119+ middlewares:
120+ - auth-headers
121+ service: oauth-backend
122+ tls:
123+ certResolver: default
124+ domains:
125+ - main: "example.com"
126+ sans:
127+ - "*.example.com"
128+ oauth2-proxy-route:
129+ rule: "Host(`oauth.example.com`) && PathPrefix(`/`)"
130+ middlewares:
131+ - auth-headers
132+ service: oauth-backend
133+ tls:
134+ certResolver: default
135+ domains:
136+ - main: "example.com"
137+ sans:
138+ - "*.example.com"
139+
140+ services:
141+ a-service-backend:
142+ loadBalancer:
143+ servers:
144+ - url: http://172.16.0.2:7555
145+ b-service-backend:
146+ loadBalancer:
147+ servers:
148+ - url: http://172.16.0.3:7555
149+ oauth-backend:
150+ loadBalancer:
151+ servers:
152+ - url: http://172.16.0.1:4180
153+
154+ middlewares:
155+ auth-headers:
156+ headers:
157+ sslRedirect: true
158+ stsSeconds: 315360000
159+ browserXssFilter: true
160+ contentTypeNosniff: true
161+ forceSTSHeader: true
162+ sslHost: example.com
163+ stsIncludeSubdomains: true
164+ stsPreload: true
165+ frameDeny: true
166+ oauth-auth-redirect:
167+ forwardAuth:
168+ address: https://oauth.example.com/
169+ trustForwardHeader: true
170+ authResponseHeaders:
171+ - X-Auth-Request-Access-Token
172+ - Authorization
173+ oauth-auth-wo-redirect:
174+ forwardAuth:
175+ address: https://oauth.example.com/oauth2/auth
176+ trustForwardHeader: true
177+ authResponseHeaders:
178+ - X-Auth-Request-Access-Token
179+ - Authorization
180+```
181+
182+:::note
183+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.
184+:::
docs/versioned_docs/version-7.14.x/configuration/overview.mdnew file+406
@@ -0,0 +1,406 @@
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-insecure-skip-tls-verify`<br/>toml: `redis_insecure_skip_tls_verify` | bool | skip TLS verification when connecting to Redis | false |
248+| flag: `--redis-password`<br/>toml: `redis_password` | string | Redis password. Applicable for all Redis configurations. Will override any password set in `--redis-connection-url` | |
249+| 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` | |
250+| flag: `--redis-sentinel-master-name`<br/>toml: `redis_sentinel_master_name` | string | Redis sentinel master name. Used in conjunction with `--redis-use-sentinel` | |
251+| 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` | |
252+| 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 |
253+| 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 |
254+| 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 |
255+
256+### Upstream Options
257+
258+| Flag / Config Field | Type | Description | Default |
259+| ----------------------------------------------------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------- |
260+| flag: `--flush-interval`<br/>toml: `flush_interval` | duration | period between flushing response buffers when streaming responses | `"1s"` |
261+| flag: `--pass-host-header`<br/>toml: `pass_host_header` | bool | pass the request Host Header to upstream | true |
262+| flag: `--proxy-websockets`<br/>toml: `proxy_websockets` | bool | enables WebSocket proxying | true |
263+| flag: `--ssl-upstream-insecure-skip-verify`<br/>toml: `ssl_upstream_insecure_skip_verify` | bool | skip validation of certificates presented when using HTTPS upstreams | false |
264+| flag: `--disable-keep-alives`<br/>toml: `disable_keep_alives` | bool | disable HTTP keep-alive connections to the upstream server | false |
265+| flag: `--upstream-timeout`<br/>toml: `upstream_timeout` | duration | maximum amount of time the server will wait for a response from the upstream | 30s |
266+| 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 | |
267+
268+## Upstreams Configuration
269+
270+`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.
271+
272+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.
273+
274+* 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`.
275+* 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`.
276+
277+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.
278+
279+**Unix socket upstreams** are configured as `unix:///path/to/unix.sock`.
280+
281+**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/`.
282+
283+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.
284+
285+## Environment variables
286+
287+Every command line argument can be specified as an environment variable by
288+prefixing it with `OAUTH2_PROXY_`, capitalising it, and replacing hyphens (`-`)
289+with underscores (`_`). If the argument can be specified multiple times, the
290+environment variable should be plural (trailing `S`).
291+
292+This is particularly useful for storing secrets outside a configuration file
293+or the command line.
294+
295+For example, the `--cookie-secret` flag becomes `OAUTH2_PROXY_COOKIE_SECRET`.
296+If a flag has the type `string | list` like the `--email-domain` flag it is
297+available as an environment variable in plural form e.g. `OAUTH2_PROXY_EMAIL_DOMAINS`
298+
299+Values for type `string | list` usually have a plural environment variable name
300+and need to be seperated by `,` e.g.
301+`OAUTH2_PROXY_SKIP_AUTH_ROUTES="GET=^/api/status,POST=^/api/saved_objects/_import"`
302+
303+Please check the type for each [config option](#config-options) first.
304+
305+## Logging Configuration
306+
307+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.
308+
309+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`).
310+
311+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`.
312+
313+Each type of logging has its own configurable format and variables. By default, these formats are similar to the Apache Combined Log.
314+
315+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.
316+
317+## Auth Log Format
318+
319+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:
320+
321+```
322+<REMOTE_ADDRESS> - <REQUEST ID> - <user@domain.com> [2015/03/19 17:20:19] [<STATUS>] <MESSAGE>
323+```
324+
325+The status block will contain one of the below strings:
326+
327+- `AuthSuccess` If a user has authenticated successfully by any method
328+- `AuthFailure` If the user failed to authenticate explicitly
329+- `AuthError` If there was an unexpected error during authentication
330+
331+If you require a different format than that, you can configure it with the `--auth-logging-format` flag.
332+The default format is configured as follows:
333+
334+```
335+{{.Client}} - {{.RequestID}} - {{.Username}} [{{.Timestamp}}] [{{.Status}}] {{.Message}}
336+```
337+
338+Available variables for auth logging:
339+
340+| Variable | Example | Description |
341+| ------------- | ------------------------------------ | -------------------------------------------------------------------------------------------------------- |
342+| 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. |
343+| Host | domain.com | The value of the Host header. |
344+| Message | Authenticated via OAuth2 | The details of the auth attempt. |
345+| Protocol | HTTP/1.0 | The request protocol. |
346+| RequestID | 00010203-0405-4607-8809-0a0b0c0d0e0f | The request ID pulled from the `--request-id-header`. Random UUID if empty |
347+| RequestMethod | GET | The request method. |
348+| Timestamp | 2015/03/19 17:20:19 | The date and time of the logging event. |
349+| UserAgent | - | The full user agent as reported by the requesting client. |
350+| Username | username@email.com | The email or username of the auth request. |
351+| Status | AuthSuccess | The status of the auth request. See above for details. |
352+
353+## Request Log Format
354+
355+HTTP request logs will output by default in the below format:
356+
357+```
358+<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>
359+```
360+
361+If you require a different format than that, you can configure it with the `--request-logging-format` flag.
362+The default format is configured as follows:
363+
364+```
365+{{.Client}} - {{.RequestID}} - {{.Username}} [{{.Timestamp}}] {{.Host}} {{.RequestMethod}} {{.Upstream}} {{.RequestURI}} {{.Protocol}} {{.UserAgent}} {{.StatusCode}} {{.ResponseSize}} {{.RequestDuration}}
366+```
367+
368+Available variables for request logging:
369+
370+| Variable | Example | Description |
371+| --------------- | ------------------------------------ | -------------------------------------------------------------------------------------------------------- |
372+| 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. |
373+| Host | domain.com | The value of the Host header. |
374+| Protocol | HTTP/1.0 | The request protocol. |
375+| RequestDuration | 0.001 | The time in seconds that a request took to process. |
376+| RequestID | 00010203-0405-4607-8809-0a0b0c0d0e0f | The request ID pulled from the `--request-id-header`. Random UUID if empty |
377+| RequestMethod | GET | The request method. |
378+| RequestURI | "/oauth2/auth" | The URI path of the request. |
379+| ResponseSize | 12 | The size in bytes of the response. |
380+| StatusCode | 200 | The HTTP status code of the response. |
381+| Timestamp | 2015/03/19 17:20:19 | The date and time of the logging event. |
382+| Upstream | - | The upstream data of the HTTP request. |
383+| UserAgent | - | The full user agent as reported by the requesting client. |
384+| Username | username@email.com | The email or username of the auth request. |
385+
386+## Standard Log Format
387+
388+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:
389+
390+```
391+[2015/03/19 17:20:19] [main.go:40] <MESSAGE>
392+```
393+
394+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:
395+
396+```
397+[{{.Timestamp}}] [{{.File}}] {{.Message}}
398+```
399+
400+Available variables for standard logging:
401+
402+| Variable | Example | Description |
403+| --------- | --------------------------------- | -------------------------------------------------- |
404+| Timestamp | 2015/03/19 17:20:19 | The date and time of the logging event. |
405+| File | main.go:40 | The file and line number of the logging statement. |
406+| 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.mdnew file+19
@@ -0,0 +1,19 @@
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.mdnew file+25
@@ -0,0 +1,25 @@
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.mdnew file+37
@@ -0,0 +1,37 @@
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.mdnew file+44
@@ -0,0 +1,44 @@
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.mdnew file+21
@@ -0,0 +1,21 @@
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.mdnew file+7
@@ -0,0 +1,7 @@
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.mdnew file+24
@@ -0,0 +1,24 @@
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.mdnew file+81
@@ -0,0 +1,81 @@
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.mdnew file+49
@@ -0,0 +1,49 @@
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-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 | |
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.mdnew file+84
@@ -0,0 +1,84 @@
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.mdnew file+46
@@ -0,0 +1,46 @@
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.mdnew file+36
@@ -0,0 +1,36 @@
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.mdnew file+151
@@ -0,0 +1,151 @@
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.mdnew file+13
@@ -0,0 +1,13 @@
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.mdnew file+79
@@ -0,0 +1,79 @@
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.mdnew file+59
@@ -0,0 +1,59 @@
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.mdnew file+197
@@ -0,0 +1,197 @@
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.mdnew file+28
@@ -0,0 +1,28 @@
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.mdnew file+146
@@ -0,0 +1,146 @@
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.mdnew file+25
@@ -0,0 +1,25 @@
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.mdnew file+99
@@ -0,0 +1,99 @@
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.mdnew file+43
@@ -0,0 +1,43 @@
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.mdnew file+85
@@ -0,0 +1,85 @@
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.mdnew file+59
@@ -0,0 +1,59 @@
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.mdnew file+32
@@ -0,0 +1,32 @@
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.0`)
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.mdnew file+32
@@ -0,0 +1,32 @@
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_sidebars/version-7.13.x-sidebars.json+15−1
@@ -22,7 +22,21 @@
2222 "collapsed": false,
2323 "items": [
2424 "configuration/overview",
25− "configuration/integration",
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+ },
2640 {
2741 "type": "category",
2842 "label": "OAuth Provider Configuration",
docs/versioned_sidebars/version-7.14.x-sidebars.jsonnew file+100
@@ -0,0 +1,100 @@
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+1
@@ -1,4 +1,5 @@
11[
2+ "7.14.x",
23 "7.13.x",
34 "7.12.x",
45 "7.11.x",
pkg/upstream/http.go+4
@@ -157,6 +157,8 @@ func newReverseProxy(target *url.URL, upstream options.Upstream, errorHandler Pr
157157 // Ensure we always pass the original request path
158158 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.
160162 if !ptr.Deref(upstream.PassHostHeader, options.DefaultUpstreamPassHostHeader) {
161163 setProxyUpstreamHostHeader(proxy, target)
162164 }
@@ -215,6 +217,8 @@ func newWebSocketReverseProxy(u *url.URL, skipTLSVerify *bool, passHostHeader *b
215217 // Apply the customized transport to our proxy before returning it
216218 wsProxy.Transport = transport
217219
220+ // TODO (@tuunit) - this should be inverted or get a better name in the future to set the upstream host header
221+ // only if PassHostHeader is explicitly set to true. Currently this would be a breaking change.
218222 // Set upstream host header if PassHostHeader is false (same as regular HTTP proxy)
219223 if !ptr.Deref(passHostHeader, options.DefaultUpstreamPassHostHeader) {
220224 setProxyUpstreamHostHeader(wsProxy, u)