Compare commits

...

2135 Commits
v1.1 ... master

Author SHA1 Message Date
David Symonds 110d51d1d7
test: replace mock pkg/clock with narrowly targeted stub clocks. (#3238)
The package under pkg/clock is github.com/benbjohnson/clock, which is
archived. It's also way more complex than is what is actually needed
here, so we can entirely remove the dependency and remove the helper
package.

Fixes #2840.

Signed-off-by: David Symonds <dsymonds@gmail.com>
2025-10-28 10:05:02 +01:00
Jan Larwig 8f687e4d0c
chore(deps): upgrade to latest go1.25.3 (#3244)
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-10-28 09:54:10 +01:00
Olivier Mengué f950dc9942
feat(makefile): simplify validate-go-version (#3147)
Since Go 1.21 the go toolchain validates strictly the "go" version
directive in go.mod, and downloads and uses the requested toolchain if
necessary. See https://go.dev/doc/toolchain

So we can just run "go list" to tell the Go toolchain to validate our
build environment according to go.mod.

To extract the "go" directive version from go.mod (used to select the
Docker build image) we also use "go list".
2025-10-28 09:13:35 +01:00
Schmitt Paul 31b275f580
docs: clarify ingress-nginx integration and remove Lua block example (#3202)
* docs: clarify ingress-nginx integration and remove Lua block example for oauth2-proxy

This PR revises the integration guide for oauth2-proxy with ingress-nginx in Kubernetes:

Recommends the minimal configuration: just auth-url and auth-signin annotations.
Removes the Lua block example, as it did not work in practice despite following nginx documentation and extensive testing.
Clearly states that the official ingress-nginx external auth example is the recommended approach for most users.
Notes that advanced Lua/cookie handling is only needed for rare, advanced scenarios.

Signed-off-by: Jan Larwig <jan@larwig.com>

* doc: update 3 latest docs versions

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-10-28 08:48:23 +01:00
Vincent Privat ea1dc3f606
Fix typo: diffrerent -> different (#3222)
Signed-off-by: Vincent Privat <vincent.privat@airbus.com>
2025-10-28 08:40:51 +01:00
stagswtf 51e80f24ef
fix: use GetSecret() in ticket.go makeCookie to respect cookie-secret-file (#3228)
* fix: use GetSecret() in ticket.go makeCookie

The makeCookie method in ticket.go was using t.options.Secret directly, which
meant cookie-secret-file was not being respected. Updated to use GetSecret()
which handles both cookie-secret and cookie-secret-file properly.

Also added test coverage for cookie-secret-file functionality.

Fixes #3224

Signed-off-by: stagswtf <142280349+stagswtf@users.noreply.github.com>

* docs: update CHANGELOG.md for cookie-secret-file fix

Signed-off-by: stagswtf <142280349+stagswtf@users.noreply.github.com>

* correct PR link and undo file formatting

Signed-off-by: stagswtf <142280349+stagswtf@users.noreply.github.com>

* fix: error wrapping

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: stagswtf <142280349+stagswtf@users.noreply.github.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-10-28 08:37:25 +01:00
renovate[bot] c0a087d7f2
chore(deps): update actions/upload-artifact action to v5 (#3243)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-28 08:03:40 +01:00
renovate[bot] 4295f0c1f9
chore(deps): update dependency golangci/golangci-lint to v2.5.0 (#3212)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-28 08:00:27 +01:00
renovate[bot] a50bbcd6f6
chore(deps): update docker-compose (#3188)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-28 07:53:29 +01:00
renovate[bot] dea0d0cf44
chore(deps): update helmv3 (#3189)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-28 07:53:12 +01:00
renovate[bot] e693f4070a
chore(deps): update actions/labeler action to v6 (#3190)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-28 07:43:22 +01:00
renovate[bot] 5539e59002
chore(deps): update actions/setup-go action to v6 (#3191)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-28 07:43:04 +01:00
renovate[bot] 65ef2ca3c9
chore(deps): update actions/stale action to v10 (#3193)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-28 07:42:13 +01:00
renovate[bot] bccc988366
chore(deps): update actions/setup-node action to v6 (#3242)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-28 07:41:34 +01:00
renovate[bot] a3349add54
chore(deps): update alpine docker tag to v3.22.2 (#3241)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-28 07:40:08 +01:00
Richard Ahlquist 9168731c7a
fix(deps): revert actions/upload-pages-artifact action to v3 (#3211)
Signed-off-by: Richard Ahlquist <richard.jimmy.johansson@gmail.com>
2025-09-28 14:48:59 +02:00
David Symonds 66cdb9d939
doc: update contribution guide to avoid a specific mention of the version of Go being used. (#3157) 2025-09-25 20:11:57 +02:00
renovate[bot] f1c08a3cd7
chore(deps): update actions/upload-pages-artifact action to v4 (#3194)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-25 20:09:52 +02:00
Conrad Hoffmann 8afb047e01
doc: SourceHut documentation fixes (#3170)
* fix: SourceHut documentation

- Add it to sidebar and provider index
- Fix broken link

This fixes an oversight in #2359, where I had not fully understood how
the documentation works.

Signed-off-by: Conrad Hoffmann <ch@bitfehler.net>

* fix: doc build instructions in docs/README.md

---------

Signed-off-by: Conrad Hoffmann <ch@bitfehler.net>
2025-08-20 12:02:32 +02:00
Jan Larwig 5082db0bec
Merge pull request #3169 from oauth2-proxy/release/v7.12.0
release v7.12.0
2025-08-19 08:50:29 +02:00
Jan Larwig 7294eebce1
add changelog entry for v7.12.0
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-08-19 08:42:24 +02:00
github-actions[bot] b4b69a6cb3
update to release version v7.12.0 2025-08-19 08:42:24 +02:00
github-actions[bot] 413d4f6976
add new docs version 7.12.x
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-08-19 08:42:18 +02:00
Richard Brežák 8c1b2b63bf
fix: Gitea team membership (#3150)
* bugfix: Gitaa team membership

Gitea doesn't properly fill in all the fields like GitHub,
so implement a series of fallbacks.

Signed-off-by: magic_rb <magic_rb@redalder.org>

* add changelog, documentation and fix groups list

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: magic_rb <magic_rb@redalder.org>
Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-08-19 08:40:36 +02:00
jet f18a0b7b07
feat: allow disable-keep-alives configuration in upstream (#3156)
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-08-19 07:56:16 +02:00
renovate[bot] 3978b2f27f
chore(deps): update docker-compose (#3160)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-18 14:27:46 +02:00
renovate[bot] 26813d3cdd
chore(deps): update dependency golangci/golangci-lint to v2.4.0 (#3161)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-18 14:27:37 +02:00
renovate[bot] 82e016954c
chore(deps): update actions/checkout action to v5 (#3164)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-18 14:27:29 +02:00
Jan Larwig 744b31a2c6
chore(dep): upgrade to latest golang 1.24.6 (#3166)
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-08-18 14:27:19 +02:00
Kevin Kreitner 4c86a4d574
feat: add Cidaas provider (#2273)
* Add sensible logging flag to default setup for logger

* Fix default value flag for sensitive logging

* Remove sensitive logging changes

* Add Cidaas provider

* Update CHANGELOG.md

* Add required groups scope to defaults

* Fix tests

* Remove if block with protected resource

* Fix linting

* Adjust provider sorting, fixes

* Directly handle error return

Co-authored-by: Jan Larwig <jan@larwig.com>

* Use less deep nesting

Co-authored-by: Jan Larwig <jan@larwig.com>

* Directly handle returned error

Co-authored-by: Jan Larwig <jan@larwig.com>

* Pass provider options to Cidaas provider

Co-authored-by: Jan Larwig <jan@larwig.com>

* Add import for provider options

* Fix tests

* Fix linting

* Add Cidaas doc page

* Add Cidaas provider doc page to overview

* Fix link in docs

* Fix link in docs

* Add link to Cidaas

* fix provider order in docs and changelog position

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Teko012 <112829523+Teko012@users.noreply.github.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Kevin Kreitner <kevinkreitner@gmail.com>
2025-08-12 17:41:45 +02:00
Jan Larwig 9667bce094
feat(e2e): add workflow to trigger e2e test suite through PR comments (#3153)
* feat(e2e): add workflow to trigger e2e test suite through PR comments

* add empty line
2025-08-12 08:11:00 +02:00
Theron Boerner 4eaa1bcfd5
fix: port for local-environment (#3148) 2025-08-02 00:36:45 +02:00
github-actions[bot] c0a928eded
release v7.11.0 (#3145)
* add new docs version 7.11.x

* update to release version v7.11.0

* add changelog entry for v7.11.0

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-07-30 20:09:33 +02:00
Jan Larwig 9ffafad4b2
Merge commit from fork
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-07-30 19:46:58 +02:00
nobletrout f4b33b64bd
feat: differentiate between "no available key" and error for redis sessions (#3093)
* add some better error handling

* add changelog entry

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-07-24 08:33:06 +02:00
Sourav Agrawal e75a258299
feat: make google-groups argument optional (#3138)
add test cases

update documentation

refactor code and some cleanup

update changelog

Signed-off-by: Jan Larwig <jan@larwig.com>
2025-07-24 07:55:54 +02:00
Michael Cornel b905f2cd93
feat: use non-default authorization request response mode in OIDC providers (#3055)
* fix: OIDC sets response mode

* Update CHANGELOG
2025-07-23 22:40:12 +02:00
Sandy Chen dc8b1623a2
feat(cookie): add feature support for cookie-secret-file (#3104)
* feat: add feature support for cookie-secret-file

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-Authored-By: Sandy Chen <Yuxuan.Chen@morganstanley.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-07-22 18:59:55 +02:00
Ashkan Daie 137e59d526
fix: regex substitution for $ signs in upstream path handling before running envsubst (#2524)
* Perform a regex replace of $NUM to $$NUM before running envsubst

* Perform a regex replace of $NUM to $$NUM before running envsubst

* add test case; fix linter warnings; add method documentation

Signed-off-by: Jan Larwig <jan@larwig.com>

* add changelog entry

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-07-22 08:52:23 +02:00
Conrad Hoffmann a88306be98
feat: add SourceHut (sr.ht) provider (#2359)
* Add SourceHut (sr.ht) provider

* fix changelog entry

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-07-22 08:16:32 +02:00
Bob Du 4d17bc1d68
feat: allow use more possible google admin-sdk api scopes (#2743)
* feat: Allow use more possible google admin-sdk api scopes.

* reduce cognitive complexity

Signed-off-by: Bob Du <i@bobdu.cc>

* remove unnecessary else block / indentation

Signed-off-by: Jan Larwig <jan@larwig.com>

* add changelog entry

Signed-off-by: Jan Larwig <jan@larwig.com>

* slight formatting and error message rephrasing

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: Bob Du <i@bobdu.cc>
Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-07-21 09:06:17 +02:00
Simmo Saan 3ac834dbcf
Fix local-environment ports (#3136)
* Change Dex port in local-environment from 4190 to 5556

Port 4190 is blocked by standards-compliant browsers (e.g. Firefox), as per https://fetch.spec.whatwg.org/#port-blocking.
Port 5556 is used by Dex in its example config files: 745e1114f3/examples/config-dev.yaml (L50)

* Fix upstream in local-environment/oauth2-proxy.cfg

http://httpbin.localtest.me:8080 is only exposed to the host, not to httpbin Docker network.
Causes Bad Gateway before.

* Do not expose unauthenticated httpbin service in local-environment

This defeats the point of having oauth2-proxy.
It has already been misleading by causing the bug fixed in cafc6af48fc38f6fe4395fb0c7e2638bc84e6091.
It serves as a bad example: users might accidentally expose the service they're trying to protect in the first place.

* Remove unnecessary httpbin.localtest.me alias from local-environment
2025-07-20 20:32:50 +02:00
Johann 5e7f14bdcb
fix: show login page on broken session cookie (#2605)
* fix: redirect on invalid cookie

* docs: update changelog

* chore: remove duplicated code

* fix: status code handling if wrong http method is used

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-07-20 17:17:24 +02:00
Jan Larwig b57c82181d
feat(cookie) csrf per request limit (#3134)
* Allow setting maximum number of csrf cookies, deleting the oldest if necessary

* Add a test for multiple CSRF cookies to remove the old cookie

* Add docs/changelog

* If limit is <=0 do not clear

Signed-off-by: test <bert@transtrend.com>

* Better docs

Co-authored-by: Jan Larwig <jan@larwig.com>

* direct check of option value

Co-authored-by: Jan Larwig <jan@larwig.com>

* direct use of option value

Co-authored-by: Jan Larwig <jan@larwig.com>

* sort based on clock compare vs time compare

Co-authored-by: Jan Larwig <jan@larwig.com>

* clock.Clock does not implement Compare, fix csrf cookie extraction after rename

Signed-off-by: Bert Helderman <bert@transtrend.com>

* Linter fix

* add method signature documentation and slight formatting

Signed-off-by: Jan Larwig <jan@larwig.com>

* fix: test case for csrf cookie limit and flag

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: Bert Helderman <bert@transtrend.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: test <bert@transtrend.com>
Co-authored-by: bh-tt <71650427+bh-tt@users.noreply.github.com>
2025-07-20 16:44:42 +02:00
renovate[bot] d5f8507cc8
chore(deps): update alpine docker tag to v3.22.1 (#3129)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-07-20 11:37:45 +02:00
renovate[bot] 20f561cf70
chore(deps): update docker-compose (#3130)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-07-20 11:08:44 +02:00
renovate[bot] c403d61d73
chore(deps): update helm release oauth2-proxy to v7.14.1 (#3133)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-07-20 11:08:23 +02:00
renovate[bot] 658256d566
chore(deps): update gomod (#3132)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-07-20 11:08:02 +02:00
renovate[bot] 313a2cb38b
chore(deps): update dependency @easyops-cn/docusaurus-search-local to ^0.52.0 (#3131)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-07-20 11:07:35 +02:00
Joel Speed 78d2a3658f
Merge pull request #3128 from oauth2-proxy/release/v7.10.0
release v7.10.0
2025-07-17 13:02:09 +01:00
Jan Larwig e25f9ec9d7
add changelog entry
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-07-17 10:01:37 +02:00
github-actions[bot] 5808f5376a update to release version v7.10.0 2025-07-17 07:56:01 +00:00
github-actions[bot] 07a388d17e add new docs version 7.10.x 2025-07-17 07:56:01 +00:00
Daniel Givens 0e1dc9bb84
fix: return error for empty Redis URL list (#3101)
* fix: return error for empty Redis URL list

* add changelog entry

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-07-17 09:23:28 +02:00
renovate[bot] 6c30a3c70b
chore(deps): update alpine base image to v3.22.0 (#3097)
* chore(deps): update alpine docker tag to v3.22.0

* add changelog entry

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-07-13 22:07:21 +02:00
renovate[bot] b05bdc0fbd
chore(deps): update helm examples (#2951)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-07-13 22:06:39 +02:00
renovate[bot] 40f3ef1ea5
chore(deps): update example docker-compose files (#3096)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-07-13 22:04:11 +02:00
renovate[bot] d390877945
chore(deps): update dependency @easyops-cn/docusaurus-search-local to ^0.51.0 (#3098)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-07-13 22:00:12 +02:00
renovate[bot] c4a02ecc95
chore(deps): update dependency golangci/golangci-lint to v2.2.2 (#3111)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-07-13 21:59:56 +02:00
Edward Viaene abb0a35bf3
feat: bump to go1.24.5 and full dependency update (#3116)
* upgrade to go1.24.5

dependency updates

lint fixes

chore(deps): upgrade github.com/spf13/viper to v1.20.1

Note that this upgrade also implied to upgrade github.com/mitchellh/mapstructure
(nowadays unmaintained: https://gist.github.com/mitchellh/90029601268e59a29e64e55bab1c5bdc)
to github.com/go-viper/mapstructure/v2.

fix: adapt tests to match mapstructure v2 error messages

pkg/apis/options/load_test.go: skip tests on Go 1.23

Add a compile guard for Go < 1.24 for the pkg/apis/options/load_test.go
because the LoadYAML test depends on error messages produced by
encoding/json that changed slightly (names of embedded structs are now
reported). As we updated the test for go1.24, the test now fails on
1.23, but just for a slight difference, so we disable the test there.

fix: adapt tests to match mapstructure v2 error messages

remove pre 1.24 disclaimer

add changelog entry

Signed-off-by: Jan Larwig <jan@larwig.com>

Co-Authored-By: Olivier Mengué <dolmen@cpan.org>

* add exclusion for 'avoid meaningless package names' in .golangci.yml

* chore(dep): upgrade all dependencies

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Olivier Mengué <dolmen@cpan.org>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-07-13 21:55:57 +02:00
Joel Speed 1a03217208
Merge pull request #3121 from oauth2-proxy/add-funding
Create FUNDING.yml
2025-07-11 10:11:24 +01:00
Jan Larwig c8c160da79
Create FUNDING.yml 2025-07-11 09:58:16 +02:00
Daniel Mersch 7731437af4
feat: support for multiple github orgs (#3072)
* fix for github teams

* Update github.go

* added errorhandling

* Update github.md

* refactored GitHub provider

refactored hasOrg, hasOrgAndTeams and hasTeam into hasAccess to stay within function limit

* reverted Refactoring

* refactored github.go

- joined hasOrgAndTeamAccess into checkRestrictions

* refactored github.go

- reduced number of returns of function checkRestrictions to 4

* updated GitHub provider to accept legacy team ids

* GoFmt and golangci-lint

Formatted with GoFmt and followed recommendations of GoLint

* added Tests

added Tests for checkRestrictions.

* refactored in maintainer feedback

* Removed code, documentation and tests for legacy ids

* add changelog and update docs

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-05-29 18:11:07 +02:00
Olivier Mengué fb7e33519a
chores: major upgrade of golangci-lint from v1.64.8 to v2.1.6 (#3062)
.golangci.yml migrated with "golangci-lint migrated" and then tweaked to add comments back.
2025-05-26 21:12:58 +02:00
Olivier Mengué 1225d611e9
chore(lint): fix staticcheck issues (#3061)
* chores: fix staticcheck QF1012

Fix use of fmt.Sprintf when writing to a writer.
https://staticcheck.dev/docs/checks/#QF1012
https://github.com/oauth2-proxy/oauth2-proxy/issues/3060

* chores: fix staticcheck QF1003

Use switch instead of multiple if/else.
https://staticcheck.dev/docs/checks/#QF1003
https://github.com/oauth2-proxy/oauth2-proxy/issues/3060

* chores: exclude staticcheck QF1008 for now

We aim to migrate golangci-lint to v2
Let's disable QF1008 (Omit embedded fields from selector expression)
for now.
https://staticcheck.dev/docs/checks/#QF1008

* chores: fix golangci config: run.deadline -> timeout

Rename config option to match v1 documentation: deadline -> timeout.
https://golangci.github.io/legacy-v1-doc/usage/configuration/#run-configuration

This error has been spotted by golangci-lint v2 migration tool.

* chores: fix staticcheck QF1012
2025-05-26 12:29:34 +02:00
Olivier Mengué 09f6252ebf
chore(deps): drop golang.org/x/exp/{slices,maps} (#3065)
Use Go 1.23 stdlib instead: slices, maps.
2025-05-26 12:20:49 +02:00
renovate[bot] f82e90426a
chore(deps): update docker-compose (#3074)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-23 16:49:24 +02:00
Jan Larwig 14d5355655
docs: add note about version obfuscation to footer option (#3051)
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-05-03 21:44:30 +02:00
Evan Carroll bae509d2ec
docs: clear up multiple-providers is unimplemented (#3046)
* docs: clear up multiple-providers is unimplemented

Currently this configuration option is held up by #926. So users don't
assume this solution will work for them, and later find the feature is
not yet implemented -- own the shortcoming clearly.

* doc: add note about missing multi provider implementation to versioned docs

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-04-28 23:52:27 +02:00
github-actions[bot] 2ecb2c64aa
release: v7.9.0 (#3047)
* add new docs version 7.9.x

* update to release version v7.9.0

* doc: add changelog summary

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-04-28 18:22:58 +02:00
ikarius b7ff804506
feat: ability to parse JWT encoded profile claims (#3014)
* fix: parse JWT profile claims

* Comment with OIDC specs reference

* fix: formatting

* Updated changelog

---------

Co-authored-by: Jan Larwig <jan@larwig.com>
2025-04-28 16:39:09 +02:00
Guillaume "Elektordi" Genty 7b41c8e987
fix: role extraction from access token in keycloak oidc (#1916)
* Fix wrong token used in Keycloak OIDC provider

* Update CHANGELOG for PR #1916

* Update tests

* fix: keycloak oidc role extraction

---------

Co-authored-by: Jan Larwig <jan@larwig.com>
2025-04-28 10:23:19 +01:00
Jan Larwig 367183d7b8
chore(build): refactoring makefile for better usability and introducing a default help target (#2930) 2025-04-27 20:09:52 +02:00
Michael Niksa 4237358ac3
doc(entra-id): correct toml field in sample (#2946)
---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-04-27 19:36:16 +02:00
renovate[bot] fc6ca1dde6
chore(deps): update ghcr.io/dexidp/dex docker tag to v2.42.1 (#3044) 2025-04-27 19:08:33 +02:00
Richard Hagen 7d85c99d8e
fix(entra-id): use federated credentials for refresh token (#3031)
* fix: use federated credentials to refresh token in entra id

* fix: add some error handling

* chore: update changelog

* chore: update comments

* chore: update comments

* doc: reference entra id docs and clearer phrasing of comments

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-04-25 09:59:09 +02:00
renovate[bot] 3afae76103
chore(deps): update docker-compose (#3038) 2025-04-24 14:01:29 +02:00
Enrico 07b60b1553
chore(deps): upgrade to latest golang v1.23.x release (#3041) 2025-04-24 13:47:48 +02:00
renovate[bot] 16e453e9f6
chore(deps): update module golang.org/x/net to v0.38.0 [security] (#3035)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-21 15:59:57 +02:00
Justin Ryan 8abdbb5a18
Add --bearer-token-login-fallback option (#2924)
* add --deny-invalid-bearer-tokens

* update changelog

* PR feedback, update api-routes description

* update --api-routes description

* revert load_test fix that I needed locally

---------

Co-authored-by: Justin Ryan <j.ryan@mwam.com>
2025-04-21 13:40:39 +01:00
renovate[bot] bb6ff4ed14
chore(deps): update gitea/gitea docker tag to v1.23.7 (#3030)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-13 19:53:12 +02:00
Joel Speed 7cee02cac3
Merge pull request #3015 from oauth2-proxy/renovate/docker-compose
chore(deps): update docker-compose
2025-04-03 15:39:45 +07:00
renovate[bot] 3325dcb2bd
chore(deps): update docker-compose 2025-03-31 22:19:36 +00:00
Michael Cornel f6b95c0df8
feat: allow to set non-default authorization request response mode (#3001)
* Update Go version in devcontainer

* Add option to change response mode in authorization request

* Fix option name

* Update docs and changelog

* Rename config value to underscore

* Add unit tests for added parameter

* Move change to upcoming release

* Generate alpha config

---------

Co-authored-by: Michael Cornel <michael@stieler.it>
2025-03-31 10:04:19 +02:00
Copolycube b34b617aad
docs: fix gitlab docs url for oauth2 integration (#3002)
* Update gitlab.md with correct url for creating an application

* docs: fix gitlab docs url for oauth2 integration

---------

Co-authored-by: Jan Larwig <jan@larwig.com>
2025-03-29 10:47:54 +01:00
renovate[bot] 99c4c654d9
chore(deps): update docker-compose (#3005) 2025-03-25 21:14:00 +01:00
Evan Gibler b2c69e25eb
feat: update HashNonce to use crypto/sha256 (#2967)
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
2025-03-25 21:12:37 +01:00
renovate[bot] 44d035c32c
chore(deps): update dependency golangci/golangci-lint to v1.64.8 (#3004)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-25 21:03:35 +01:00
github-actions[bot] 2ab22bd9f1
release v7.8.2 (#3012)
* update to release version v7.8.2

* docs: release letter

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-03-25 20:45:16 +01:00
Jan Larwig 46554b5bff
chore(deps): update golang dependencies and pin to latest golang v1.23.x release (#3011)
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-03-25 20:22:56 +01:00
renovate[bot] 669acb9811
chore(deps): update module github.com/golang-jwt/jwt/v5 to v5.2.2 [security] (#3003)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-25 19:57:40 +01:00
renovate[bot] 4e2100a287
chore(deps): update gomod (#2952)
* chore(deps): update gomod

Co-authored-by: Jan Larwig <jan@larwig.com>
2025-03-19 22:19:40 +01:00
renovate[bot] ef51685491 chore(deps): update dependency @easyops-cn/docusaurus-search-local to ^0.49.0 2025-03-19 00:48:38 +01:00
Olivier Mengué 8a8fcab580 deps: remove tools/reference-gen from go.mod
Remove github.com/oauth2-proxy/tools/reference-gen from dependencies.
Instead we are now running it with "go run" with a version suffix.

Long version:
- github.com/oauth2-proxy/tools/reference-gen is removed from
  tools/tool/go
- in pkg/apis/options/doc.go we now run reference-run with a version
  suffix (go run package@version) with the version comming from go.mod.
- the "//go:generate" line is split in 2 lines (using the -command
  flag) for readability
- "go mod tidy" for cleaning dependencies from go.mod, go.sum

Note: we are not upgrading reference-gen here. That will be a further
separate change.
2025-03-19 00:37:11 +01:00
renovate[bot] 9ac8f4b5de chore(deps): update docker-compose 2025-03-12 09:17:13 +01:00
Jan Larwig a01abbd9b2
Merge pull request #2957 from oauth2-proxy/renovate/golangci-golangci-lint-1.x
chore(deps): update dependency golangci/golangci-lint to v1.64.7
2025-03-12 08:55:55 +01:00
renovate[bot] 67c1cd6ee7
chore(deps): update dependency golangci/golangci-lint to v1.64.7 2025-03-12 07:52:38 +00:00
Jan Larwig 089c0eaae1
Merge pull request #2956 from oauth2-proxy/renovate/alpine-3.x
chore(deps): update alpine docker tag to v3.21.3
2025-03-12 08:51:45 +01:00
renovate[bot] 33e7c052dc
chore(deps): update alpine docker tag to v3.21.3 2025-03-12 07:46:30 +00:00
renovate[bot] ee7d79c5d9 chore(deps): update module github.com/go-jose/go-jose/v3 to v3.0.4 [security] 2025-03-12 08:46:00 +01:00
Joel Speed b05be4b1af
Merge pull request #2977 from dsymonds/master
Update golang.org/x/net to v0.36.0.
2025-03-05 16:30:32 +07:00
David Symonds 8a36a6622d Update golang.org/x/net to v0.36.0.
This addresses CVE-2025-22870 (https://go.dev/issue/71984).
2025-03-05 08:13:48 +11:00
Joel Speed 5f4fdbba24
Merge pull request #2969 from dsymonds/master
Update golang.org/x/oauth2 to v0.27.0.
2025-02-25 16:47:14 +07:00
David Symonds cc87465e9b Update golang.org/x/oauth2 to v0.27.0.
This addresses CVE-2025-22868 (https://go.dev/issue/71490).
2025-02-25 20:42:09 +11:00
Joel Speed a25fef7cbf
Merge pull request #2697 from matpen-wi/feat/max-age-instead-of-expires
pkg/cookies: use 'Max-Age' instead of 'Expires' for cookie expiration
2025-02-24 18:27:22 +07:00
Matthias Penner a393ea3ca0 pkg/cookies: use 'Max-Age' instead of 'Expires' for cookie expiration 2025-02-24 11:14:51 +01:00
Joel Speed 80189a9973
Merge pull request #2960 from v0tti/fix_trusted_ip_docs
fix: wrong documentation for --trusted-ip (#2959)
2025-02-19 00:31:47 +07:00
Alexander Votteler 876feeeb3f fix: wrong documentation for --trusted-ip in v7.6, v7.7, v7.8 2025-02-18 17:44:33 +01:00
Alexander Votteler 38bb15300e fix: wrong documentation for --trusted-ip (#2959) 2025-02-17 19:51:37 +01:00
renovate[bot] 2d29cee51e
chore(deps): update helm release dex to v0.20.0 (#2936) 2025-02-01 10:02:41 +01:00
renovate[bot] b72a9f41ea
chore(deps): update gomod (#2937)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-30 12:31:14 +01:00
Joel Speed 8b6e845f27
Merge pull request #2941 from tuunit/doc/add-entra-id-to-issue-template
doc: add entra id to issue templates
2025-01-29 23:32:26 +07:00
Jan Larwig 0364f1b32f
doc: add entra id to issue templates 2025-01-29 14:58:53 +01:00
Joel Speed 39bae25aa2
Merge pull request #2927 from tuunit/chore/bump-golang-1.23
chore(deps/build): bump golang to 1.23 and use go.mod as single point of truth for all build files
2025-01-21 10:12:53 +00:00
Jan Larwig 67f3da232a fix(test): syntax violation of json with one too many closing curly brackets 2025-01-20 20:45:45 +01:00
Jan Larwig 3cf74c21f8 doc: update changelog 2025-01-20 20:45:45 +01:00
Jan Larwig 9b32699c26 chore(deps): update all go depedencies 2025-01-20 20:45:45 +01:00
Jan Larwig 58527ec6c9 chore(build): retrieve go version from go.mod as single point of truth 2025-01-20 20:45:45 +01:00
renovate[bot] 4c823a66c7
chore(deps): update helm release oauth2-proxy to v7.10.2 (#2934)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-20 20:44:56 +01:00
renovate[bot] b7a8d38b9d chore(deps): update dependency @easyops-cn/docusaurus-search-local to ^0.48.0 2025-01-20 19:47:48 +01:00
Joel Speed 04cc932976
Merge pull request #2922 from oauth2-proxy/release/v7.8.1
release v7.8.1
2025-01-15 11:36:19 +00:00
Jan Larwig 0edecd381e
update release highlights 2025-01-15 12:22:44 +01:00
github-actions[bot] c580b7fad7 update to release version v7.8.1 2025-01-15 11:04:42 +00:00
Joel Speed 46b3b261af
Merge pull request #2920 from tuunit/fix/missing-version-during-docker-built
fix: missing oauth2-proxy version for docker builds
2025-01-15 10:57:50 +00:00
Jan Larwig a29eda3a6d
Merge branch 'master' into fix/missing-version-during-docker-built 2025-01-15 09:08:42 +01:00
stomekpe f31e02cebd
fix: jwt regex validation error during skip-jwt-bearer-tokens flow (#2888)
---------

Co-authored-by: Jan Larwig <jan@larwig.com>
2025-01-15 09:06:21 +01:00
Jan Larwig f1a5011108
fix: setting missing version during docker built 2025-01-14 16:29:26 +01:00
Joel Speed fafb47e45a
Merge pull request #2914 from oauth2-proxy/release/v7.8.0
release v7.8.0
2025-01-14 11:38:46 +00:00
tuunit 8dd2cbec4d
fix: systemd socket support build handling for windows 2025-01-13 16:41:33 +01:00
tuunit ae5b5dc45f
doc: update release v7.8.0 changelog 2025-01-13 16:41:33 +01:00
github-actions[bot] f2ce83b154
doc: add new docs version 7.8.x 2025-01-13 16:41:19 +01:00
renovate[bot] f400e6f340 chore(deps): update gitea/gitea docker tag to v1.23.1 2025-01-12 20:33:51 +01:00
renovate[bot] c90487926c chore(deps): update alpine docker tag to v3.21.2 2025-01-12 18:46:57 +01:00
renovate[bot] f5631a657c
chore(deps): update dependency @easyops-cn/docusaurus-search-local to ^0.47.0 (#2911)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-12 18:42:40 +01:00
Joel Speed 01b01d82a1
Merge pull request #2376 from tuunit/feature/static-public-keys-support
feature: static public keys file support for oidc provider
2025-01-11 17:58:26 +00:00
axel7083 e28603f7af
feature: static public keys file support for oidc provider
Co-authored-by: Jan Larwig <jan@larwig.com>
Co-authored-by: JJ Łakis <jacek.lakis@checkatrade.com>
2025-01-11 12:09:23 +00:00
JJ Łakis ae8fb08a89
feat(entra): add Workload Identity support for Entra ID (#2902) 2025-01-11 11:12:41 +00:00
Jon Newton 60570cc60e
doc: fix formatting issue in Google provider doc (#2907)
A missing line break caused subsequent list items to be squished into a single paragraph.
2025-01-09 01:51:20 +01:00
renovate[bot] 5df6053280 chore(deps): update helmv3 2025-01-08 21:42:59 +01:00
renovate[bot] 75a1099a8f chore(deps): update docker-compose 2025-01-08 21:32:34 +01:00
renovate[bot] 1c3bc31665 chore(deps): update dependency golangci/golangci-lint to v1.63.4 2025-01-08 20:57:15 +01:00
Vinay Chandrasekharan 5260633103
doc: fix dex helm chart values for k8s example (#2880)
---------

Co-authored-by: vinay chandrasekharan <vinay.cn@gmail.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-01-04 19:09:36 +01:00
renovate[bot] 507d63e05b chore(deps): update dependency @easyops-cn/docusaurus-search-local to ^0.46.0 2025-01-04 19:02:37 +01:00
renovate[bot] 140674e492
chore(deps): update alpine docker tag to v3.21.0 (#2877)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-04 18:57:30 +01:00
Joel Speed cdcc62014d
Merge pull request #2894 from oauth2-proxy/fix-lint
Fix linting after updating golangci-lint to 1.62.2
2024-12-31 19:19:57 +07:00
Joel Speed f41a686b43
Fix linting after updating golangci-lint to 1.62.2 2024-12-31 13:14:39 +01:00
Joel Speed c1a21aa877
Merge pull request #2872 from oauth2-proxy/renovate/golangci-golangci-lint-1.x
chore(deps): update dependency golangci/golangci-lint to v1.62.2
2024-12-31 19:00:30 +07:00
renovate[bot] 1346ae6079
chore(deps): update dependency golangci/golangci-lint to v1.62.2 2024-12-31 11:53:30 +00:00
Joel Speed fe6f8ddb65
Merge pull request #2878 from oauth2-proxy/renovate/golang-1.x
chore(deps): update dependency golang to v1.23.4
2024-12-31 18:52:56 +07:00
renovate[bot] 5edff8fe1a
chore(deps): update dependency golang to v1.23.4 2024-12-31 11:46:50 +00:00
JJ Łakis 5f188e5b6b
Microsoft Entra ID provider (#2390)
* Microsoft Entra ID Provider

* fix typo in function name

* documentation tweaks

* documentation and comment tweak

* docs tweaks

* final tweaks

* refactor: drop flag for skipping graph groups

* update legacy / deprecated provider page and sort provider overview

* reformat

* move entra-id provider into switch (treat like every other provider

* fix test case and reformat

* fix sidebar configuration

* apply review suggestions

* add pagination for graph api

* fix: do not error when groups unable to retrieve

* doc: number of groups fix

* restore master packages

* docs: tiny docs tweak

* address review comments

* fix codegen

---------

Co-authored-by: tuunit <jan@larwig.com>
2024-12-31 11:46:13 +00:00
Joel Speed c64ec1251b
Merge pull request #2886 from oauth2-proxy/renovate/go-golang.org-x-net-vulnerability
chore(deps): update module golang.org/x/net to v0.33.0 [security]
2024-12-23 17:38:28 +07:00
renovate[bot] 47638db231
chore(deps): update module golang.org/x/net to v0.33.0 [security] 2024-12-19 02:01:45 +00:00
Joel Speed bcf20346cf
Merge pull request #2884 from oauth2-proxy/renovate/go-golang.org-x-crypto-vulnerability
chore(deps): update module golang.org/x/crypto to v0.31.0 [security]
2024-12-17 15:02:49 +07:00
renovate[bot] 0dca9af6d7
chore(deps): update module golang.org/x/crypto to v0.31.0 [security] 2024-12-12 00:59:31 +00:00
ciffelia ef8ba75987
docs: fix insecure Caddy configuration example (#2827)
The original example only protected the root (`/`) path, leaving other routes unsecured.
* docs: add syntax highlighting for nginx config
* docs: fix headings in `configuration/integration` page
* docs: fix redirect in caddy configuraion example
2024-11-11 10:04:04 +01:00
renovate[bot] 5042203625 chore(deps): update docker-compose 2024-11-11 09:44:08 +01:00
renovate[bot] bc1224291c chore(deps): update gomod 2024-11-10 22:43:42 +01:00
Jacek J. Łakis 05b91f310a chore: extend test cases for oidc provider and documentation regarding implicit setting of the groups scope when no scope was specified in the config
Co-authored-by: Jan Larwig <jan@larwig.com>
2024-11-09 15:48:29 +01:00
renovate[bot] 2fd2f8c63d chore(deps): update gomod 2024-11-06 16:56:57 +01:00
Vish (Ishaya) Abrams 4e2013e6ba
fix: update code_verifier to use recommended method (#2620)
The [RFC](https://datatracker.ietf.org/doc/html/rfc7636#section-4.1)
says that a code verifier just uses unreserved characters, but the
recommended method is that it is a base64-urlencoded 32-octet url. Some
implementations of PKCE (most notably the one used by salesforce)
require that this is a valid base64 encoded string[1], so this patch
switches to using the recommended approach to make it more compatible.

[1]: https://help.salesforce.com/s/articleView?id=sf.remoteaccess_pkce.htm&type=5
2024-11-06 15:16:39 +01:00
Ondrej Sika 3ceef0cff4
feat: add CF-Connecting-IP as supported real ip header (#2821) 2024-11-04 23:28:08 +01:00
Reto Kupferschmid 64e736f668
fix: websocket path rewrite (#2300) 2024-11-04 23:12:35 +01:00
renovate[bot] 96f0288a36
chore(deps): update alpine docker tag to v3.20.3 (#2682) 2024-11-04 22:30:56 +01:00
renovate[bot] 0bc8dd98e2
chore(deps): update module github.com/go-jose/go-jose/v3 to v3.0.3 [security] (#2831) 2024-11-04 22:22:03 +01:00
renovate[bot] 50ec7fa902
chore(deps): update dependency node to v22 (#2836) 2024-11-04 22:16:30 +01:00
Benjamin Cremer b4f7e0603e
doc: fix relative URLs to configuration page (#2818) 2024-10-29 16:21:43 +01:00
Joel Speed 4d2b5c30a1
Merge pull request #1985 from isodude/systemd-socket
Add support for systemd socket
2024-10-28 03:56:05 +07:00
renovate[bot] 5ec03ab0e9
chore(deps): update module github.com/go-jose/go-jose/v3 to v4 (#2598) 2024-10-27 17:25:27 +01:00
Jan Larwig 9945b68a06
doc: readme overhaul and azure sponsorship (#2826)
* new readme structure

* add adopters file

* add microsoft sponsorship

* add reference to adopter file

* add gopher slack invite link

* slightly rephrase nightly image section

* add sponsor request for action

* better formatting for contributor wall

* add longer wait time for stale PRs and issues and allow for exemption through bug and high-priority labels

* apply review suggestion

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

---------

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2024-10-27 12:12:46 +00:00
Josef Johansson 6743a9cc89 Add support for systemd.socket
When using sockets to pass data between e.g. nginx and oauth2-proxy it's
simpler to use sockets. Systemd can even facilitate this and pass the
actual socket directly.

This also means that only the socket runs with the same group as nginx
while the service runs with DynamicUser.

Does not support TLS yet.

nginx
```
server {
    location /oauth2/ {
      proxy_pass http://unix:/run/oauth2-proxy/oauth2.sock;
}
```

oauth2-proxy.socket
```
[Socket]
ListenStream=%t/oauth2.sock
SocketGroup=www-data
SocketMode=0660
```

Start oauth2-proxy with the parameter `--http-address=fd:3`.

Signed-off-by: Josef Johansson <josef@oderland.se>
2024-10-23 09:35:47 +02:00
Josef Johansson bc8e7162db Allow parsing remote address headers over unix sockets
When listening to a unix socket there is no RemoteAddr for http.Request.
Instead of setting nil, Go sets it to '@'. Marking the IP as trusted if
RemoteAddr allows rest of the settings for parsing remote address in
headers to be applied.

Signed-off-by: Josef Johansson <josef@oderland.se>
2024-10-23 07:48:54 +02:00
Konstantin Shalygin e00c7a7edd
fix(contrib): revamped systemd service example (#2655) 2024-10-13 20:00:54 +02:00
bjencks 66f1063722
feat: add X-Envoy-External-Address as supported header (#2755) 2024-10-13 19:55:47 +02:00
renovate[bot] 798b846643 chore(deps): update dependency @easyops-cn/docusaurus-search-local to ^0.45.0 2024-10-13 19:43:24 +02:00
Josh Cox c555f5f6d5
chore: removed duplicate image line in docker-compose (#2817) 2024-10-13 19:37:26 +02:00
Chad Miller defc456ba0
doc: expand on --upstream URL matching and trailing slash behaviour (#2813) 2024-10-12 18:57:21 +02:00
Gavin Mogan ab448cf38e
doc: add standard opencontainer docker labels (#2800) 2024-10-09 15:01:36 +02:00
Joel Speed 6fb020149a
Merge pull request #2807 from oauth2-proxy/release/v7.7.1
release v7.7.1
2024-10-08 17:38:38 +01:00
github-actions[bot] 055a63432c
update to release version v7.7.1 2024-10-08 14:41:41 +02:00
Nuno Miguel Micaelo Borges ff761d2523
fix: runtime error: index out of range (0) with length 0 (#2328)
* Issue 2311: runtime error: index out of range [0] with length 0 while extracting state of of the csrf

---------

Co-authored-by: tuunit <jan@larwig.com>
2024-10-08 14:40:41 +02:00
rd-danny-fleer 642ba174d4
fix: unable to use hyphen in JSON path for oidc-groups-claim option (#2619) 2024-10-07 20:08:44 +02:00
Joel Speed d68336dcf4
Merge pull request #2803 from tuunit/bugfix/self-signed-certificate-handling
fix: self signed certificate handling in v7.7.0
2024-10-07 11:54:22 +01:00
tuunit 4bd920b208
add changelog entry 2024-10-06 21:55:45 +02:00
tuunit bae168f06a
better handling of default transport modification 2024-10-06 21:43:38 +02:00
tuunit 8fd7312a90
fix: self signed certificate handling 2024-10-05 17:29:37 +02:00
Joel Speed cda641473f
Merge pull request #2798 from oauth2-proxy/release/v7.7.0
fix(ci): testing full release cycle before release branches can be merged
2024-10-02 15:17:25 +01:00
tuunit 07230ead91
fix(ci): testing full release cycle before release branches can be merged 2024-10-02 16:03:13 +02:00
Joel Speed f5d36705fa
Merge pull request #2792 from oauth2-proxy/release/v7.7.0
release v7.7.0
2024-10-02 13:52:47 +01:00
tuunit 1dd4a412b0
add new loop var linter for go1.22 and remove unnecessary exportloopref linter 2024-10-01 11:15:48 +02:00
tuunit 3c7dadcbd2
add v7.7.0 release highlights 2024-10-01 11:15:48 +02:00
tuunit 6e32bd6e38
fix missing 'changes since' section logic 2024-10-01 11:15:47 +02:00
tuunit f0fe33e032
enforce go 1.22.7 2024-10-01 11:15:47 +02:00
tuunit 715995843c
fix golangci-lint version in pipelines 2024-10-01 11:15:47 +02:00
github-actions[bot] f432cf79e2
update to release version v7.7.0 2024-10-01 11:15:46 +02:00
github-actions[bot] f978388e28
add new docs version 7.7.x 2024-10-01 11:15:41 +02:00
Johann 65e83fc3cc
fix(csrf): possible infinite loop (#2607) 2024-09-30 18:20:43 +02:00
Joel Speed 021d940dcd
Merge pull request #2790 from oauth2-proxy/chore/update-all-dependencies
chore(deps): update all golang dependencies
2024-09-25 09:52:27 +01:00
tuunit ad3ee0f66c
update relase pipeline 2024-09-25 10:34:28 +02:00
tuunit 41c8d5bfce chore(deps): update all golang dependencies 2024-09-23 16:38:40 +02:00
dabde fff5dd358f
doc: add example for caddy v2 forward_auth (#2759)
---------

Co-authored-by: Denis Dabischa <34655672+dabde@users.noreply.github.com>
Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
2024-09-23 16:34:08 +02:00
Bastian Oppermann bc034454f6
fix go version in DevContainer and contibution guide (#2768)
* Remove trailing whitespaces in contribution.md

They make the pre-commit hook "trailing-whitespace" fail.

* Correct Go version in DevContainer and Contibution guide
2024-09-23 16:23:27 +02:00
mikolajtkaczyk64 d365d5fc41
doc: fix toml key for provider ca certs (#2780)
* Fixed toml key of --provider-ca-file flag
2024-09-17 12:46:55 +02:00
yudrywet 4fe0d5659b chore: fix function names in comment
Signed-off-by: yudrywet <yudeyao@yeah.net>
2024-09-15 09:34:15 +02:00
Edvard Gjessing Bakken e91f09875a Update docker-compose-nginx.yaml
working nginx example. docker-compose-nginx was missing some configuration to run out of the box.
2024-09-15 09:28:42 +02:00
Steffen Schneider d436e19183 Fix broken traefik docs link
Old link:
https://doc.traefik.io/traefik/middlewares/forwardauth/

Replaced with:
https://doc.traefik.io/traefik/middlewares/http/forwardauth/
2024-09-15 09:19:54 +02:00
Joel Speed e293dddef4
Merge pull request #2589 from ianroberts/file-upstream-rewrite
Add support for rewriteTarget in file: upstreams
2024-09-03 09:37:17 +01:00
Stephan Eicher e12ae03801
doc: explain value comma separation for plural environment variables (#2732)
* Mention value seperation for plural environment variables

* Mention value seperation for plural environment variables on version 7.6.x documentation

* change phrasing for better clarification

---------

Co-authored-by: tuunit <jan@larwig.com>
2024-09-02 20:13:47 +02:00
Ian Roberts 51c65c9e79 docs: added changelog entry for file upstream rewriteTarget 2024-09-02 11:27:48 +01:00
Ian Roberts 16f032bce9 Clarify what rewriteTarget means for a file: upstream 2024-09-02 11:27:28 +01:00
Ian Roberts cb53401c3a Don't use http.StripPrefix when a file: upstream has rewriteTarget
A regular (non-regex) file: upstream needs to strip the prefix so that it is equivalent to "mounting" the specified directory under the configured path in the URL space, but with regex rewriting the target path is determined by the rewriteTarget.

Fixes oauth2-proxy/oauth2-proxy#2242
2024-09-02 11:27:28 +01:00
Ian Roberts b618ed7150 Test for a file:/// upstream combined with regex path rewrite 2024-09-02 11:27:28 +01:00
igor.udot 076d2df246 fix: add the OAuth2 image to the local environment examples in the compose file 2024-08-28 23:38:57 +02:00
renovate[bot] 1ba2353685 chore(deps): update dependency golangci/golangci-lint to v1.60.3 2024-08-28 23:34:14 +02:00
priby05 87b598c3c5 Add s390x nightly build 2024-08-28 23:26:30 +02:00
priby05 f71a7fd2a2
feature/s390x architecture support (#2734)
* Add s390x architecture support

* Update CHANGELOG
2024-08-23 09:02:02 +02:00
renovate[bot] ecfa2ca83f chore(deps): update dependency golangci/golangci-lint to v1.60.2 2024-08-21 11:59:39 +02:00
Jan Larwig e22b8d0eca
doc: update maintainer emails (#2748) 2024-08-20 18:56:11 +02:00
Teko f9a0a4a280
doc: fix typo in function description (#2738) 2024-08-20 18:41:23 +02:00
Jan Larwig 9a9e7b7a37
docs: restructure all options and flags (#2747)
* remove package lock file

* update next docs

* update latest v7.6 docs

* switch to npm install for docs

* sort sections alphabetically
2024-08-20 10:40:27 +02:00
Joel Speed 95cbd0cdfb
Merge pull request #2723 from tuunit/docs/add-toml-fields
docs: restructure configuration options overview and optimize build and dependency management
2024-08-07 15:02:07 +07:00
tuunit 12105c446f
add toml field 2024-07-26 20:14:49 +02:00
tuunit a15eba427d
reformatting of markdown tables 2024-07-26 19:48:10 +02:00
renovate[bot] 100ffdcb3d
chore(deps): update docker-compose (#2714)
* chore(deps): update docker-compose

* reduce specificity of keycloak tag

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2024-07-25 23:23:17 +02:00
renovate[bot] 5aea780e46 chore(deps): update helm release oauth2-proxy to v7.7.9 2024-07-25 23:14:31 +02:00
Smig 4929dc4112
docs: fix broken traefik docs link in overview.md (#2717)
---------

Co-authored-by: Jan Larwig <jan@larwig.com>
2024-07-23 20:19:46 +02:00
Koen van Zuijlen ce8b63bc21
chore(examples): update keycloak to v25 (#2706)
---------

Co-authored-by: tuunit <jan@larwig.com>
2024-07-18 23:57:15 +02:00
Jan Larwig ca25c906bb
docs: update provider list with refresh support (#2711)
---------

Co-authored-by: mikefab-msf <117652131+mikefab-msf@users.noreply.github.com>
2024-07-18 23:43:58 +02:00
tuunit 49aa69b162 revert: ignoring non-code paths 2024-07-18 23:29:08 +02:00
Jan Larwig 0e4962a9e8 chore(ci): ignore markdown files for ci 2024-07-18 23:11:20 +02:00
Jan Larwig f60b7f321f
chore(ci): add paths-ignore for none code related directories (#2695)
* add paths-ignore for none code related directories

* add missing pipe
2024-07-18 22:56:57 +02:00
Koen van Zuijlen 343bd61ebb
chore(deps): Updated to ginkgo v2 (#2459)
* chore(deps): Updated to ginkgo v2

* fix basic auth test suite cleanup

* fix redis store tests

* add changelog entry

---------

Co-authored-by: Jan Larwig <jan@larwig.com>
2024-07-18 22:41:02 +02:00
af su 211c605875
docs: additional notes about available claims for HeaderValue (#2674)
* docs: additional notes on HeaderValue

* docs: add code comments

* fix missing preferred_username

* regenerate docs

* add changelog entry

---------

Co-authored-by: afsu <saf@zjuici.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2024-07-18 22:31:19 +02:00
Simon a22668eb8c
docs: make clear that any access token expiry dates are ignored (#2644)
* docs: make clear that any access token expiry dates are ignored

* clarify why access-token expiration cannot be validated

---------

Co-authored-by: Jan Larwig <jan@larwig.com>
2024-07-18 22:11:40 +02:00
Jacob Middag 3045392c17
feat: Replace default Go user-agent with oauth2-proxy and version (#2570)
* feat: Replace default Go user-agent with oauth2-proxy and version

* Add to CHANGELOG

* Make userAgentTransport configurable and composable

* Use correct naming convention for DefaultHTTPClient

* Move version to own package and use named arguments

* Update version path in Makefile

* Fix import path in Makefile

* Change importpath in dist.sh

* Minor style issues
2024-07-14 21:09:17 +01:00
Koen van Zuijlen 45ec12bcae
Merge pull request #2700 from oauth2-proxy/renovate/docker-compose 2024-07-14 22:06:03 +02:00
renovate[bot] 8a6a3ef3a4
chore(deps): update docker-compose 2024-07-14 20:00:56 +00:00
Koen van Zuijlen 9e23b57038
Merge pull request #2705 from oauth2-proxy/renovate/npm 2024-07-14 22:00:18 +02:00
renovate[bot] 4122e64dbc
chore(deps): update dependency @easyops-cn/docusaurus-search-local to v0.44.3 2024-07-14 19:56:28 +00:00
Jan Larwig 45fe2dcfd1
fix: docs link in SECURITY.md 2024-07-14 21:55:47 +02:00
Davi Rodrigues 9f64c67d65
Update SECURITY.md 2024-07-07 18:29:14 -03:00
renovate[bot] 6c0d1c5672 chore(deps): update helm release oauth2-proxy to v7.7.8 2024-07-01 21:57:05 +02:00
Blue Falcon 8dfb7e9b26
docs: update README and fix code some commentary typos (#2608)
* Update overview.md

see: fc701bfd6a/pkg/apis/options/options.go (L123)

* docs(code-commentary): typo

- fixed typo

---------

Co-authored-by: Jan Larwig <jan@larwig.com>
2024-06-24 22:15:24 +02:00
Jan Larwig 3460cd4c74
chore(deps): update dependency codeclimate/test-reporter to v1
Merge pull request #2564 from oauth2-proxy/renovate/codeclimate-test-reporter-1.x
2024-06-23 19:59:21 +02:00
Jan Larwig 70057d3056
strip v off of version for generating the correct download url 2024-06-23 19:54:01 +02:00
tuunit 72ee8c8146
fix test reporter flags 2024-06-23 19:42:33 +02:00
Jan Larwig ece8145bd4
Merge branch 'master' into renovate/codeclimate-test-reporter-1.x 2024-06-23 19:06:41 +02:00
Jan Larwig 94aa62eece
chore(deps): update helm release oauth2-proxy to v7
Merge pull request #2565 from oauth2-proxy/renovate/major-helmv3
2024-06-23 19:06:21 +02:00
renovate[bot] a472392b81
chore(deps): update helm release oauth2-proxy to v7 2024-06-23 16:52:19 +00:00
Jan Larwig 2bb7ea5cc9
Merge branch 'master' into renovate/codeclimate-test-reporter-1.x 2024-06-23 18:50:57 +02:00
Jan Larwig 3f042de6fc
Merge pull request #2593 from oauth2-proxy/renovate/gomod
chore(deps): update gomod
2024-06-23 18:50:37 +02:00
Jan Larwig f201dff10c
Merge branch 'master' into renovate/codeclimate-test-reporter-1.x 2024-06-23 18:49:17 +02:00
renovate[bot] 65225ba397
chore(deps): update gomod 2024-06-23 16:46:10 +00:00
Jan Larwig 5053a5d20e
chore(deps): update dependency @easyops-cn/docusaurus-search-local to v0.44.2
Merge pull request #2683 from oauth2-proxy/renovate/npm
2024-06-23 18:45:13 +02:00
Jan Larwig 7508c62c1f
fix version scheme for download url 2024-06-23 18:43:39 +02:00
renovate[bot] 02a272340f
chore(deps): update dependency codeclimate/test-reporter to v1 2024-06-23 16:36:21 +00:00
renovate[bot] 907b957018
chore(deps): update dependency @easyops-cn/docusaurus-search-local to v0.44.2 2024-06-23 16:36:12 +00:00
Jan Larwig f583dd0b80
Merge pull request #2580 from oauth2-proxy/renovate/actions-configure-pages-5.x
chore(deps): update actions/configure-pages action to v5
2024-06-23 18:35:08 +02:00
renovate[bot] 38d70fef7f
chore(deps): update actions/configure-pages action to v5 2024-06-10 15:31:38 +00:00
Koen van Zuijlen 10f26364c6
Merge pull request #2563 from oauth2-proxy/renovate/helmv3 2024-06-10 17:31:12 +02:00
renovate[bot] 92c2f06bf7
chore(deps): update helmv3 2024-06-10 15:20:55 +00:00
Koen van Zuijlen 0f5abe55d2
Merge pull request #2592 from oauth2-proxy/renovate/golang-1.x 2024-06-10 17:20:11 +02:00
renovate[bot] ca9c0fbe7d
chore(deps): update dependency golang to v1.22.4 2024-06-10 15:16:34 +00:00
Koen van Zuijlen 7dd8640f21
Merge pull request #2609 from oauth2-proxy/renovate/docker-compose 2024-06-10 17:16:12 +02:00
renovate[bot] 252c978c5b
chore(deps): update docker-compose 2024-06-10 12:36:37 +00:00
Koen van Zuijlen a5fdb35b28
Merge pull request #2594 from oauth2-proxy/renovate/npm 2024-06-10 14:36:07 +02:00
renovate[bot] 8ee859bdfe
chore(deps): update npm 2024-06-10 10:26:35 +00:00
Joel Speed f450bf4563
Merge pull request #2648 from oauth2-proxy/renovate/alpine-3.x
chore(deps): update alpine docker tag to v3.20.0
2024-06-10 17:25:34 +07:00
renovate[bot] 0998ca6964
chore(deps): update alpine docker tag to v3.20.0 2024-06-10 10:00:52 +00:00
Joel Speed 5c315cd7ad
Merge pull request #2663 from pierluigilenoci/CVE_fix
Upgraded all modules to the latest version
2024-06-10 17:00:29 +07:00
Pierluigi Lenoci 2d07c08811
Added changelog and docs 2024-06-10 11:37:00 +02:00
Pierluigi Lenoci 60b879f409
Upgraded all modules to the latest version 2024-06-10 11:29:16 +02:00
Joel Speed e058c4d636
Merge pull request #2637 from tuunit/docs/fix-search
docs: fix search
2024-05-10 11:26:18 +01:00
tuunit 2c65f396e2
upgrade docusaurus dependencies 2024-05-09 16:06:03 +02:00
tuunit ed51762065
fix footnote parsing error 2024-05-09 16:02:51 +02:00
tuunit e02086f467
fix search and add some additional options for better usability 2024-05-09 16:02:21 +02:00
Jan Larwig fc701bfd6a
docs/fix-go-install-instruction (#2578)
* docs/fix-go-install-instruction

* use correct tense
2024-03-31 08:48:07 +07:00
renovate[bot] 36f8dbcbcc
chore(deps): update docker-compose (#2558)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-30 15:48:32 +07:00
Martin 2ffa92b1c9
oauth2-proxy.service.example: Remove syslog.target (#2538)
Remove syslog.target from service file, this target hasn't existed for over a decade.

6aa8d43ade/NEWS (L72-L73)
2024-03-30 15:48:11 +07:00
renovate[bot] bdd65ebab6
chore(deps): update module github.com/go-jose/go-jose/v3 to v3.0.3 [security] (#2549)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-30 15:41:21 +07:00
Lautaro Jayat 33088053a5
feat: adding scope to oauth2-proxy.cfg.example (#2489) 2024-03-30 15:36:17 +07:00
Joel Speed 0678626e63
Merge pull request #2539 from isodude/fix-leaky-test
pkg/http: Fix leaky test
2024-03-30 11:48:06 +07:00
Josef Johansson 8f7209ba1a pkg/http: Fix leaking goroutines in tests
By using the context created by the test, the goroutines produced in
http.Client is actually closed when cancelled and such, not leaked.

Signed-off-by: Josef Johansson <josef86@gmail.com>
2024-03-26 12:31:26 +01:00
Josef Johansson bb6aba4a00 pkg/http/server_test.go: Add gleak to find goroutine leaks
Signed-off-by: Josef Johansson <josef86@gmail.com>
2024-03-26 12:30:41 +01:00
Joel Speed 3b11a51a70
Merge pull request #2548 from ternbusty/fix-timestamp-format-in-docs
modify timestamp format in docs
2024-03-26 06:10:45 +00:00
Joel Speed 913d38f3c2
Merge pull request #2559 from oauth2-proxy/renovate/npm
chore(deps): update npm
2024-03-26 05:49:04 +00:00
renovate[bot] 95fd69b5bf
chore(deps): update npm 2024-03-17 09:17:51 +00:00
Joel Speed 5a05847186
Merge pull request #2472 from kvanzuijlen/renovate-config
chore: Added renovate configuration
2024-03-11 13:35:22 +00:00
ternbusty 58ad054053 modify timestamp format in docs 2024-03-07 21:21:33 +09:00
Joel Speed c6b723f993
Merge pull request #2541 from oauth2-proxy/renovate/golang.org-x-exp-digest
chore(deps): update golang.org/x/exp digest to 814bf88
2024-03-04 11:23:09 +00:00
renovate[bot] d35d23f75f
chore(deps): update golang.org/x/exp digest to 814bf88 2024-03-04 08:16:39 +00:00
Joel Speed 554cd0c732
Merge pull request #2534 from muffl0n/patch-2
Fix link to Google documentation
2024-03-04 08:15:38 +00:00
Joel Speed 6d1ef82aa6
Merge pull request #2540 from kvanzuijlen/update-go-jwt
chore: Updated go-jwt to v5
2024-03-04 07:54:21 +00:00
kvanzuijlen f8efdbae5f
chore: Updated go-jwt to v5 2024-03-04 01:42:00 +01:00
kvanzuijlen d60b8460ee
chore: Use latest codeclimate version 2024-03-04 00:46:35 +01:00
kvanzuijlen 448684abe2
chore: Use Node version file and Go version file 2024-03-04 00:45:22 +01:00
kvanzuijlen cdcc6fb4c0
Merge branch 'master' into renovate-config
# Conflicts:
#	.github/workflows/publish-release.yml
#	contrib/local-environment/docker-compose-gitea.yaml
2024-03-04 00:44:12 +01:00
Sven Schliesing 5d1eb25629
Fix link to Google documentation 2024-03-01 22:34:16 +01:00
Joel Speed e3dc927e57
Merge pull request #2501 from oauth2-proxy/renovate/github.com-oauth2-proxy-mockoidc-digest
chore(deps): update github.com/oauth2-proxy/mockoidc digest to 6186c30
2024-02-14 10:58:38 +00:00
renovate[bot] 5a059510af
chore(deps): update github.com/oauth2-proxy/mockoidc digest to 6186c30 2024-02-14 09:35:43 +00:00
Joel Speed 98a2ec766b
Merge pull request #2470 from oauth2-proxy/renovate/google.golang.org-api-0.x
chore(deps): update module google.golang.org/api to v0.164.0
2024-02-14 09:35:01 +00:00
renovate[bot] c5ec06de5a
chore(deps): update module google.golang.org/api to v0.164.0 2024-02-14 09:26:26 +00:00
Joel Speed 2afe933083
Merge pull request #2471 from oauth2-proxy/renovate/alpine-3.x
chore(deps): update alpine docker tag to v3.19.1
2024-02-14 09:20:02 +00:00
Joel Speed 9b54fcdd66
Merge pull request #2477 from oauth2-proxy/renovate/github.com-ohler55-ojg-1.x
chore(deps): update module github.com/ohler55/ojg to v1.21.1
2024-02-14 09:19:48 +00:00
Joel Speed cf7d1e57e5
Merge pull request #2480 from oauth2-proxy/renovate/golang.org-x-exp-digest
chore(deps): update golang.org/x/exp digest to ec58324
2024-02-14 09:19:32 +00:00
renovate[bot] 687f5d90a1
chore(deps): update module github.com/ohler55/ojg to v1.21.1 2024-02-14 09:08:32 +00:00
renovate[bot] a448d4798d
chore(deps): update alpine docker tag to v3.19.1 2024-02-14 09:07:08 +00:00
renovate[bot] bf0c151510
chore(deps): update golang.org/x/exp digest to ec58324 2024-02-14 09:07:05 +00:00
Joel Speed 69a6c03c06
Merge pull request #2488 from oauth2-proxy/renovate/docker.io-library-golang-1.x
chore(deps): update docker.io/library/golang docker tag to v1.22
2024-02-14 09:05:05 +00:00
Joel Speed 3170c07318
Merge pull request #2500 from kvanzuijlen/patch-1
docs: Fix broken links in README.md
2024-02-14 09:04:19 +00:00
Koen van Zuijlen 2f9bb540d1
docs: Fix broken links in README.md 2024-02-14 01:12:11 +01:00
renovate[bot] 4b4703f4d7
chore(deps): update docker.io/library/golang docker tag to v1.22 2024-02-13 11:19:38 +00:00
Joel Speed 7af1e42788
Merge pull request #2499 from tuunit/release/v7.6.0
fix linter version for publish workflow
2024-02-13 11:18:07 +00:00
tuunit c63605127b fix linter version for publish workflow 2024-02-13 12:09:42 +01:00
Joel Speed 4178ac4e54
Merge pull request #2498 from oauth2-proxy/release/v7.6.0
release v7.6.0
2024-02-13 10:44:10 +00:00
Joel Speed 40efe7989a
Add slug for welcome.md 2024-02-13 10:23:04 +00:00
github-actions[bot] b009395223
update to release version v7.6.0 2024-02-13 10:00:54 +00:00
github-actions[bot] 975c739b62 add new docs version 7.6.x 2024-02-13 09:48:45 +00:00
kvanzuijlen ff91a56847
chore: Added group for golang version 2024-02-08 20:24:37 +01:00
kvanzuijlen 47388f4b62
chore: Added codeclimate version 2024-01-27 10:11:09 +01:00
kvanzuijlen 6374ad1d31
chore: simplified file match 2024-01-27 10:05:45 +01:00
kvanzuijlen 3c06739a8f
chore: Added trailing commas 2024-01-27 10:03:31 +01:00
kvanzuijlen dd5576f2b2
chore: Added renovate configuration 2024-01-27 09:57:42 +01:00
renovate[bot] 84e1cc24e3
chore(deps): update docker/setup-qemu-action action to v3 (#2450)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-26 13:00:31 +00:00
renovate[bot] d2b37d813b
chore(deps): update docker/setup-buildx-action action to v3 (#2449)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-26 13:00:18 +00:00
renovate[bot] fc63fc8dc5
chore(deps): update actions/upload-artifact action to v4 (#2439)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-26 12:59:53 +00:00
Damien Degois e7d20519df
Session aware logout, backend logout url approach (#1876)
* Session aware logout, backend logout url approach

* Add CHANGELOG.md and documentation for #1876

* Proper http handling and case change for golint compliance

* Update alpha_config.md

* Fix case conformity

* Change placeholder from ${id_token} to {id_token}

As this should be specified in a URL and curly braces should be escaped as %7b and %7d, therefore using {} shouldn't be an issue

* Apply suggestions from code review

Co-authored-by: Jan Larwig <jan@larwig.com>

* Add other suggestions

* Add suggestions and move background logout to generic provider

* Changelog updated

* Update oauthproxy.go

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

* Add comment for gosec, remove sensitive data from log

---------

Co-authored-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2024-01-26 12:48:09 +00:00
Jan Larwig 6c2c115d30
docs: upgrade to docusaurus 3.1.0 (#2388)
* initial commit for docusaurus 3 upgrade

* fix mdx errors

* fix mdx issues

* fix routing issues

* update docs generation workflow

* fix version

* fix permissions

* move slack to header

* remove background color and minify

* Add suggestions

* add shell to code blocks
2024-01-26 12:07:01 +00:00
renovate[bot] de0b6dd8a9
chore(deps): update mcr.microsoft.com/vscode/devcontainers/go docker tag to v1 (#2453)
* chore(deps): update mcr.microsoft.com/vscode/devcontainers/go docker tag to v1

* Update .devcontainer/Dockerfile

Co-authored-by: Koen van Zuijlen <8818390+kvanzuijlen@users.noreply.github.com>

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
Co-authored-by: Koen van Zuijlen <8818390+kvanzuijlen@users.noreply.github.com>
2024-01-26 11:55:12 +00:00
renovate[bot] ec13ae03c9
chore(deps): update github/codeql-action action to v3 (#2452)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-26 10:35:16 +00:00
renovate[bot] b1929c740c
chore(deps): update module google.golang.org/api to v0.158.0 (#2464)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-26 10:27:34 +00:00
renovate[bot] 509287b555
chore(deps): update module github.com/google/uuid to v1.6.0 (#2456)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-25 09:49:51 +00:00
Jan Larwig 82ab37b9df
add code of conduct (#2387) 2024-01-23 11:39:10 +00:00
renovate[bot] 5123910071
chore(deps): update dependency ubuntu to v22 (#2447)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-23 11:38:15 +00:00
renovate[bot] 74519f618d
chore(deps): update docker/login-action action to v3 (#2448)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-23 11:33:10 +00:00
renovate[bot] 6a03a110bb
chore(deps): update module google.golang.org/api to v0.157.0 (#2429)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-23 10:11:02 +00:00
renovate[bot] 327345250a
chore(deps): update actions/setup-go action to v5 (#2433)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-23 10:10:54 +00:00
renovate[bot] d5c0dc4d53
chore(deps): update actions/checkout action to v4 (#2430)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-23 10:10:31 +00:00
Koen van Zuijlen 2742c85ec6
Update labeler to v5 (#2434)
* Update labeler.yml

* Update labeler.yaml

* Update labeler.yaml
2024-01-23 09:56:29 +00:00
Koen van Zuijlen 5b21a8408c
Update release action to go 1.21 (#2437) 2024-01-23 09:52:52 +00:00
renovate[bot] 83c3c602ab
chore(deps): update actions/setup-node action to v4 (#2435)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-23 09:49:55 +00:00
renovate[bot] 508df756e4
chore(deps): update actions/stale action to v9 (#2436)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-23 09:49:39 +00:00
renovate[bot] 7851428ce6
chore(deps): update module k8s.io/apimachinery to v0.29.1 (#2428)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-22 16:48:04 +00:00
renovate[bot] 67445052d1
chore(deps): update github.com/ghodss/yaml digest to d8423dc (#2427)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-22 16:29:31 +00:00
Jan Larwig 5e68dad636
upgrading to go 1.21 (#2235)
* chore: bump go to version 1.21

update all depedencies as well

* fix linting issues based on golang 1.20 deprecations

* cleanup go depedencies

* add custom gomega matcher for option intefaces

* revert and upgrade golangci-lint to 1.55.2

* fix lint issues for v1.55.2 of golangci-lint

* fix toml loading test

* remove second runspecs call

* update go.sum

* revert testutil package
2024-01-22 13:39:53 +00:00
renovate[bot] b98f820abc
chore(deps): update alpine docker tag to v3.19.0 (#2410)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-21 17:59:20 +00:00
renovate[bot] 8141895070
chore(deps): update module github.com/bsm/redislock to v0.9.4 (#2406)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-21 10:42:01 +00:00
Jan Larwig 2df301cc21
feature: add release automation workflows (#2224)
* feature: add release automation workflows

* deactivate provenancee because of behaviour change with buildx v0.10.0

* add changelog section extraction for github release notes

* fix registry path; fix EOF

* use correct version of golangci-lint; add additional workflow step for fetching all dependencies
2024-01-20 20:14:09 +00:00
Koen van Zuijlen f88f09f962
Improved dev environment (#2211)
* Improved dev env setup

* Cleanup duplicate checks

* Applied PR feedback

* Updated go.mod/go.sum

* go mod tidy

* Update .devcontainer/devcontainer.json

* Update pkg/http/server_test.go

Co-authored-by: Jan Larwig <jan@larwig.com>

* Create launch.json

* Update .devcontainer/Dockerfile

* Apply suggestions from code review

---------

Co-authored-by: Jan Larwig <jan@larwig.com>
2024-01-20 20:10:37 +00:00
renovate[bot] b8ae6448e1
chore(deps): update github.com/ghodss/yaml digest to d8423dc (#2401)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-20 20:09:14 +00:00
renovate[bot] daea40d628
chore(deps): update module golang.org/x/crypto to v0.17.0 [security] (#2400)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-20 20:08:46 +00:00
Ross Golder f3dbca600f
Add ability to configure username for Redis cluster connections (#2381)
* Initial attempt.

* Add CHANGELOG entry.

* Drop commented-out Sentinel test.

---------

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2024-01-20 20:00:02 +00:00
Nils Gustav Stråbø 4c2bf5a2fe
Feature/add option to skip loading claims from profile url (#2329)
* add new flag skip-claims-from-profile-url

* skip passing profile URL if SkipClaimsFromProfileURL

* docs for --skip-claims-from-profile-url flag

* update flag comment

* update docs

* update CHANGELOG.md

* Update providers/provider_data.go

Co-authored-by: Jan Larwig <jan@larwig.com>

* Add tests for SkipClaimsFromProfileURL

* simplify tests for SkipClaimsFromProfileURL

* generate alpha_config.md

---------

Co-authored-by: Jan Larwig <jan@larwig.com>
2024-01-20 19:51:42 +00:00
Koen van Zuijlen 184c5820af
feat: Added renovate configuration (#2377) 2024-01-20 19:51:34 +00:00
Jan Larwig 0b24f45965
remove nsswitch workaround (#2371)
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2024-01-20 19:48:36 +00:00
Jan Larwig 2f3c811e6a
Feature - Add env variable support for alpha struct (#2375)
* added envsubstring package and added simple test cases.imple tests.

* added documentation

* added changelog entry

* added documentation to wrong file


.

* changed tests to ginkgo format

* update project to use better maintained library

* use defer to clear test variable after tests finished

* updated docs for the new package documentation and fixed bad english

* refactored function to "reduce" complexity.

* updated changelog for new version

updated readme

* minor formatting

---------

Co-authored-by: Haydn Evans <h.evans@douglas.de>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2024-01-20 19:37:24 +00:00
charvadzo ee3e9b8841
Log error details when failed loading CSRF cookie (#2345)
* Log error details when failed loading CSRF cookie

* Add a record about this PR to CHANGELOG.md

---------

Co-authored-by: Ondrej Charvat <ondrej.charvat@yunextraffic.com>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2024-01-20 19:27:23 +00:00
Koen van Zuijlen 51a5765f77
chore: Create sha256sum for tar instead of binary (#2343)
* Create sha256sum for tar instead of binary

* chore: Add checksum for binary

* chore: Updated changelog

---------

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2024-01-20 19:18:54 +00:00
WhiteRabbit-Code 5ba54df3e7
NGINX return 403 for sign_in (#2322) (#2323)
Co-authored-by: Sven Ertel <sven.ertel@bayernwerk.de>
2024-01-20 19:08:46 +00:00
Jan Brezina bc022fbfd1
Add possibility to encode the state param as UrlEncodedBase64 (#2312)
* Add possibility to encode the state param as UrlEncodedBase64

* Update CHANGELOG.md

* Update oauthproxy.go

Co-authored-by: Jan Larwig <jan@larwig.com>

---------

Co-authored-by: Jan Larwig <jan@larwig.com>
2024-01-20 19:08:30 +00:00
Koen van Zuijlen be84906fbc
enhancement: Change base image from alpine to distroless (#2295)
* Changed base image from alpine to distroless

* chore: updated Makefile

* fix: removed arm/v6 and ppc64le for distroless variant

* Update Dockerfile

* Update Makefile

* docs: Add README-section, CHANGELOG-entry and --pull to prevent caching

---------

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2024-01-20 18:48:04 +00:00
Jan Larwig c7185e7005
Introduce GitHub issue forms feature (#2382)
* use latest github issue forms feature

* change link description for slack

* add line to end of each file
2024-01-11 16:44:16 +00:00
darh bfd667e4a2
Update go-jose dependency as requested in #2350 (#2356)
* update go-jose dependency by switching gopkg.in/square/go-jose.v2
with github.com/go-jose/go-jose/v3

* updated `CHANGELOG.md` with entry for PR #2356

---------

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2024-01-08 13:08:35 +00:00
Conrad Hoffmann 71561f637d
Update ojg to latest release (#2357)
The previously used release is no longer available on Github.
2024-01-08 11:49:28 +00:00
Lino Layani 5d5f7ce343
fix: fix nginx setup (#2373) 2024-01-02 10:53:58 +00:00
Jan Larwig 0762267ac4
add breaking change notice for the new auth route regex matching behaviour introduced by #2193 (#2366) 2024-01-02 10:50:38 +00:00
Jan Larwig 52ad31752d
Feature: Add GitHub groups (orgs/teams) support (#2196)
* Add GitHub groups (orgs/teams) support

* align code of getTeams with getOrgs to support Github Enterprise Server instances with different domain

* add documentation

* add missing import after rebase

* add nightly build and push (#2297)

* add nightly build and push

* add date based nightly build tags

* only keep single multiarch image build and push

* add changelog

* add images to internal docs static files

* add docu for nightly builds

* remove unnecessary spaces

* update nightly repository

* Issue 978: Fix Custom cookie name breaks redis for session (#1949)

* Issue 978: Fix Custom cookie name breaks redis for session (see https://github.com/oauth2-proxy/oauth2-proxy/issues/978)

* Issue 978: Fix Custom cookie name breaks redis for session (see https://github.com/oauth2-proxy/oauth2-proxy/issues/978)

* Update CHANGELOG.md

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Update CHANGELOG.md

---------

Co-authored-by: Nuno Borges <Nuno.Borges@ctw.bmwgroup.com>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

* Support http.AllowQuerySemicolons (#2248)

* Support http.AllowQuerySemicolons

* Docs

* Make it clear we are overriding the handler

* Update documentation for allow-query-semicolons

* Fix changelog format

* Fix formatting

---------

Co-authored-by: MickMake <github@mickmake.com>

* Add GitHub groups (orgs/teams) support

* align code of getTeams with getOrgs to support Github Enterprise Server instances with different domain

* add documentation

* fix changelog & documentation

* fix missing import

---------

Co-authored-by: Tobias Mayer <github@tobiasm.de>
Co-authored-by: Nuno Miguel Micaelo Borges <miguelborges99@gmail.com>
Co-authored-by: Nuno Borges <Nuno.Borges@ctw.bmwgroup.com>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
Co-authored-by: Tim White <tim.white@su.org.au>
Co-authored-by: MickMake <github@mickmake.com>
2023-12-18 10:03:19 +00:00
Jan Larwig 53ae4c8c17
docs: maintainers file update (#2355)
* docs: maintainers file update

* Update MAINTAINERS
2023-12-18 09:12:00 +00:00
nblock 5e30a6fe94
Fix duplicate query parameters (#2334) 2023-12-01 10:59:59 +00:00
Jan Larwig fc6e7fdbd1
bugfix: OIDCConfig based providers are not respecting flags and configs (#2299)
* add full support for all oidc config based providers to use and respect all configs set via OIDCConfig

* add changelog entry

---------

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2023-11-25 11:32:31 +00:00
Ian Roberts 0ddb5e7b61
Don't run the nightly build and push job in forked repositories (#2330) 2023-11-21 11:54:12 +00:00
Tim White 551b6c9056
Support http.AllowQuerySemicolons (#2248)
* Support http.AllowQuerySemicolons

* Docs

* Make it clear we are overriding the handler

* Update documentation for allow-query-semicolons

* Fix changelog format

* Fix formatting

---------

Co-authored-by: MickMake <github@mickmake.com>
2023-11-20 09:36:03 +00:00
Jan Larwig 600f5774f9
bugfix: fix nightly date tagging (#2327)
* add nightly build and push

* add date based nightly build tags

* remove unnecessary spaces

* update nightly repository

* fix tagging with date
2023-11-18 15:00:59 +00:00
Nuno Miguel Micaelo Borges 1e61b65e28
Issue 978: Fix Custom cookie name breaks redis for session (#1949)
* Issue 978: Fix Custom cookie name breaks redis for session (see https://github.com/oauth2-proxy/oauth2-proxy/issues/978)

* Issue 978: Fix Custom cookie name breaks redis for session (see https://github.com/oauth2-proxy/oauth2-proxy/issues/978)

* Update CHANGELOG.md

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Update CHANGELOG.md

---------

Co-authored-by: Nuno Borges <Nuno.Borges@ctw.bmwgroup.com>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2023-11-18 14:23:00 +00:00
Jan Larwig bee7879cb2
add nightly build and push (#2297)
* add nightly build and push

* add date based nightly build tags

* only keep single multiarch image build and push

* add changelog

* add images to internal docs static files

* add docu for nightly builds

* remove unnecessary spaces

* update nightly repository
2023-11-18 13:56:29 +00:00
Jan Larwig 53cd0b83d3
add contribution guide to documentation (#2318)
* add contribution guide to doucmentation

* fix EOF
2023-11-13 10:27:28 +00:00
Charley Wu 5e8956b52f
Improve the Nginx `auth_request` example (#2278)
* The `X-Forwarded-Uri` was required to bypass authentication

- Fix the `skip_auth_routes` option not working in Nginx

* Add tests for allowed requests with proxied `X-Forwarded-Uri` header

* Avoid nginx startup failure: host not found in upstream "oauth2-proxy"

* The `--reverse-proxy` option is required for nginx

* Update the change logs

* Use the authOnlyPath constant

* Remove the unused header `X-Scheme`
2023-11-02 22:57:21 +00:00
Markus Blaschke 66bfd8ebd5
add azure china support (#2269)
* add azure china support

Signed-off-by: Markus Blaschke <mblaschke82@gmail.com>

* update changelog

Signed-off-by: Markus Blaschke <mblaschke82@gmail.com>

* fix lint

Signed-off-by: Markus Blaschke <mblaschke82@gmail.com>

---------

Signed-off-by: Markus Blaschke <mblaschke82@gmail.com>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2023-11-01 10:12:34 +00:00
Koen van Zuijlen 66a81e6eeb
Updated oauth2-proxy tags to 7.5.1 (#2303) 2023-10-31 19:53:03 +00:00
Koen van Zuijlen 8142c9eeec
Added a checkbox for tested changes to PR template (#2285)
* Added a checkbox for tested changes to PR template

* Update PULL_REQUEST_TEMPLATE.md

* Update .github/PULL_REQUEST_TEMPLATE.md

Co-authored-by: Jan Larwig <jan@larwig.com>

---------

Co-authored-by: Jan Larwig <jan@larwig.com>
2023-10-31 19:49:22 +00:00
Robert Deaton e55ac342f0
Use updated key names in oauth2-proxy-alpha-config.yaml (#2253) 2023-10-31 19:42:46 +00:00
Koen van Zuijlen 76bc2cf73f
Refactored docs (#2284)
* Refactored documentation for providers

* Lots of fixes
- Fixed grammar/typos
- Fixed sidebar config
- Enabled additional prism languages

* Removed useless spaces

* Fixed leftover typos

* Fixes for verify-generate

* Updated package-lock.json
2023-10-31 19:32:59 +00:00
Koen van Zuijlen a53da415c9
Additional labels (#2293)
* Added docker and dependencies labels

* Updated docs label to include all MarkDown related changes
2023-10-26 10:57:34 +01:00
Damien Degois 70571d96e1
Add support for unix socket as upstream (#1866)
* Add support for unix socket as upstream

* Add CHANGELOG.md entry

* Add Unix socket documentation

* Don't export unixRoundTripper, switch from string prefix to Scheme match

* Add basic unix server mock

* Add some tests and comments
2023-10-26 10:57:00 +01:00
Koen van Zuijlen 4816e87316
Actually rolled back labeler (#2291) 2023-10-25 19:14:52 +01:00
Koen van Zuijlen 0061bbeaee
Rolled back labeler to v4 (#2290) 2023-10-25 15:12:49 +01:00
Koen van Zuijlen d41141f23b
Update labeler.yaml (#2289) 2023-10-25 12:26:30 +01:00
Koen van Zuijlen 7f6109f469
Added an automatic PR labeler (#2286)
* Added an automatic PR labeler

* Update .github/workflows/labeler.yaml

Co-authored-by: Jan Larwig <jan@larwig.com>

---------

Co-authored-by: Jan Larwig <jan@larwig.com>
2023-10-25 11:37:32 +01:00
Joel Speed 48247d3e79
Merge pull request #2283 from kvanzuijlen/golint
Updated linters
2023-10-25 11:36:44 +01:00
emsixteeen a5006fd606
Issue: 2236 - adds an option to append CA certificates (#2237)
* adding append option for custom CA certs

* updated test for changed GetCertPool signature, added testing to check functionality of empty and non-empty store

* adding legacy options as well

* update associated documentation

* fixing code climate complaints - reduce number of return statements

* Apply suggestions from code review

Changes caFilesAppend (and variants) to useSystemTrustStore

Co-authored-by: Jan Larwig <jan@larwig.com>

* Apply suggestions from code review

Fixes extra whitespaces and grammar.

Co-authored-by: Koen van Zuijlen <8818390+kvanzuijlen@users.noreply.github.com>

* fix indentation

* update changelog

---------

Co-authored-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Koen van Zuijlen <8818390+kvanzuijlen@users.noreply.github.com>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2023-10-25 11:36:17 +01:00
axel7083 601477a52c
Feature: Allowing relative redirect url though an option (#2183)
* Adding relative redirect url option

* Updating CHANGELOG.md

* tests: adding unit test for getOAuthRedirectURI

---------

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2023-10-25 10:25:01 +01:00
Koen van Zuijlen 464f3bcf53
Fixed Google ADC functionality (#2282)
* Fixed Google ADC functionality

* Updated CHANGELOG.md

* Redo changes after merge-conflict

* Fixed docs

* Fixed linting issues

* Applied PR suggestions
2023-10-24 20:03:16 +01:00
Florian Beier 3862182039
Fix oidc-issuer-url in example (#2245)
Fix path (/auth/ part was dropped with the move to Quarkus in Keycloak 17)

Add note for older Keycloak versions
2023-10-24 20:01:36 +01:00
Filipe Pina dcf3bd1bcf
update error middleware definition (for traefik) (#2272) 2023-10-24 20:01:16 +01:00
kvanzuijlen e13a5048eb Updated linters 2023-10-24 16:37:57 +02:00
Pierluigi Lenoci 8d03adfd04
Upgrade golang.org/x/net to v0.17.0 (#2274)
* golang.org/x/net upgrade to v0.17.0

https://artifacthub.io/packages/helm/oauth2-proxy/oauth2-proxy?modal=security-report

* Update CHANGELOG.md

* go mod tidy
2023-10-24 12:33:03 +01:00
vllvll b78c391adc
Update dependencies (#2128)
* Update dependencies

* Update changelog
2023-10-02 10:26:58 +01:00
Ryan Gough 20244470a4
Missing closing quotes on api_routes example (#2123)
While parsing config: (28, 4): unescaped control character U+000A
2023-09-22 14:42:44 +01:00
Koen van Zuijlen ef95957990
Release v7.5.1 (#2227)
* Update changelog for v7.5.1 release

* Create versioned docs for release v7.5.x
Created using: yarn run docusaurus docs:version 7.5.x

---------

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2023-09-22 14:29:14 +01:00
Jan Larwig 13af1b4786
fix gitea token validation by allowing custom validation url and extracting the proper base api url for github cloud, github enterprise and gitea (#2194) 2023-09-14 10:09:57 +01:00
Jan Larwig 225dc92adf
Docs: Add Search (#2228)
* add search and update depedencies

* refactor documentation workflow to follow best github action best practices
2023-09-13 12:00:14 +01:00
Joel Speed 854401ec00
Merge pull request #2229 from tuunit/bugfix/default-scopes-for-oidc-based-providers
bugfix: default scopes for OIDCProvider based providers
2023-09-11 10:11:26 +01:00
tuunit 7683902a42 bugfix: default scopes for OIDCProvider based providers 2023-09-10 20:10:14 +00:00
Joel Speed 3c2d67d367
Merge pull request #2217 from polarctos/feature/alpine-3-18
Update alpine to 3.18
2023-09-08 17:33:51 +01:00
polarctos 62056a59c2 Update alpine to 3.18
Only pinning minor version to automatically receive patches
2023-09-08 18:22:46 +02:00
Koen van Zuijlen 982ae7e9d2
Added arch types to Docker and binary releases (#2220)
* Added several arm builds to dist.sh

* Added platforms to Dockerfile and updated docs

* Reverted changes made for testing

* Fix docker platform images

* Fix docker platform images

* Update Makefile

Co-authored-by: Jan Larwig <jan@larwig.com>

* Update Makefile

Co-authored-by: Jan Larwig <jan@larwig.com>

* Update Makefile

Co-authored-by: Jan Larwig <jan@larwig.com>

* Formatting improvements

---------

Co-authored-by: Jan Larwig <jan@larwig.com>
2023-09-08 17:18:20 +01:00
Koen van Zuijlen f3269b3f26
Fixed name for GoogleGroups env variable + unit tests (#2221)
* Fixed name for GoogleGroups env variable + unit tests

* Added changelog

---------

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2023-09-08 16:27:15 +01:00
Christian Brunotte 5f2f95e118
Improved session documentation (#2208)
* Improved session documentation

* Replaced "OAuth2-Proxy" with "OAuth2 Proxy"
2023-09-08 09:51:18 +01:00
Joel Speed 9f06dc873c
Merge pull request #2197 from tuunit/bugfix/move-oidc-scope-logic
bugfix: move oidc scope logic to oidc provider
2023-09-08 09:45:46 +01:00
Jan Larwig 6f6039c82b bugfix: move oidc scope logic to oidc provider 2023-09-08 05:35:41 +00:00
Joel Speed 01386bf303
Merge pull request #2213 from kvanzuijlen/release-v7.5.0
Release v7.5.0
2023-09-04 11:35:06 +01:00
kvanzuijlen bfc04fa84c
Create versioned docs for release v7.5.x
Created using: yarn run docusaurus docs:version 7.5.x
2023-09-04 12:28:42 +02:00
kvanzuijlen 07591fc93a
Update changelog for v7.5.0 release 2023-09-04 12:28:38 +02:00
Koen van Zuijlen a6e8ec81e8
Workload identity support (#2126)
* WIP: support for workload identity

* WIP: bugfixes to support WI

* Added support for Workload Identity

* Added missing flag

* Refactoring and typo

* Updated CHANGELOG.md

* Updated docs

* Updated changelog

* Improved readability and fixed codeclimate issues

* Update CHANGELOG.md

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

* Fixed if statement

* Apply suggestions from code review

Co-authored-by: Jan Larwig <jan@larwig.com>

* Cleanup

* Removed target principal

* Removed references to target principal

* Added docs

* Fixed header anchor linking

* Update auth.md

* Updated generated code

* Improved code

* Fixed tests

---------

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
Co-authored-by: Jan Larwig <jan@larwig.com>
2023-09-04 10:34:54 +01:00
anotherthomas 738c09095b
documented default for errors-to-info-log (#1990) 2023-08-26 15:33:40 +01:00
Joel Speed 9215944ccc
Merge pull request #2025 from corybolar/embedded-static-files
Embed static stylesheets and dependencies
2023-08-25 10:37:27 +01:00
Cory Bolar 40ee2bb944 Add changelog entry 2023-08-24 20:50:43 -04:00
Cory Bolar bc4acd7434 Add docs entry to endpoints page for /oauth2/static/ path 2023-08-24 20:50:17 -04:00
Cory Bolar a02ab7c04e Embed static stylesheets and dependencies
Embedding css and webfont dependencies allows the application to present
itself correctly in an environment that does not allow downloading the
files from a cdn.

Inspiration taken from #1492 but reworked to make use of embed.FS
simplifying the approach.
2023-08-24 20:50:17 -04:00
Joseph Weigl bd867b5138
Bugfix/check json path (#1921)
* Validate jsonpath in claim extractor

Signed-off-by: Joseph Weigl <joseph.weigl@audi.de>

* Add test and changelog for claim extractor json path

---------

Signed-off-by: Joseph Weigl <joseph.weigl@audi.de>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2023-08-24 13:40:43 +01:00
Joel Speed d9b9bcf9d4
Merge pull request #2192 from jawys/fix-use-x-forwarded-uri-for-pathregex-match
fix: use X-Forwarded-Uri if it exists for pathRegex match
2023-08-24 11:32:35 +01:00
Jan Wystub 2d22530f8f
docs: add changelog entry 2023-08-23 15:15:50 +02:00
Marius Zander 7529095e1a
fix: use X-Forwarded-Uri if it exists for pathRegex match
the functions `isApiPath` and `isAllowedPath` use the `req.URL.Path` property which leads to faulty behavior when behind a reverse proxy. The correct path can be inferred from the `X-Forwarded-Uri` header by making use of the already provided `requestutil.GetRequestURI` function.

Co-authored-by: Jan Wystub <jan@bam-bam-bam.com>
2023-08-23 15:15:50 +02:00
Joel Speed 7b3a36b854
Merge pull request #2191 from MarkIannucci/MarkIannucci-patch-1
Update setup-buildx-action to supported version
2023-08-23 09:55:33 +01:00
Mark Iannucci cbe9dccbc0
Update setup-buildx-action to supported version 2023-08-23 00:36:41 -06:00
Ronald Petty 8c60b64cf4
Update oauthproxy.go (#2189)
Minor - spelling typos in comment
2023-08-22 17:25:30 +01:00
Aigars Mahinovs a84e9f4d26
Update Dockerfile with qualified image names (#2138)
Use fully qualified image names in the Dockerfile to simplify
usage with alternate container build tools, like buildah and podman
2023-08-21 11:26:45 +01:00
t-katsumura d107d885e4
Session-Cookie Support (#1713)
* Create session cookie when cookie-expire set 0

* Fix format

* add test

* fix lint error

* fix test code

* fix conflicted test case

* update test case of cookie expiration

* update tests of csrf cookies

* update docs

* Update docs/docs/configuration/overview.md

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

---------

Co-authored-by: tanuki884 <morkazuk@fsi.co.jp>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2023-08-16 12:23:02 +01:00
Alexander Schwartz d9416c3630
Fixed build status badge (#2086)
Project moved from Travis CI configuration e9d46bfe32
2023-05-29 15:18:33 +01:00
avila-m-6 63d05c54d9
update: use go install in build step (#2046)
* update: use go install in build step

go get was deprecated since https://go.dev/doc/go-get-install-deprecation

* Update installation.md
2023-05-06 19:21:05 +01:00
Joel Speed 0868dda244
Merge pull request #2094 from oauth2-proxy/update-stale-bot
Update stale bot to v8
2023-04-22 14:51:01 +01:00
Joel Speed cae9690067
Update stale bot to v8 2023-04-22 15:42:35 +02:00
Nuno Miguel Micaelo Borges 6f11e60c0a
Issue 2016: CVE-2022-41717: DoS in Go net/http may lead to DoS (#2047)
* Issue 2016: CVE-2022-41717: DoS in Go net/http may lead to DoS

* Issue 2016: CVE-2022-41717: DoS in Go net/http may lead to DoS

* Issue 2016: CVE-2022-41717: DoS in Go net/http may lead to DoS

* Issue 2016: CVE-2022-41717: DoS in Go net/http may lead to DoS

* Issue 2016: CVE-2022-41717: DoS in Go net/http may lead to DoS

* Issue 2016: CVE-2022-41717: DoS in Go net/http may lead to DoS

* Issue 2016: CVE-2022-41717: DoS in Go net/http may lead to DoS

* Issue 2016: CVE-2022-41717: DoS in Go net/http may lead to DoS

* Issue 2016: CVE-2022-41717: DoS in Go net/http may lead to DoS

* Issue 2016: CVE-2022-41717: DoS in Go net/http may lead to DoS

---------

Co-authored-by: Nuno Borges <Nuno.Borges@ctw.bmwgroup.com>
2023-04-07 12:33:42 +01:00
Amr Hanafi dd4fa414ea
Update golang.org/x/net to v0.7.0 ato address GHSA-vvpx-j8f3-3w6h (#2028)
* Update golang.org/x/net to v0.7.0 ato address GHSA-vvpx-j8f3-3w6h

Addresses https://github.com/advisories/GHSA-vvpx-j8f3-3w6h

Signed-off-by: Amr Hanafi (MAHDI)) <amrh@microsoft.com>

* Update CHANGELOG

---------

Signed-off-by: Amr Hanafi (MAHDI)) <amrh@microsoft.com>
2023-03-07 10:42:12 +00:00
Reeta Singh 155b437769
Add documentation for redis-insecure-skip-tls-verify flag (#2040) 2023-03-05 22:06:53 +00:00
Ole-Martin Bratteng 5d60177d3e
Log the difference between invalid email and not authorized session (#2010)
* Log the difference between invalid email and not authorized session

* Add changelog entry

* Remove superfluous argument

---------

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2023-03-05 18:28:56 +00:00
gitgabz 487a0a5b99
Added documentation for the keycloak-oidc provider and the new Keycloak admin console #1931 (#1999)
* Added documentation for the keycloak-oidc provider in regard to the new Keycloak admin console "Admin2". As of v19.0.0 it is the default web console and OAuth2 proxy documentation has been updated to show end-users how to create a sample test Keycloak OIDC client to integrate with Oauth2 Proxy.

* Issue #1931
Added documentation for the keycloak-oidc provider in regard to the new Keycloak admin console "Admin2". As of v19.0.0 it is the default web console and OAuth2 proxy documentation has been updated to show end-users how to create a sample test Keycloak OIDC client to integrate with Oauth2 Proxy.
Added a link in the documentation to older keycloak-oidc pull request, as the provider currently evaluates aud from the access token and not the id token.

---------

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2023-03-05 18:24:10 +00:00
Cory Bolar 1bb3fbcea6
Ensure sign-in page background is uniform throughout the page (#1988)
* Ensure sign-in page background is uniform throughout the page

Configured banners that take up large amounts of space leave a gap of blank
background between where the body ends and the footer starts.  Fix this by
setting the style for the section containing the banner to match the body and
footer

* Add changelog entry

---------

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2023-03-05 17:24:35 +00:00
Nuno Miguel Micaelo Borges e079c60dfe
Issue 1929: Oauth2-proxy v7.4.0 is not using alpine:3.16 as it is wri… (#2013)
* Issue 1929: Oauth2-proxy v7.4.0 is not using alpine:3.16 as it is written in code & updates versions due to fixed CVEs

* Issue 1929: Oauth2-proxy v7.4.0 is not using alpine:3.16 as it is written in code & updates versions due to fixed CVEs

* Fixes CVE-2022-41721 (#1994)

See: https://avd.aquasec.com/nvd/2022/cve-2022-41717/

* update checkout actions (#1981)

* Fix a typo in oauthproxy.go (#2021)

* fix typo (#2001)

* Issue 1929: Oauth2-proxy v7.4.0 is not using alpine:3.16 as it is written in code & updates versions due to fixed CVEs

* Issue 1929: Oauth2-proxy v7.4.0 is not using alpine:3.16 as it is written in code & updates versions due to fixed CVEs

* Issue 1929: Oauth2-proxy v7.4.0 is not using alpine:3.16 as it is written in code & updates versions due to fixed CVEs

* Issue 1929: Oauth2-proxy v7.4.0 is not using alpine:3.16 as it is written in code & updates versions due to fixed CVEs

* Issue 1929: Oauth2-proxy v7.4.0 is not using alpine:3.16 as it is written in code & updates versions due to fixed CVEs

* Issue 1929: Oauth2-proxy v7.4.0 is not using alpine:3.16 as it is written in code & updates versions due to fixed CVEs

* Issue 1929: Oauth2-proxy v7.4.0 is not using alpine:3.16 as it is written in code & updates versions due to fixed CVEs

---------

Co-authored-by: Nuno Borges <Nuno.Borges@ctw.bmwgroup.com>
Co-authored-by: Jeroen Landheer <jlandheer@bintelligence.nl>
Co-authored-by: Ryuichi Watanabe <ryucrosskey@gmail.com>
Co-authored-by: Ho Kim <ho.kim@ulagbulag.io>
Co-authored-by: Terrell Russell <terrellrussell@gmail.com>
2023-03-05 17:12:55 +00:00
Terrell Russell f204625791
fix typo (#2001) 2023-02-20 14:21:42 +00:00
Ho Kim 2faa91eb74
Fix a typo in oauthproxy.go (#2021) 2023-02-20 10:21:59 +00:00
Ryuichi Watanabe fd50a35784
update checkout actions (#1981) 2023-02-13 09:26:09 +00:00
Jeroen Landheer a061cd52e9
Fixes CVE-2022-41721 (#1994)
See: https://avd.aquasec.com/nvd/2022/cve-2022-41717/
2023-02-13 09:25:33 +00:00
Nuno Miguel Micaelo Borges cbc973c8d9
Issue 1878: Validate URL call does not correctly honor already set UR… (#1951)
* Issue 1878: Validate URL call does not correctly honor already set URL parameters

* Issue 1878: Validate URL call does not correctly honor already set URL parameters

* Update CHANGELOG.md

---------

Co-authored-by: Nuno Borges <Nuno.Borges@ctw.bmwgroup.com>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2023-02-10 18:36:13 +00:00
Amith KK df8df9b536
Update formatting error in overview for custom-sign-in-logo (#1886) 2023-02-10 18:35:27 +00:00
Joel Speed 13202fd5ea
Merge pull request #1920 from mdreem/do-not-remove-emails-claim
Fill empty UserIDClaim before assigning it to other values
2023-02-06 09:16:58 +00:00
Marc Schiereck 5577cf0151 add changelog entry 2023-02-03 14:35:33 +00:00
Marc Schiereck 82bb08609f Fill empty UserIDClaim before assigning it to other values 2023-02-03 14:25:25 +00:00
Joel Speed 2d674959a2
Merge pull request #1991 from OmAximani0/patch-1
Changes `checkout` version to `v3`
2023-01-30 09:59:41 +00:00
Om Aximani cefeff5561
Chnages `checkout` version to `v3` 2023-01-27 22:53:05 +05:30
Kobi Meirson f753ec1ca5
feat: readiness check (#1839)
* feat: readiness check

* fix: no need for query param

* docs: add a note

* chore: move the readyness check to its own endpoint

* docs(cr): add godoc

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2022-12-23 09:08:12 +00:00
Jan Larwig 8b77c97009
Fix default scope settings for none oidc providers like GitHub (#1927)
* fix default scope settings for none oidc providers

* add changelog for bugfix

* fix scope test cases by producing and accessing correct result value
2022-12-23 09:00:57 +00:00
Joel Speed ddcc433a97
Merge pull request #1936 from braunsonm/pkce-code-verifier-correction
Remove unsupported special characters from the code verifier runes
2022-12-19 10:01:39 +00:00
Braunson M 311d210ec4 Remove unsupported special characters from the code verifier runes
- Not all special ASCII characters are strictly supported by the spec
2022-12-16 19:57:02 -05:00
Braunson 0832488af3
Merge pull request #1906 from braunsonm/braunsonm/issue1897
Fix PKCE code verifier generation to never use UTF-8 characters
2022-12-12 07:59:10 -05:00
Braunson M f4f5b7756c Fix PKCE code verifier generation to never use UTF-8 characters
- This could result in intermittent/random failures of PKCE enabled IdP's
2022-11-18 20:37:14 -05:00
Damien Degois fd2807c091
Fix uninitialized user claim (#1873)
* Fix uninitialized user claim

Some providers doesn't initialize data with setProviderDefaults function
(keycloak-oidc for example), therefore UserClaim is never initialized
with the default value and stay as an empty string.
This result in an empty user.

* Add CHANGELOG.md entry for #1873

* Call setProviderDefaults where missing

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2022-11-07 08:42:33 +00:00
Joel Speed e9a4654358
Merge pull request #1883 from braunsonm/issue-1593
Set correct platform type for arm v8 docker images
2022-11-04 10:15:47 +00:00
Braunson M 92b2231c6f Set correct platform type for arm v8 docker images
- A previous attempt used the wrong platform value which resulted in a build without the v8 variant being
created.
- Platform formatting is defined in the containerd source code as referenced by the docker documentation:
https://github.com/containerd/containerd/blob/v1.4.3/platforms/platforms.go#L63

Fixes #1593 - again
2022-11-03 21:28:05 -04:00
Joel Speed 9484a67afc
Merge pull request #1882 from babs/atrocious-fix-for-test-race-condition-on-htpasswd
Fix for test race condition on htpasswd file
2022-11-03 14:46:20 +00:00
Damien Degois 86011e8ac7 Protect htpasswd user list from race condition 2022-11-03 15:38:41 +01:00
Joel Speed aafa966550
Merge pull request #1867 from oauth2-proxy/release-v7.4.0
Release v7.4.0
2022-10-29 13:27:20 +01:00
Joel Speed efe9aed559
Create versioned docs for release v7.4.x
Created with: yarn run docusaurus docs:version 7.4.x
2022-10-29 13:19:49 +01:00
Joel Speed 2c21b2830d
Update changelog for v7.4.0 release 2022-10-29 13:19:48 +01:00
Joel Speed 4993a5ac8b
Merge pull request #1862 from oauth2-proxy/update-deps
Update dependencies
2022-10-29 12:57:15 +01:00
Joel Speed d4e3bf4df0
Update changelog 2022-10-29 12:49:54 +01:00
Joel Speed 4a2cf153cf
Fixup update session state handling 2022-10-29 12:49:53 +01:00
Joel Speed 0586a9e072
Update middleware tests 2022-10-29 12:49:52 +01:00
Joel Speed b333ef89bc
Update providers tests 2022-10-29 12:49:51 +01:00
Joel Speed 7034f0db53
Do not update viper
This breaks our deafult structures tests
2022-10-29 12:49:50 +01:00
Joel Speed 5dfefb6d9b
Update session state handling 2022-10-29 12:49:49 +01:00
Joel Speed f55d24bfcf
Update dependencies
Ran `go get -u` to update depdendencies automatically to newer versions.
I'm aware of a few CVEs that this should resolve
2022-10-29 12:49:48 +01:00
dulakm 95e56e3445
updated release notes regarding azure provider issue (#1771) 2022-10-28 08:32:19 +01:00
Muhammad Arham 1e21a56f99
Update go-redis/redis to v9. (#1847)
* Update go-redis/redis to v9.
- And updated redislock, testify, ginko and gomega have also been updated.
- Renamed the option `IdleTimeout` to `ConnMaxIdleTime` because of 517938a6b0/CHANGELOG.md

* Update CHANGELOG.md

* Dropping dot import of the types since they created aliases now

* fixing some error messages to make tests happy

* updating more error messages that were changed to make tests happy

* reverting error messages

Co-authored-by: Muhammad Arham <marham@i2cinc.com>
2022-10-24 16:41:06 +01:00
Damien Degois 5b5894af07
Keycloak provider - Retain user and prefered_username in session (#1815)
* Keycloak provider - Retain user and prefered_username in session

* Add CHANGELOG for PR #1815
2022-10-24 08:47:59 +01:00
Centzilius ece3d62d64
set providerDefaults for oidc consistently (#1828)
* set providerDefaults for oidc consistently

* docs: document #1828 in CHANGELOG
2022-10-23 10:48:20 +01:00
Joel Speed cfcba1a7fc
Merge pull request #1811 from mdoro-13/warn_about_potential_mistake_in_whitelist-domain
Warn not to include URL instead of domain and port
2022-10-23 11:47:01 +02:00
Joel Speed d9a33df29d
Merge pull request #1851 from adriananeci/bump_go
Bump golang to 1.19 and min allowed version to 1.18
2022-10-23 11:44:45 +02:00
Adrian Aneci 2f1fecae39 add changelog entry 2022-10-22 17:17:36 +03:00
Adrian Aneci b3df9aecc2 Bump golang to 1.19 and min allowed version to 1.18 2022-10-21 20:40:58 +03:00
Joel Speed 19bb0d0e86
Merge pull request #1574 from adriananeci/azure_support_upstream
Add Azure groups support and Azure OAuth v2.0
2022-10-21 19:31:10 +02:00
Adrian Aneci a5d918898c Add azure groups support and oauth2 v2.0 2022-10-21 20:23:21 +03:00
Andrew Hamade 7fe6384f38
Fix Linting Errors (#1835)
* initial commit: add groups to azure

Signed-off-by: andrewphamade@gmail.com <andrewphamade@gmail.com>

* fix deprecations and linting errors

Signed-off-by: Andrew Hamade <andrewphamade@gmail.com>

* remove groups testing from azure provider

Signed-off-by: Andrew Hamade <andrewphamade@gmail.com>

* fix test error

Signed-off-by: Andrew Hamade <andrewphamade@gmail.com>

* verify-generate

Signed-off-by: Andrew Hamade <andrewphamade@gmail.com>

Signed-off-by: andrewphamade@gmail.com <andrewphamade@gmail.com>
Signed-off-by: Andrew Hamade <andrewphamade@gmail.com>
2022-10-21 11:57:51 +01:00
Sven Schliesing a6c8f6f04a
Change "API Manager" to "APIs & Services" (#1824) 2022-10-15 14:33:53 +01:00
Chris Bednarz 6afcae295a
Updated net and text packages to address CVE-2022-27664 and CVE-2022-32149. (#1825)
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2022-10-15 14:33:44 +01:00
NiteHawk c395669649
20220802 fix nextcloud (#1750)
* Avoid Nextcloud "Current user is not logged in" (Statuscode 997)

The error message results from oauth2-proxy trying to pass the
access token via URL. Instead it needs to be sent via header,
thus the Nextcloud provider requires a fix similar to what #1502
did before for the keycloak provider.

* Implement EnrichSession() for Nextcloud provider

Parse nested JSON to transform relevant information (groups, id,
email) from the OAuth2 userinfo endpoint into session.

* Update CHANGELOG.md (add link to PR #1750)
2022-10-15 14:25:15 +01:00
mdoro-13 51d3d55a69 Warn not to include URL instead of domain and port 2022-10-04 18:39:55 +03:00
Segfault16 965fab422d
Add API route config (#1760)
* Add API route config

In addition to requests with Accept header `application/json` return 401 instead of 302 to login page on requests matching API paths regex.

* Update changelog

* Refactor

* Remove unnecessary comment

* Reorder checks

* Lint Api -> API

Co-authored-by: Sebastian Halder <sebastian.halder@boehringer-ingelheim.com>
2022-09-11 16:09:32 +01:00
tooptoop4 b82593b9cc
Update base docker image to alpine 3.16 (#1788)
* Update Dockerfile

* Update CHANGELOG.md
2022-09-10 11:59:54 +01:00
Joel Speed fbe7e6f58d
Merge pull request #1762 from ianldgs/negate-route
Support negating for skip auth routes
2022-09-03 14:02:52 +01:00
Ian Serpa f53754808b Support negating for skip auth routes 2022-09-02 22:23:29 +02:00
Alexandru Ciobanu 037cb041d3
Watch the `htpasswd` file for changes and update the `htpasswdMap` (#1701)
* dynamically update the htpasswdMap based on the changes made to the htpasswd file

* added tests to validate that htpasswdMap is updated after the htpasswd file is changed

* refactored `htpasswd` and `watcher` to lower cognitive complexity

* returned errors and refactored tests

* added `CHANGELOG.md` entry for #1701 and fixed the codeclimate issue

* Apply suggestions from code review

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

* Fix lint issue from code suggestion

* Wrap htpasswd load and watch errors with context

* add the htpasswd wrapped error context to the test

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2022-09-01 19:46:00 +01:00
Braunson fcecbeb13c
Inconsistent code-challenge-method CLI flag and config file naming (#1766)
* Inconsistent code-challenge-method CLI flag and config file naming

- Allow previous config option for now to prevent breaking configs

Fixes #1667

* Add changelog entry

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2022-09-01 10:58:43 +01:00
Joel Speed d19182c740
Merge pull request #1723 from crbednarz/allow-tls-cipher-config
Added ability to specify allowed TLS cipher suites.
2022-09-01 10:54:25 +01:00
Chris Bednarz ebacc2d7e4 Added ability to specify allowed TLS cipher suites. 2022-08-31 17:55:06 -07:00
Nuno Miguel Micaelo Borges a1ff878fdc
Add flags to define CSRF cookie expiration time and to allow CSRF cookies per request (#1708)
* Add start of state to CSRF cookie name

* Update CHANGELOG.md

* Update CHANGELOG.md

* Support optional flags

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update overview.md

Add new CSRF flags

* Update overview.md

Describe new CSRF flags

Co-authored-by: Nuno Borges <Nuno.Borges@ctw.bmwgroup.com>
2022-08-31 23:27:56 +01:00
Lorenzo Biava f8bd853702
Azure AD Doc: change permission to openid and add warning on consent (#1752)
The Azure AD Doc mentioned a very broad and risky permission, which is not really required by the proxy, and some Admins won't even permit.
This change recommends using the much more restricted "openid", and also warns about the consent that could still be required in certain cases.
2022-08-31 22:16:53 +01:00
Felix Stupp 723f6cc5d5
docs/conf/overview: Add hint about cookie prefixes to --cookie-name (#1744)
* docs/conf/overview: Add hint about cookie prefixes to --cookie-name

Cookie Prefixes further restricts the possibilities of session attacks because supporting clients will only accept cookies with one of the prefix if certain requirements were meet, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#cookie_prefixes

* Backport cookie prefixes to older docs

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2022-08-31 22:08:02 +01:00
Konstantin Shalygin c228d9e273
docs/docs/configuration/auth: fixed example of oidc-issuer-url for Keycloak (#1758)
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2022-08-31 22:07:49 +01:00
Felipe B. Conti ff03c43842
Fix vulnerabilities on crypto, net and sys packages and change go ver… (#1774)
* Fix vulnerabilities on crypto, net and sys packages and change go version on Docker builder stage

* Changelog related PR $1774

Co-authored-by: Felipe Bonvicini Conti <felipe.conti@totvs.com.br>
2022-08-31 21:37:07 +01:00
Joel Speed 884c4ee484
Merge pull request #1773 from giautm/patch-1
k8s: fixed invalid cookie_domain
2022-08-31 21:27:24 +01:00
Giau. Tran Minh 3d6ccc7cf7
k8s: fixed invalid cookie_domain 2022-08-28 17:54:32 +07:00
Dmitry Kartsev 0cfb9c6da0
adding IdleTimeout with the redis-connection-idle-timeout flag, to ke… (#1691)
* adding IdleTimeout with the redis-connection-idle-timeout flag, to keep redis connections in valid state, when Redis  option is set

* docs update - add redis idle timeout configurations

* changelog update for #1691 fix
2022-08-09 21:57:13 +01:00
Chris 6e02bb496b
Extract Keycloak roles while creating a session from token (#1720)
* extract roles while creating session

* add test

* adjust changelog

* remove unused func

* shorten implementation

Co-authored-by: Christian Hirsch <christian.hirsch@nitrado.net>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2022-08-08 23:28:46 +01:00
t-katsumura bcadad4c30
Fix method deprecated error in lint (#1699)
* fix method deprecated error in lint

* Fix logic of testing GetCertPool() method

* fix typo

* improve comment

* Fix typo

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2022-08-08 23:18:29 +01:00
Joel Speed 7a784a460d
Merge pull request #1709 from aiciobanu/basic-login-failed-message
Show an alert message when basic auth credentials are invalid
2022-07-13 14:50:47 +01:00
Alexandru Ciobanu 33a3a602bc added `CHANGELOG.md` entry for #1709 2022-07-13 16:26:30 +03:00
Alexandru Ciobanu 52cf162843 added tests for basic auth alert message feature 2022-06-30 18:11:43 +03:00
Alexandru Ciobanu cbda3cf618 implement an error alert message for invalid basic auth credentials 2022-06-30 18:10:02 +03:00
Joel Speed db74661e10
Merge pull request #1665 from oauth2-proxy/release-7.3.0
Release 7.3.0
2022-05-29 15:50:17 +01:00
Joel Speed 4344610f80
Create versioned docs for release v7.3.x
Created with: yarn run docusaurus docs:version 7.3.x
2022-05-29 15:43:02 +01:00
Joel Speed 95e1a4973e
Update CHANGELOG for v7.3.0 release 2022-05-29 15:36:50 +01:00
Joel Speed d3f428a1a6
Discover signature algorithms from OIDC provider (#1662) 2022-05-29 13:48:09 +01:00
ckwalsh c900c51a1b
Unbreak oauth2-proxy for keycloak provider after 2c668a (#1502)
* Unbreak oauth2-proxy for keycloak provider after 2c668a

With 2c668a, oauth2-proxy fails a request if the token validation fails.
Token validation always fails with the keycloak provider, due to the
valudation request passing the token via the URL, and keycloak not
parsing the url for tokens.

This is fixed by forcing the validation request to pass the token via a
header.

This code taken from the DigitalOcean provider, which presumably forcing
the token to be passed via header for the same reason.

Test plan: I was unable to build a docker image to test the fix, but I
believe it is relatively simple, and it passes the "looks good to me"
test plan.

* Add changelog entry for unbreak keycloak

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2022-05-29 11:08:04 +01:00
snowjet 01da2ac352
Update KeyCloak Auth Provider oidc_issuer_url (#1661)
The correct URL for the oidc-issuer-url in KeyCloak v18.0 is: https://<keycloak host>/realms/<your realm>. 
Using the old URL causes oauth2-proxy to crash on startup.

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2022-05-29 10:20:42 +01:00
bradybus 167acf7f09
Add redirect instructions for gitlab on sub-dir (#1616)
* Add redirect instructions for gitlab on sub-dir

* include redirect instructions in unversioned docs

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2022-05-29 10:17:30 +01:00
adamsong fc686ae95c
Corrects request endpoint (#1650)
* Fixes typo in repo endpoint

* Update CHANGELOG.md

* Fix the test to mock the correct endpoint

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2022-05-25 20:05:12 +01:00
t-katsumura c6a98369a0
Add description on ipv6 address (#1635)
* add docs on ipv6

* add tests for ipv6 address

* add tests for ipv6 address

* remove Print function for debugging

* Updated changelog
2022-05-23 10:17:29 +01:00
Nik Skoufis 743c344fdc
Change error type for redirect parsing errors (#1649)
* Change error type for redirect parsing errors

This changes the error type returned when the proxy fails to parse the
redirect target to be a 400 error instead of a 500 error.

As far as I can tell, the only way that this can fail is a failure to
parse the properties of the request to identity the redirect target.
This indicates that the user has sent a malformed request, and so should
result in a 400 rather than a 500.

I've added a test to exercise this, based on a real work example.

* Update changelog

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2022-05-20 14:26:21 +01:00
Joel Speed 086b869945
Merge pull request #1638 from jacksgt/configure-upstream-timeout
Configure upstream timeout
2022-05-20 14:04:28 +01:00
Jack Henschel 7a27cb04df Implement configurable timeout for upstream connections
Signed-off-by: Jack Henschel <jack.henschel@cern.ch>
2022-05-18 11:41:17 +01:00
Joel Speed 27f4bb6a0e
Merge pull request #1651 from rkkris75/oauth2-proxy-cvefix
CVE fixes pertaining to text, crypto and prometheus
2022-05-16 10:09:15 +01:00
Rajesh Krishnamurthy 1aef90f9a9 Added changelog for PR #1651 2022-05-13 15:44:58 -07:00
Rajesh Krishnamurthy f8ddc130d8 CVE fixes pertaining to text, crypto and prometheus 2022-05-13 14:53:24 -07:00
zv0n b794248176
Add allowed_emails option to the auth endpoint query string (#1595)
* Add allowed_emails option to the auth endpoint query string

* Don't return true from checkAllowedEmailsOrDomains only because domains field was empty

* Fix checkAllowedEmailsOrDomains logic

* Added tests for allowed_emails query parameter

* Updated CHANGELOG

* Remove checkAllowedEmailsOrDomains

Co-authored-by: Nick Meves <nicholas.meves@gmail.com>
2022-04-23 18:11:38 -07:00
Braunson 333e68637f
Build ARMv8 Docker Images (#1594)
* Build ARMv8 Docker Images

Fixes #1593

* Change platform to arm64/v8

* Drop separate tags for different architectures

* Mark the architecture image tags for deprecation

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2022-04-14 15:52:43 +01:00
Ole-Martin Bratteng 2e9c30ac12
Parameterise runtime image (#1478)
* Use distroless debian11 docker image

* Add `Dockerfile` to `.dockerignore`

* Replace `nonroot` with the matching UID/GID
Alpine does not have that user, and it cause issues when trying to start the container

* Use a build arg for setting the runtime image

* Explain why `ARG RUNTIME_IMAGE` is at the top

* Add entry to CHANGELOG

* Move build-arg to `DOCKER_BUILDX_ARGS`
2022-04-14 14:10:59 +01:00
Joel Speed f820deb96d
Merge pull request #1583 from adriananeci/groups_token_to_session
Add groups to session too when creating session from bearer token
2022-03-14 09:18:24 +00:00
Braunson ce750e9b30
PKCE Support (#1541)
* Add the allowed_email_domains and the allowed_groups on the auth_request endpoint + support standard wildcard char for validation with sub-domain and email-domain.

Signed-off-by: Valentin Pichard <github@w3st.fr>

* Fix provider data initialisation

* PKCE Support

Adds Code Challenge PKCE support (RFC-7636) and partial
Authorization Server Metadata (RFC-8414) for detecting PKCE support.

- Introduces new option `--force-code-challenge-method` to force a
specific code challenge method (either `S256` or `plain`) for instances
when the server has not implemented RFC-8414 in order to detect
PKCE support on the discovery document.
- In all other cases, if the PKCE support can be determined during discovery
then the `code_challenge_methods_supported` is used and S256 is always
preferred.
- The force command line argument is helpful with some providers like Azure
who supports PKCE but does not list it in their discovery document yet.
- Initial thought was given to just always attempt PKCE since according to spec
additional URL parameters should be dropped by servers which implemented
OAuth 2, however other projects found cases in the wild where this causes 500
errors by buggy implementations.
See: https://github.com/spring-projects/spring-security/pull/7804#issuecomment-578323810
- Due to the fact that the `code_verifier` must be saved between the redirect and
callback, sessions are now created when the redirect takes place with `Authenticated: false`.
The session will be recreated and marked as `Authenticated` on callback.
- Individual provider implementations can choose to include or ignore code_challenge
and code_verifier function parameters passed to them

Note: Technically speaking `plain` is not required to be implemented since
oauth2-proxy will always be able to handle S256 and servers MUST implement
S256 support.
> If the client is capable of using "S256", it MUST use "S256", as "S256"
> is Mandatory To Implement (MTI) on the server.  Clients are permitted
> to use "plain" only if they cannot support "S256" for some technical
> reason and know via out-of-band configuration that the server supports
> "plain".
Ref: RFC-7636 Sec 4.2

oauth2-proxy will always use S256 unless the user explicitly forces `plain`.

Fixes #1361

* Address PR comments by moving pkce generation

* Make PKCE opt-in, move to using the Nonce generater for code verifier

* Make PKCE opt-in, move to using the Nonce generater for code verifier

* Encrypt CodeVerifier in CSRF Token instead of Session

- Update Dex for PKCE support
- Expose HTTPBin for further use cases

* Correct the tests

* Move code challenges into extra params

* Correct typo in code challenge method

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

* Correct the extra space in docs

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

* Address changelog and new line nits

* Add generated docs

Co-authored-by: Valentin Pichard <github@w3st.fr>
Co-authored-by: Joel Speed <joel.speed@hotmail.co.uk>
2022-03-13 10:08:33 +00:00
Adrian Aneci a392cc1098 Add groups to session too when creating session from token 2022-03-12 18:01:57 +02:00
Joel Speed 45ef848b0a
Merge pull request #1577 from simon04/patch-1
main: fix typo "convert-config-to-alpha"
2022-02-24 13:16:08 +00:00
Simon Legner 5b89e975d1
main: fix typo "convert-config-to-alpha" 2022-02-24 08:59:45 +01:00
Joel Speed b2f780c394
Merge pull request #1512 from r4co0n/fix-docs-cookiesecret-generator-bash
docs/configuration: Fix entropy for bash secret
2022-02-21 21:44:04 +00:00
Joel Speed 6dfa3021e8
Merge branch 'master' into fix-docs-cookiesecret-generator-bash 2022-02-20 14:17:12 +00:00
Joel Speed d34644e160
Merge pull request #1567 from oauth2-proxy/fix-docs-release
Ensure docs release action has correct env
2022-02-20 14:14:52 +00:00
Joel Speed eb43b17750
Ensure docs release action has correct env 2022-02-20 14:07:56 +00:00
Simon Hollenbach b999c41a5a docs/7.1.x/configuration: Use 32 bytes to generate secret 2022-02-20 14:41:46 +01:00
Simon Hollenbach 4ed564901e docs/versioned_docs: Backport fix entropy for bash secret (#1511) 2022-02-20 14:38:11 +01:00
Simon Hollenbach db71dd8c55 docs/configuration: Fix entropy for bash secret
Filtering `/dev/urandom` for alphanumeric characters resulted in loss of
input entropy to base64. Fixing this using a procedure with these steps:

  * Read 32 bytes from `/dev/urandom` (`dd`)
  * Base64-encode (`base64`)
  * Strip newlines (`tr -d`)
  * URL-Escape (`tr`)
  * Append a final newline (`echo`)

This output should be equivalent to output generated using Python and
OpenSSL variants mentioned in the changed document file.

Newlines are stripped as `base64` wraps its output and the option to
disable this (`-w 0`) is not available in all implementations.

Fixes: #1511
2022-02-20 14:38:11 +01:00
Joel Speed cc94be0314
Merge pull request #1565 from oauth2-proxy/update-docusaurus
Update Docusaurus to 2.0.0-beta.15
2022-02-19 23:10:02 +00:00
Joel Speed c232136196
Update docs github actions to Node 17 2022-02-19 18:45:07 +00:00
Joel Speed 3ac51f5e2f
Update Docusaurus to 2.0.0-beta.15 2022-02-19 18:40:13 +00:00
Joel Speed 08b9b0c100
Merge pull request #1564 from ianroberts/alpha-config-removed-options
Update the list of flags obsoleted by alpha config
2022-02-19 18:14:00 +00:00
Ian Roberts 54ff3b96a7 Added provider flags to the list of those options superseded by alpha config. 2022-02-19 17:05:54 +00:00
Joel Speed 7dc984e664
Merge pull request #1418 from ianroberts/start-url-parameters
Pass URL parameters from /oauth2/start through to IdP login URL
2022-02-19 16:22:45 +00:00
Ian Roberts e1d570c1a2 Changelog entry for #1418. 2022-02-19 16:18:23 +00:00
Ian Roberts 63727103db Support for passing through URL query parameters from /oauth2/start to the ID provider's login URL.
You must explicitly configure oauth2-proxy (alpha config only) with which parameters are allowed to pass through, and optionally provide an allow-list of valid values and/or regular expressions for each one.  Note that this mechanism subsumes the functionality of the "prompt", "approval_prompt" and "acr_values" legacy configuration options, which must be converted to the equivalent YAML when running in alpha config mode.
2022-02-19 16:11:09 +00:00
Joel Speed b547fe0b37
Merge pull request #1559 from oauth2-proxy/refactor-oidc-verifier
Introduce ProviderVerifier to clean up OIDC discovery code
2022-02-19 15:43:06 +00:00
Joel Speed c3158ebc48
Ensure required PKCE information is exposed from provider 2022-02-19 15:38:33 +00:00
Joel Speed 474a3b049e
Add changelog entry for new ProviderVerifier code 2022-02-19 15:38:30 +00:00
Joel Speed 82710a7ac1
Fix other packages that rely on verifiers 2022-02-19 15:37:58 +00:00
Joel Speed 1f992b3f87
Integrate new provider verifier into providers 2022-02-19 15:37:57 +00:00
Joel Speed e3678aaaff
Add ProviderVerifier to providers/oidc 2022-02-19 15:37:56 +00:00
Joel Speed 3bb9621f5d
Add DiscoveryProvider to perform OIDC discovery 2022-02-19 15:37:55 +00:00
Joel Speed ed3892296e
Move OIDC IDToken verifier behind interface 2022-02-19 15:37:54 +00:00
Joel Speed 979c3e8cbc
Move internal OIDC package to providers package 2022-02-19 15:37:53 +00:00
Joel Speed 1578d90d0b
Merge pull request #1563 from oauth2-proxy/fix-profile-url
Ensure claim extractor does not attempt profile call when URL is empty
2022-02-19 15:37:18 +00:00
Joel Speed 25ef843115
Ensure claim extractor does not attempt profile call when URL is empty 2022-02-19 15:33:30 +00:00
Joel Speed 07aba7db09
Tidy go mod file 2022-02-19 15:32:04 +00:00
Joel Speed 74e2f5069c
Merge pull request #1561 from mgiessing/mgiessing-patch-1
Add ppc64le support
2022-02-19 15:20:53 +00:00
mgiessing 515d0f255e
Update CHANGELOG.md
Add ppc64le support
2022-02-18 14:20:25 +01:00
mgiessing 873ce3f1c3
Update README.md
Add ppc64le support
2022-02-17 23:19:26 +01:00
mgiessing ac3b36f57a
Update Makefile 2022-02-17 23:08:53 +01:00
mgiessing e4c32df61e
Update dist.sh
Add ppc64le support
2022-02-17 22:59:11 +01:00
mgiessing 24c826c883
Update Makefile
Add ppc64le support
2022-02-17 22:57:54 +01:00
mgiessing f9fb530c11
Update Dockerfile
Add ppc64le support
2022-02-17 22:55:57 +01:00
Joel Speed 263a5df820
Merge pull request #1286 from instadeepai/allowed_email_domains-on-auth_request-endpoint
Add allowed_email_domains on auth_request endpoint
2022-02-17 17:10:43 +00:00
Joel Speed ceda5329eb
Merge pull request #1560 from oauth2-proxy/fix-provider-initialisation
Fix provider data initialisation
2022-02-17 09:56:00 +00:00
Joel Speed 4eb2a35aa8
Fix provider data initialisation 2022-02-16 16:53:43 +00:00
Joel Speed f6aa7600ea
Merge pull request #1555 from oauth2-proxy/provider-options
Refactor provider configuration into providers package
2022-02-16 11:50:39 +00:00
Joel Speed eda5eb9243
Add changelog entry for provider refactor 2022-02-16 11:46:32 +00:00
Joel Speed 0791aef8cc
Integrate new provider constructor in main 2022-02-16 10:38:07 +00:00
Joel Speed 2e15f57b70
Remove provider configuration from validation package 2022-02-16 10:38:06 +00:00
Joel Speed d162b018a8
Move provider initialisation into providers package 2022-02-16 10:38:05 +00:00
Joel Speed 95dd2745c7
Remove options dependency on providers package 2022-02-16 10:38:04 +00:00
Joel Speed 9832844c8a
Merge pull request #1394 from oauth2-proxy/claim-extractor
Add generic claim extractor to get claims from ID Tokens
2022-02-16 10:37:20 +00:00
Joel Speed edb1bc1a11
Add changelog entry for generic claim extractor 2022-02-16 10:31:30 +00:00
Joel Speed 967051314e
Integrate claim extractor into providers 2022-02-16 10:28:33 +00:00
Joel Speed 537e596904
Add claim extractor provider util 2022-02-16 10:28:32 +00:00
Joel Speed 44dc3cad77
Merge pull request #1468 from oauth2-proxy/session-refresh-using-lock
Implement session locking with session state lock
2022-02-16 10:23:34 +00:00
Joel Speed da92648e54
Add changelog entry for session locking 2022-02-16 10:16:14 +00:00
Joel Speed 54d42c5829
Implement refresh relying on obtaining lock 2022-02-16 10:16:13 +00:00
Kevin Kreitner e2c7ff6ddd
Use session to lock to protect concurrent refreshes 2022-02-16 10:16:12 +00:00
Michael Hienle dc5d2a5cd7
Fix table (#1556)
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2022-02-15 16:39:16 +00:00
Kevin Schu 25371ea4af
improved audience handling to support client credentials access tokens without aud claims (#1204)
* implementation draft

* add cfg options skip-au-when-missing && client-id-verification-claim; enhance the provider data verification logic for sake of the added options

* refactor configs, added logging and add additional claim verification

* simplify logic by just having one configuration similar to oidc-email-claim

* added internal oidc token verifier, so that aud check behavior can be managed with oauth2-proxy and is compatible with extra-jwt-issuers

* refactored verification to reduce complexity

* refactored verification to reduce complexity

* added docs

* adjust tests to support new OIDCAudienceClaim and OIDCExtraAudiences options

* extend unit tests and ensure that audience is set with the value of aud claim configuration

* revert filemodes and update docs

* update docs

* remove unneccesary logging, refactor audience existence check and added additional unit tests

* fix linting issues after rebase on origin/main

* cleanup: use new imports for migrated libraries after rebase on origin/main

* adapt mock in keycloak_oidc_test.go

* allow specifying multiple audience claims, fixed bug where jwt issuers client id was not the being considered and fixed bug where aud claims with multiple audiences has broken the whole validation

* fixed formatting issue

* do not pass the whole options struct to minimize complexity and dependency to the configuration structure

* added changelog entry

* update docs

Co-authored-by: Sofia Weiler <sofia.weiler@aoe.com>
Co-authored-by: Christian Zenker <christian.zenker@aoe.com>
2022-02-15 16:12:22 +00:00
Valentin Pichard 2b4c8a9846 Add the allowed_email_domains and the allowed_groups on the auth_request endpoint + support standard wildcard char for validation with sub-domain and email-domain.
Signed-off-by: Valentin Pichard <github@w3st.fr>
2022-02-14 18:03:20 +01:00
Joel Speed c5a98c6d03
Merge pull request #1550 from mhienle/patch-1
Fix broken link
2022-02-11 10:17:45 +00:00
Michael Hienle 590b7a612e Fix broken link 2022-02-11 10:28:30 +01:00
Joel Speed ad4f7bcb0e
Merge pull request #1545 from andytson/feature/qs-allowed-groups-bypass
Fix issue with query string allowed group panic on skip methods
2022-02-10 14:08:45 +00:00
Andy Thompson 05ebaf5158 Update changelog 2022-02-10 12:40:42 +00:00
Andy Thompson c1b01b5bc0 Fix issue with query string allowed group panic on skip methods 2022-02-10 12:39:32 +00:00
Joel Speed 433b93d08a
Merge pull request #1474 from polarctos/feature/tls-min-version-options
Add option to specify the tls.Config.MinVersion for the server to be able to restrict it to TLS 1.3
2022-02-09 19:29:53 +00:00
polarctos cbbecb81bd Add changelog entry for tls-min-version 2022-02-09 20:20:03 +01:00
polarctos e03cf87dd8 Add option to specify the tls-min-version for the server 2022-02-09 20:19:01 +01:00
Preston Sheldon 11699a822a
Add ValidateSession function to LoginGovProvder to include Auth Header (#1509)
* Add ValidateSession function to LoginGovProvder to include Auth Header

* Update CHANGELOG for PR 1509

* Update logingov_test to include ValidationURL
2022-02-04 09:22:33 +00:00
Joel Speed 88709d8b69
Merge pull request #1489 from oauth2-proxy/fix-docker-push
Fix Docker Buildx push to include build version
2022-02-03 21:56:43 +00:00
Joel Speed bd0c4a3296
Fix Docker Buildx push to include build version 2022-02-03 19:23:22 +00:00
ThomasKalten 4f5efd4074
Update auth.md (#1518) 2022-01-18 13:54:52 +00:00
ThomasKalten 92c4ca9c58
Update auth.md (#1519) 2022-01-18 13:54:35 +00:00
Magnus Lübeck dede6fd531
Fixing a typo, pointing to correct compose file (#1493)
Fixing a typo for the docker-compose-alpha-config.yaml
2021-12-29 19:50:36 +00:00
Ole-Martin Bratteng 0e10fb8967
Remove the information about `Microsoft Azure AD` in the provider documentation (#1477)
* Remove the information about `Microsoft Azure AD`

* Put `proxy_buffer_size` in a code tag

* Update `CHANGELOG.md`

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2021-12-23 17:24:31 +00:00
Joel Speed 576184924d
Merge pull request #1481 from oauth2-proxy/release-v7.2.1
Prepare changelog for release v7.2.1
2021-12-22 17:09:59 +00:00
Joel Speed 5515918436
Prepare changelog for release v7.2.1 2021-12-18 12:59:55 +00:00
Joel Speed 95839a2896
Merge pull request #1479 from polarctos/feature/go-1.17
Update go version to 1.17
2021-12-18 12:34:40 +00:00
polarctos 7eaf98b5fe Update go version to 1.17
This includes the change to the pruned module graph with the converted go.mod for Go 1.17
https://go.dev/doc/go1.17#go-command
2021-12-17 16:51:13 +01:00
Joel Speed c278e0aa4e
Merge pull request #1471 from AlexanderBabel/feature/update-aline
[Security] Update alpine to 3.15
2021-12-14 19:19:09 +00:00
Alex Babel 8a951b2b4a
doc: update changelog 2021-12-14 02:21:28 +01:00
Alex Babel a654c9ec24
fix(Dockerfile): bump alpine to 3.15 2021-12-14 02:09:59 +01:00
Joel Speed 5933000b86
Merge pull request #1247 from oauth2-proxy/adfs-default-claims
Use `upn` as EmailClaim throughout ADFSProvider
2021-12-06 14:24:41 +00:00
Nick Meves 0fa8fca276 Update ADFS to new jwt lib 2021-12-01 19:16:42 -08:00
Nick Meves bdfca925a3 Handle UPN fallback when profileURL isn't set 2021-12-01 19:08:15 -08:00
Nick Meves 1621ea3bba ADFS supports IDToken nonce, use it 2021-12-01 19:08:15 -08:00
Nick Meves 4980f6af7d Use upn claim as a fallback in Enrich & Refresh
Only when `email` claim is missing, fallback to `upn` claim which may have it.
2021-12-01 19:08:10 -08:00
Nick Meves a53198725e Use `upn` as EmailClaim throughout ADFSProvider
By only overriding in the EnrichSession, any Refresh calls
would've overriden it with the `email` claim.
2021-12-01 19:06:02 -08:00
Joel Speed 1b335a056d
Merge pull request #1447 from oauth2-proxy/docker-fixes
Fix docker build/push issues found during last release
2021-11-24 17:31:20 +00:00
Joel Speed ceb015ee22
Update changelog for docker fixes 2021-11-24 17:20:25 +00:00
Joel Speed 8dea8134eb
Drop old makefiles in favour of buildx 2021-11-24 17:20:23 +00:00
Joel Speed 60b6dd850a
Fix docker build and push for all platforms 2021-11-24 17:20:22 +00:00
Jeeva Kandasamy 6e54ac2745
Update LinkedIn provider validate URL (#1444)
* update LinkedIn validate URL

Signed-off-by: Jeeva Kandasamy <jkandasa@gmail.com>

* update changelog

Signed-off-by: Jeeva Kandasamy <jkandasa@gmail.com>

* update failed unit test

Signed-off-by: Jeeva Kandasamy <jkandasa@gmail.com>
2021-11-19 21:36:33 +00:00
Jack Henschel 0693856bc3
Explicitly state precedence of config sources in docs (#1439)
I was recently looking into the order in which oauth2-proxy evaluates it configuration options from the various sources.
I think this will also be helpful for other users.
Since oauth2-proxy is using viper, the order of configuration sources is as follows [1]:
> Viper uses the following precedence order. Each item takes precedence over the item below it:
>
>    explicit call to Set
>    flag
>    env
>    config
>    key/value store
>    default

[1] https://github.com/spf13/viper/blob/master/README.md#why-viper

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2021-11-15 09:24:04 +00:00
Jeeva Kandasamy 7ed4e3c830
Fix docker container multi arch build issue by passing GOARCH details to make build (#1445)
* pass GOARCH details to make process

Signed-off-by: Jeeva Kandasamy <jkandasa@gmail.com>

* update changelog

Signed-off-by: Jeeva Kandasamy <jkandasa@gmail.com>
2021-11-12 21:42:46 +00:00
Stephan Aßmus 2c668a52d4
Let authentication fail when session validation fails (fixes #1396) (#1433)
* Error page for session validation failure

* Fix existing tests

* Add test-case for session validation failure

* Simplify test

* Add changelog entry for PR

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2021-11-12 18:36:29 +00:00
Joel Speed 9caf8c7040
Merge pull request #1419 from jangaraj/patch-1
Keycloak OIDC config improvement
2021-11-12 18:25:04 +00:00
Jan Garaj 1e761bf8fd
Keycloak OIDC config improvement 2021-10-25 10:01:35 +01:00
Joel Speed 6c379f74db
Merge pull request #1412 from oauth2-proxy/release-7.2.0
Release 7.2.0
2021-10-22 18:19:35 +01:00
Joel Speed 4ee3f13c46
Create versioned docs for release v7.2.x
Created with: yarn run docusaurus docs:version 7.2.x
2021-10-22 18:11:28 +01:00
Joel Speed 976dc35805
Update CHANGELOG for v7.2.0 release 2021-10-22 18:11:26 +01:00
Joel Speed d82c268696
Merge pull request #1403 from openstandia/fix-redis-tls
Improve TLS handling for Redis to support non-standalone mode with TLS
2021-10-19 13:30:53 +01:00
Hiroyuki Wada 7eb3a4fbd5 Improve TLS handling for Redis to support non-standalone mode with TLS 2021-10-19 20:04:49 +09:00
Maciej Strzelecki b49e62f9b2
Initalize TLS.Config when connecting to Redis with TLS (#1296)
* init TLS.Config when connecting to Redis with TLS

* don't overwrite TLS config if it exists

* add tests for Redis with TLS

* remove hardcoded certs

* add GenerateCert func

* use GenerateCert util func

* fix issue reported by go fmt

* limit return statements in GenerateCert
2021-10-19 09:17:42 +01:00
Adam Stephens ea261ca014
fix arg typo in traefik example (#1410)
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2021-10-18 19:01:40 +01:00
Joel Speed 543a71efad
Merge pull request #1411 from oauth2-proxy/fix-exclude-logging-doc
Fix exclude-logging-path documentation
2021-10-18 18:42:18 +01:00
Joel Speed bdab6feb0c
Fix exclude-logging-path documentation 2021-10-18 18:36:56 +01:00
Joel Speed 85c02821bf
Merge pull request #1391 from oauth2-proxy/docker-buildx-selection
Improve build times by sharing cache and allowing platform selection
2021-10-18 18:36:19 +01:00
Joel Speed 2ce93b6b31
Improve build times by sharing cache and allowing platform selection 2021-10-18 18:19:40 +01:00
Joel Speed 9d8093f470
Merge pull request #1404 from oauth2-proxy/improve-no-auth-error
Improve error message when no cookie is found
2021-10-18 18:16:40 +01:00
Joel Speed d8deaa124b
Improve error message when no cookie is found 2021-10-13 19:08:11 +01:00
Joel Speed 6cc7da8993
Merge pull request #1375 from bancek/feature-force-json-errors
Add --force-json-errors flag
2021-10-13 17:09:08 +01:00
Luka Zakrajšek d3e036d619 Add force-json-errors flag 2021-10-05 11:24:47 +02:00
David Emanuel Buchmann fd5e23e1c5
linkedidn: Update provider to v2 (#1315)
* linkedin: Update provider to v2

* changelog: Add change
2021-10-04 15:58:25 +01:00
Matt Lilley 3957183fd5
Use the httputil.NewSingleHostReverseProxy instead of yhat/wsutil for … (#1348)
* Use the httputil.NewSingleHostReverseProxy instad of yhat/wsutil for websocket proxying. This correctly handles 404 responses with keep-alive by terminating the tunnel rather than keeping it alive

* Tidy up dependencies - yhat/wsutil is no longer required

* Update changelog to include reference to 1348

Co-authored-by: Matt Lilley <matt.lilley@securitease.com>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2021-10-03 15:38:40 +01:00
Joel Speed a87c27b6bf
Merge pull request #1379 from janrotter/fix-htpasswd-user-group
Store groups from the htpasswd-user-group in the session during the manual sign in process
2021-09-28 11:09:29 +01:00
Joel Speed b0ab60b0b8
Merge branch 'master' into fix-htpasswd-user-group 2021-09-28 10:18:09 +01:00
Joel Speed 044b022608
Merge pull request #1381 from matt-cote/keycloak-provider-documentation
Fix formatting of Keycloak provider documentation
2021-09-28 10:15:03 +01:00
Matt Cote 6ced2e5ad4
Fix formatting of Keycloak provider documentation 2021-09-27 14:37:19 -04:00
Jan Rotter 826ebc230a Add changelog entry 2021-09-26 23:47:28 +02:00
Jan Rotter 81cfd24962 Store the group membership in the session
This change puts the groups from the htpasswd-user-group in the
session during the manual sign in process. This fixes the issue
with being unable to properly authenticate using the manual
sign in form when certain group membership is required (e.g. when
the --gitlab-group option is used).
2021-09-26 23:07:10 +02:00
Jan Rotter e25158dda6 Add a test for htpasswd-user-groups in the session
The groups configured in the `htpasswd-user-group` are not
stored in the session, resulting in unauthorized errors when
group membership is required. Please see:
https://gist.github.com/janrotter/b3d806a59292f07fe83bc52c061226e0
for instructions on reproducing the issue.
2021-09-26 23:07:10 +02:00
Nick Meves f6b2848e9a
Merge pull request #1239 from oauth2-proxy/gitlab-oidc
Make GitLab Provider based on OIDC Provider
2021-09-25 17:11:43 -07:00
Nick Meves e4a8c98e1b Preserve Nickname around refreshes 2021-09-25 16:49:30 -07:00
Nick Meves 95f9de5979 Preserve projects after `RefreshSession`
RefreshSession will override session.Groups with the new
`groups` claims. We need to preserve all `project:` prefixed
groups and reattach them post refresh.
2021-09-25 16:49:30 -07:00
Nick Meves 11c2177f18 Use `nickname` claim as User for GitLab
Previously this was only done in the `EnrichSession` stage
which would've missed Bearer usages & `RefreshSession`
would've overriden the User to the Subject.
2021-09-25 16:49:25 -07:00
Nick Meves c84a5a418f Adjust GitLab options configuration 2021-09-25 16:48:48 -07:00
Nick Meves 3092941c57 Use OIDC as base of Gitlab provider 2021-09-25 16:48:48 -07:00
Ryan Hartje 05a4e77c4c
Multiarch builds (#1147)
* extract email from id_token for azure provider (#914)

* extract email from id_token for azure provider

this change fixes a bug when --resource is specified with non-Graph
api and the access token destined to --resource is used to call Graph
api

* fixed typo

* refactor GetEmailAddress to EnrichSessionState

* make getting email from idtoken best effort and fall back to previous behavior when it's absent

* refactor to use jwt package to extract claims

* fix lint

* refactor unit tests to use test table
refactor the get email logic from profile api

* addressing feedback

* added oidc verifier to azure provider and extract email from id_token if present

* fix lint and codeclimate

* refactor to use oidc verifier to verify id_token if oidc is configured

* fixed UT

* addressed comments

* minor refactor

* addressed feedback

* extract email from id_token first and fallback to access token

* fallback to access token as well when id_token doesn't have email claim

* address feedbacks

* updated change log!

* switch to docker buildx for multiarch builds

* add setup docker buildx action

* update docker push to push the multiarch image

* make multiarch image have parity with currently produced images by adding linux/armv6

* triaging issue with arm v6

* incorporating feedback

* fixing rebase disaster

* reset Makefile to blessed state

Co-authored-by: Weinong Wang <weinong@outlook.com>
2021-09-21 14:17:59 +01:00
Joel Speed ee7c405bd8
Merge pull request #997 from FStelzer/issue844
Use the raw url path when proxying upstream requests
2021-09-17 13:45:39 +01:00
Fabian Stelzer 88f32aeaa1
rename Upstreams to UpstreamConfig and its Configs member to Upstreams then 2021-09-17 12:37:57 +00:00
Fabian Stelzer fe9159572c
add docs for new Upstream mux config 2021-09-17 12:37:57 +00:00
Fabian Stelzer 662fa72e8c
Add ProxyRawPath tests
Refactor proxy_test to set mux/upstream options for each test
individually and add tests for encoded urls with ProxyRawPath set and
unset.
2021-09-17 12:37:56 +00:00
Fabian Stelzer d51556515e
Introduce ProxyRawPath flag
Setting this flag will configure the upstream proxy to pass encoded urls
as-is.
2021-09-17 12:37:56 +00:00
Fabian Stelzer 733b3fe642
Determine line count for yaml load test dynamically
Adding a new option to the yaml alpha config will result in failed tests
unless you manually increment the line count. This commit computes this
dynamically.
2021-09-17 12:31:18 +00:00
Fabian Stelzer 12ab4ef529
Make the Upstreams mux configurable
This commit changes Upstreams from []Upstream to a struct{}
moving the previous []Upstream into .Configs and adjusts all uses of it.
2021-09-17 12:31:18 +00:00
Fabian Stelzer ae72beb24e
Enable UseEncodedPath() for frontend mux
This allows urls with encoded characters (e.g.: /%2F/) to pass to the
upstream mux instead of triggering a HTTP 301 from the frontend.
Otherwise a /%2F/test/ will result in a HTTP 301 -> /test/
2021-09-17 12:31:18 +00:00
Hedi Harzallah ccbb98acd9
fix(1356): test if session variable is null (#1357)
* fix(1356): test if session variable is null

* fix(1356): adding changelog

Co-authored-by: Hedi Harzallah <hharzalla@talend.com>
2021-09-09 12:12:29 +01:00
Miks Kalnins 54d44ccb8f
Allow specifying URL as input for custom sign in logo (#1330)
* Allow specifying URL as input for custom logos

* Fix typo

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

* Update changelog

* Only allow HTTPS URLs

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
Co-authored-by: Nick Meves <nicholas.meves@gmail.com>
2021-09-05 09:23:22 -07:00
Philippe 7cf3065111
Changing user field type to text (#1337)
* Changing user field type to text

* Updated changelog

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2021-08-29 12:39:02 +01:00
Joel Speed 5928fe5485
Merge pull request #1345 from pburgisser/add_skip_route_exemple
Adding example for auth skipping
2021-08-27 11:25:57 +02:00
Philippe Bürgisser 45e45303ad
Adding example for auth skiping 2021-08-27 10:53:57 +02:00
Stéphan Kochen 31f7c5bb59
Fix `go get` instructions (#1271)
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2021-08-18 17:11:18 +01:00
Jordie 42c16efa38
Fixed .CustomLogin </form> tag placement for login page (#1317)
* Fixed .CustomLogin </form> tag placement for login page

* Update changelog (gh-1317)
2021-08-11 15:57:40 +01:00
Nick Meves 526aff8c84
Merge pull request #1210 from pb82/keycloak-oidc-provider
Keycloak oidc provider
2021-08-07 09:57:03 -07:00
Peter Braun e6223383e5 update keycloak oidc provider and add unit tests 2021-08-02 11:39:50 +02:00
Nick Meves ab54de38cc Extract roles from Keycloak Access Tokens 2021-07-30 09:46:13 +02:00
Nick Meves 4c0beb373f Add keycloak-oidc provider based on OIDCProvider 2021-07-30 09:46:13 +02:00
JVecsei 8967873659
Updated dependency versions which include CVE fixes (#1276)
* switched to github.com/golang-jwt/jwt and updated golang.org/x/crypto to include CVE fixes

* added #1276 to changelog

Co-authored-by: Joshua Vécsei <git@vecsei.me>
2021-07-29 17:45:41 +01:00
wyewata a35db2ae8a
Fix expected error messages (#1269)
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2021-07-28 19:56:23 +01:00
Nick Meves 0b4bc36554
Upgrade go-oidc to v3 (#1264) 2021-07-17 09:55:05 -07:00
Joel Speed ef697afc6d
Merge pull request #1265 from wassan128/fix/doc-typo
Fix small typo
2021-07-10 13:01:44 +01:00
wassan128 777556c97e Fix typo s/commmon/common/ 2021-07-08 21:29:43 +09:00
Joel Speed 98f8195902
Merge pull request #1262 from oauth2-proxy/fix-encryption-finicky-tests
Remove finicky encryption test
2021-07-02 17:22:57 +01:00
Nick Meves 1faa5c47ce Remove finicky encryption test
AES-CFB is unauthenticated, in rare circumstances it won't error on
AES-GCM encrypted payloads
2021-07-01 19:03:01 -07:00
Moraru Costel 7a83d18f23
Extend email-domain validation with sub-domain capability (#1233)
* Extend email-domain validation with sub-domain capability

* Adding the CHANGELOG entry

* Fixing lint erros

* Fixing lint erros

* Renamed the emailDomains to allowedDomains, plus tests

* Bringing together all basic test-cases

* Fixing unit tests

* Add unit tests to validate additional vulnerability concerns
2021-06-29 19:37:03 +01:00
Joel Speed d359ab75e1
Merge pull request #1253 from netgusto/patch-1
Update README.md
2021-06-24 12:03:52 +01:00
Jérôme Schneider 5063b31b62
Update README.md
Fixing typo.
2021-06-24 09:34:10 +02:00
Joel Speed ac188b129f
Merge pull request #1060 from oauth2-proxy/upstream-rewrite
Implement RewriteTarget to allow requests to be rewritten before proxying to upstream servers
2021-06-23 13:36:03 +01:00
Joel Speed 9ce962be08
Add changelog entry for new rewrite target feature 2021-06-23 12:21:40 +01:00
Joel Speed 075cb9c3a0
Ensure upstreams are sorted by longest first 2021-06-23 12:20:48 +01:00
Joel Speed 8a06779d41
Redirect request if it would match with an appended trailing slash 2021-06-23 12:20:47 +01:00
Joel Speed 6c62b25bf1
Allow request paths to be rewritten before proxying to upstream server 2021-06-23 12:20:46 +01:00
Joel Speed d2d62bb452
Replace standard serve mux with gorilla mux 2021-06-23 12:20:21 +01:00
Nick Meves 16a9893a19
Merge pull request #1086 from oauth2-proxy/early-refresh
Convert RefreshSessionIfNeeded into RefreshSession
2021-06-22 17:13:14 -07:00
Nick Meves ff914d7e17 Use `ErrNotImplemented` in default refresh implementation 2021-06-22 17:04:42 -07:00
Nick Meves baf6cf3816 Remove mutex from local Clock instances
They will only be used in tests, but it doesn't play
nice with copy operations many tests use. The linter was
not happy. While the global clock needs mutexes for parallelism,
local Clocks only used it for Set/Add and didn't even use the
mutex for actual time functions.
2021-06-22 17:04:42 -07:00
Nick Meves d91c3f867d Remove validation for invalid legacy v6.0.0 sessions
The reflect.DeepCopy doesn't play nice with the new Lock and Clock
fields in sessions. And it added unneeded session deserialization
logic to every request.
2021-06-22 17:04:42 -07:00
Nick Meves 593125152d Standarize provider refresh implemention & logging 2021-06-22 17:04:30 -07:00
Nick Meves 7fa6d2d024 Manage session time fields centrally 2021-06-21 21:54:52 -07:00
Nick Meves 7e80e5596b RefreshSessions immediately when called 2021-06-21 21:54:52 -07:00
Joel Speed 5f4ac25b1e
Merge pull request #1249 from webnard/patch-1
Simplify sha256sum checking example
2021-06-21 19:43:35 +01:00
Ian Hunter 1c151b4b27
Simplify sha256sum checking example
The previous code didn't consider other languages and hid the output of failures. For example

```
$ LANG=es_ES.UTF-8 sha256sum -c sha256sum.txt
oauth2-proxy-v7.1.3.linux-amd64/oauth2-proxy: La suma coincide
```
2021-06-21 10:44:27 -04:00
Nick Meves c2325ecbd5
Merge pull request #1226 from oauth2-proxy/app-redirect
Move app redirection logic to its own package
2021-06-19 10:54:00 -07:00
Joel Speed d8b91efcc7
Add changelog for app redirection split 2021-06-19 11:26:04 +01:00
Joel Speed bd2fa9d7d8
Add tests for split host port 2021-06-19 11:24:29 +01:00
Joel Speed 273ab1f591
Integrate redirect package with OAuth2 Proxy 2021-06-19 11:24:27 +01:00
Joel Speed e1764d4221
Create AppDirector for getting the application redirect URL 2021-06-19 11:23:32 +01:00
Joel Speed e7f304fc96
Create redirect validator 2021-06-19 11:23:31 +01:00
Joel Speed 62436dbc02
Merge pull request #1128 from oauth2-proxy/proxy-router
Use gorilla mux for OAuth Proxy routing
2021-06-19 11:22:37 +01:00
Joel Speed a8c9b2903d
Use gorilla mux for OAuth Proxy routing 2021-06-19 11:17:16 +01:00
Anders Kiel Hovgaard c00d36159e
Update Alpine image version to 3.14 (#1244)
* Update Alpine image version to 3.14.

* Update changelog.
2021-06-18 13:12:11 +01:00
Nick Meves a296936a0f
Merge pull request #1238 from samirachoadi/feature/add_adfs_provider
Added ADFS Provider
2021-06-13 11:13:21 -07:00
Sami Racho a14c0c2121 Added ADFS Provider 2021-06-13 10:19:56 +02:00
Robin Tweedie 381ac91752
Provide a link to the Helm chart for oauth2-proxy (#1217)
* Update installation.md

Provide a link to the Helm chart for oauth2-proxy

* also document in latest versioned docs
2021-06-09 15:03:51 +01:00
Rishi Kambil 41cd418a5d
Fix - Refresh Session not working for multiple cookies (#1209) (#1227)
* Fix - Refresh Session not working for multiple cookies (#1209)

* added comments for flattenheaders fix

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

* Updated Changelog.md

Co-authored-by: Rishi Kambil <rishi.kambil@lntinfotech.com>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2021-06-09 10:22:33 +01:00
Frederic Pape cfd82daaf0
Some typos (#1222)
* Some typos

* Also corrected the typo's in the src code

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2021-06-02 19:41:30 +01:00
Kevin Kreitner f648c54d87
Add redis lock feature (#1063)
* Add sensible logging flag to default setup for logger

* Add Redis lock

* Fix default value flag for sensitive logging

* Split RefreshSessionIfNeeded in two methods and use Redis lock

* Small adjustments to doc and code

* Remove sensible logging

* Fix method names in ticket.go

* Revert "Fix method names in ticket.go"

This reverts commit 408ba1a1a5.

* Fix methods name in ticket.go

* Remove block in Redis client get

* Increase lock time to 1 second

* Perform retries, if session store is locked

* Reverse if condition, because it should return if session does not have to be refreshed

* Update go.sum

* Update MockStore

* Return error if loading session fails

* Fix and update tests

* Change validSession to session in docs and strings

* Change validSession to session in docs and strings

* Fix docs

* Fix wrong field name

* Fix linting

* Fix imports for linting

* Revert changes except from locking functionality

* Add lock feature on session state

* Update from master

* Remove errors package, because it is not used

* Only pass context instead of request to lock

* Use lock key

* By default use NoOpLock

* Remove debug output

* Update ticket_test.go

* Map internal error to sessions error

* Add ErrLockNotObtained

* Enable lock peek for all redis clients

* Use lock key prefix consistent

* Fix imports

* Use exists method for peek lock

* Fix imports

* Fix imports

* Fix imports

* Remove own Dockerfile

* Fix imports

* Fix tests for ticket and session store

* Fix session store test

* Update pkg/apis/sessions/interfaces.go

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

* Do not wrap lock method

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

* Use errors package for lock constants

* Use better naming for initLock function

* Add comments

* Add session store lock test

* Fix tests

* Fix tests

* Fix tests

* Fix tests

* Add cookies after saving session

* Add mock lock

* Fix imports for mock_lock.go

* Store mock lock for key

* Apply elapsed time on mock lock

* Check if lock is initially applied

* Reuse existing lock

* Test all lock methods

* Update CHANGELOG.md

* Use redis client methods in redis.lock for release an refresh

* Use lock key suffix instead of prefix for lock key

* Add comments for Lock interface

* Update comment for Lock interface

* Update CHANGELOG.md

* Change LockSuffix to const

* Check lock on already loaded session

* Use global var for loadedSession in lock tests

* Use lock instance for refreshing and releasing of lock

* Update possible error type for Refresh

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2021-06-02 19:08:19 +01:00
Joel Speed 67bfa4b43f
Merge pull request #1207 from tarvip/sign-in-fragment-fix
Fix URI fragment handling
2021-05-24 10:33:55 +01:00
Tarvi Pillessaar 818938add2
Fix URI fragment handling
Fixes #1205
2021-05-24 10:17:46 +03:00
Joel Speed 823cb14d01
Merge pull request #1108 from oauth2-proxy/secret-gen
Add alternative ways to generate cookie secrets to docs
2021-05-23 20:21:56 +01:00
Joel Speed a0e2f785f3
Add alternative ways to generate cookie secrets to docs 2021-05-23 20:12:08 +01:00
Joel Speed 06808704a3
Merge pull request #1142 from oauth2-proxy/writer-funcs
Add pagewriter to upstream proxy
2021-05-10 11:25:07 +01:00
Joel Speed befcdd9d04
Add pagewriter to upstream proxy 2021-05-10 11:14:05 +01:00
Joel Speed 725ae543d5
Merge pull request #1181 from iTaybb/master
fix: SHOW_DEBUG_ON_ERROR environment variable not working
2021-05-05 10:18:09 +01:00
Itay Brandes 095e1db801 fix: SHOW_DEBUG_ON_ERROR environment variable not working
(Fixes #1178)
2021-05-04 19:17:30 +03:00
Joel Speed 88122f641d
Merge pull request #1171 from oauth2-proxy/release-v7.1.3
Update Changelog for release v7.1.3
2021-04-28 17:48:00 +01:00
Nick Meves 2dd4a9647a
Update Changelog for release v7.1.3 2021-04-28 09:41:18 -07:00
Weinong Wang f9de0e840c
add oidc issuer to Azure auth provider doc (#1135)
* add oidc issuer to Azure auth provider doc

* updated versioned doc
2021-04-27 18:59:02 +01:00
Nick Meves d6de11aa98
Merge pull request #1168 from oauth2-proxy/metrics-tls-flag-fix
Fix Metrics cfg option naming typo
2021-04-27 10:15:46 -07:00
Nick Meves 544ba2a21c
Fix Metrics cfg option naming typo 2021-04-23 13:24:28 -07:00
Nick Meves 7eeaea0b3f
Support nonce checks in OIDC Provider (#967)
* Set and verify a nonce with OIDC

* Create a CSRF object to manage nonces & cookies

* Add missing generic cookie unit tests

* Add config flag to control OIDC SkipNonce

* Send hashed nonces in authentication requests

* Encrypt the CSRF cookie

* Add clarity to naming & add more helper methods

* Make CSRF an interface and keep underlying nonces private

* Add ReverseProxy scope to cookie tests

* Align to new 1.16 SameSite cookie default

* Perform SecretBytes conversion on CSRF cookie crypto

* Make state encoding signatures consistent

* Mock time in CSRF struct via Clock

* Improve InsecureSkipNonce docstring
2021-04-21 10:33:27 +01:00
Nick Meves d3423408c7
Add a clock package for better time mocking (#1136)
* Add a clock package for better time mocking

* Make Clock a struct so it doesn't need initialization

* Test clock package

* Use atomic for live time tests

* Refer to same clock.Mock throughout methods
2021-04-18 18:25:57 +01:00
yanasega 42475c28f7
Multiple providers in alpha config (#947)
* Initial commit of multiple provider logic:
1. Created new provider options.
2. Created legacy provider options and conversion options.
3. Added Providers to alpha Options.
4. Started Validation migration of multiple providers
5. Tests.

* fixed lint issues

* additional lint fixes

* Nits and alterations based on CR: manliy splitting large providers validation function and adding comments to provider options

* fixed typo

* removed weird : file

* small CR changes

* Removed GoogleGroups validation due to new allowed-groups (including tests). Added line in CHANGELOG

* Update pkg/apis/options/providers.go

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

* Update pkg/apis/options/providers.go

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

* Update pkg/apis/options/providers.go

Co-authored-by: Nick Meves <nick.meves@greenhouse.io>

* Initial commit of multiple provider logic:
1. Created new provider options.
2. Created legacy provider options and conversion options.
3. Added Providers to alpha Options.
4. Started Validation migration of multiple providers
5. Tests.

* fixed lint issues

* additional lint fixes

* Nits and alterations based on CR: manliy splitting large providers validation function and adding comments to provider options

* small CR changes

* auto generates alpha_config.md

* rebase (mainly service alpha options related conflicts)

* removed :

* Nits and alterations based on CR: manliy splitting large providers validation function and adding comments to provider options

* small CR changes

* Removed GoogleGroups validation due to new allowed-groups (including tests). Added line in CHANGELOG

* "cntd. rebase"

* ran make generate again

* last conflicts

* removed duplicate client id validation

* 1. Removed provider prefixes
2. altered optionsWithNilProvider logic
3. altered default provider logic
4. moved change in CHANELOG to 7.0.0

* fixed TestGoogleGroupOptions test

* ran make generate

* moved CHANGLOG line to 7.1.1

* moved changelog comment to 7.1.2 (additional rebase)

Co-authored-by: Yana Segal <yana.segal@nielsen.com>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
Co-authored-by: Nick Meves <nick.meves@greenhouse.io>
2021-04-03 17:06:30 +01:00
Joel Speed 9d20b4e0e2
Merge pull request #1145 from oauth2-proxy/release-v7.1.2
Update Changelog for release v7.1.2
2021-04-02 11:34:59 +01:00
Joel Speed fbe5743dd4
Update Changelog for release v7.1.2 2021-04-01 19:07:22 +01:00
Oliver 7ebeecb128
Fix metrics server (#1141)
* fix MetricsSecureAddress cfg tag

* add metrics* flags to docs

* update CHANGELOG
2021-04-01 13:58:13 +01:00
Ian Roberts 3fc194ee72
Minor change to the Dockerfile to improve build speed (#1139)
"go mod download" does not depend on the VERSION env var, so moving the ARG directive after the RUN will allow better use of the Docker build cache - subsequent builds on the same machine need only re-run the "go mod download" if go.mod or go.sum has changed, rather than re-running it any time the VERSION value passed from the Makefile has changed

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2021-03-29 19:08:40 +01:00
Joel Speed 3315e5d4b8
Merge pull request #1127 from oauth2-proxy/remove-unused-fields
Remove unused fields from OAuthProxy
2021-03-29 19:03:33 +01:00
Joel Speed c0654e3d9f
Remove unused fields from OAuthProxy 2021-03-29 18:26:48 +01:00
Joel Speed 8c25f5be0b
Merge pull request #1129 from oauth2-proxy/redirect-test-ginkgo
Rewrite OpenRedirect tests in ginkgo
2021-03-29 18:25:21 +01:00
Joel Speed 8c91adcaf0
Rewrite OpenRedirect tests in ginkgo 2021-03-29 18:09:58 +01:00
Joel Speed 4daa66e1c9
Merge pull request #1138 from oauth2-proxy/release-7.1.1
Prepare for release v7.1.1
2021-03-29 16:57:39 +01:00
Joel Speed 46c3296330
Prepare for release v7.1.1 2021-03-28 19:25:46 +01:00
Joel Speed 5497310673
Merge pull request #1133 from oauth2-proxy/fix-metrics-server
Metrics server should be constructed with secure bind address for TLS
2021-03-26 14:36:15 +00:00
Joel Speed 17009d8363
Metrics server should be constructed with secure bind address for TLS 2021-03-26 09:58:39 +00:00
Joel Speed d64d717e63
Merge pull request #1130 from oauth2-proxy/fix-gitlab-cve-test
Fix GitLab CVE test case
2021-03-25 17:33:57 +00:00
Nick Meves 05c3fa7601
Fix GitLab CVE test case 2021-03-25 10:29:17 -07:00
Joel Speed 333418983c
Merge pull request #1119 from oauth2-proxy/release-7.1.0
Prepare for release v7.1.0
2021-03-25 17:24:36 +00:00
Joel Speed f86e25aec2
Created versioned docs for v7.1.x
Created with: yarn run docusaurus docs:version 7.0.x
2021-03-25 17:21:08 +00:00
Joel Speed b0949a4efb
Update changelog for v7.1.0 release 2021-03-25 17:21:08 +00:00
Nick Meves 0279fa7dff
Merge pull request from GHSA-652x-m2gr-hppm
* Populate session Groups from userinfo response

* Fix: gitlab tests

Co-authored-by: Wilfried OLLIVIER <wollivier@bearstech.com>
2021-03-25 17:20:45 +00:00
Piers Harding 73d9f3809e
Panic with GitLab project repository auth (#1113)
* panic with GitLab project repository auth

* /api/v4/projects/:id can return nil permissions

Signed-off-by: Piers Harding <piers@ompka.net>

* Add GitLab test for group no access

Signed-off-by: Piers Harding <piers@ompka.net>
2021-03-25 08:48:20 -07:00
Frédéric Collonval 5788bebfee
Add example local environment with traefik (#1091)
* Add example with traefik and keycloak

* Switch to dex

* Remove unneeded change in keycloak settings

* Taken into account review comments

* Add changelog entry

Co-authored-by: Frédéric Collonval <frederic.collonval@ariadnext.com>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2021-03-22 13:55:25 +00:00
Joel Speed 7262945c6a
Merge pull request #1116 from oauth2-proxy/basic-prefer-email
Reinstate preferEmailToUser behaviour for basic auth sessions
2021-03-22 13:22:45 +00:00
Joel Speed 64f0a9f580
Reinstate preferEmailToUser behaviour for basic auth sessions 2021-03-22 13:13:26 +00:00
Joel Speed b82182763e
Merge pull request #1115 from oauth2-proxy/remove-force-query
Fix upstream proxy appending `?` to requests
2021-03-22 13:12:35 +00:00
Joel Speed 92ae5d9d24
Remove duplication in proxy directors 2021-03-22 13:07:41 +00:00
Joel Speed 025ef3eca4
Fix upstream proxy appending `?` to requests 2021-03-22 13:07:36 +00:00
Joel Speed f0963b3444
Merge pull request #1117 from oauth2-proxy/deprecate-gcp-healthcheck
Deprecate GCP HealthCheck option
2021-03-21 20:13:19 +00:00
Joel Speed 2e5b229637
Deprecate GCP HealthCheck option 2021-03-21 20:05:13 +00:00
Joel Speed 455d649165
Merge pull request #1104 from oauth2-proxy/robots-page
Allow custom robots text pages
2021-03-21 20:02:57 +00:00
Joel Speed 0615a6a663
Add changelog entry for robots page customisation 2021-03-21 18:34:44 +00:00
Joel Speed 6c6fd4f862
Create seperate page getter 2021-03-21 18:34:43 +00:00
Joel Speed f3bd61b371
Use pagewriter to render robots txt page 2021-03-21 18:34:42 +00:00
Joel Speed 9782fc7fa4
Add static pages to PageWriter interface 2021-03-21 18:28:37 +00:00
Nick Meves c1267bb92d
Request ID Logging (#1087)
* Add RequestID to the RequestScope

* Expose RequestID to auth & request loggers

* Use the RequestID in templated HTML pages

* Allow customizing the RequestID header

* Document new Request ID support

* Add more cases to scope/requestID tests

* Split Get vs Generate RequestID funtionality

* Add {{.RequestID}} to the request logger tests

* Move RequestID management to RequestScope

* Use HTML escape instead of sanitization for Request ID rendering
2021-03-21 18:20:57 +00:00
Nick Meves 4d9de06b1d
Deprecate GAP-Signature and add a warning on usage (#1103) 2021-03-14 09:47:44 -07:00
Joel Speed 20cf033065
Merge pull request #1045 from oauth2-proxy/fix-missing-redirect-scheme
Ensure redirect URI always has a scheme
2021-03-14 16:06:07 +00:00
Joel Speed 9dbd5f5afd
Ensure redirect URI always has a scheme 2021-03-14 10:16:29 +00:00
Weinong Wang f3209a40e1
extract email from id_token for azure provider (#914)
* extract email from id_token for azure provider

this change fixes a bug when --resource is specified with non-Graph
api and the access token destined to --resource is used to call Graph
api

* fixed typo

* refactor GetEmailAddress to EnrichSessionState

* make getting email from idtoken best effort and fall back to previous behavior when it's absent

* refactor to use jwt package to extract claims

* fix lint

* refactor unit tests to use test table
refactor the get email logic from profile api

* addressing feedback

* added oidc verifier to azure provider and extract email from id_token if present

* fix lint and codeclimate

* refactor to use oidc verifier to verify id_token if oidc is configured

* fixed UT

* addressed comments

* minor refactor

* addressed feedback

* extract email from id_token first and fallback to access token

* fallback to access token as well when id_token doesn't have email claim

* address feedbacks

* updated change log!
2021-03-09 20:53:15 -08:00
Joel Speed 6894738d97
Merge pull request #1047 from oauth2-proxy/http-server
Refactor HTTP Server and add ServerGroup to handle graceful shutdown of multiple servers
2021-03-07 21:12:02 +00:00
Joel Speed 36887a05b5
Add changelog entry for HTTP server refactor 2021-03-07 11:50:45 +00:00
Joel Speed f4b3115dd3
Add complete metrics server configuration 2021-03-07 11:49:12 +00:00
Joel Speed 86e672e21e
Update generated docs reference 2021-03-07 11:49:12 +00:00
Joel Speed 8d2fc409d8
Integrate new server implementation into main OAuth2 Proxy 2021-03-07 11:49:11 +00:00
Joel Speed 2c54ee703f
Add server group implementation for running multiple servers at once 2021-03-07 11:49:10 +00:00
Joel Speed d8aca8ac30
Add new http server implementation 2021-03-07 11:49:09 +00:00
Joel Speed 3d457a8cdf
Create server options struct and move legacy server options to legacyOptions 2021-03-07 11:49:08 +00:00
Nick Meves 602dac7852
Move Logging to Middleware Package (#1070)
* Use a specialized ResponseWriter in middleware

* Track User & Upstream in RequestScope

* Wrap responses in our custom ResponseWriter

* Add tests for logging middleware

* Inject upstream metadata into request scope

* Use custom ResponseWriter only in logging middleware

* Assume RequestScope is never nil
2021-03-06 17:27:16 +00:00
Stefan Sedich 220b3708fc
Add support for setting groups on session when using basic auth (#1064)
* Add support for setting groups on session when using basic auth

* Refactoring based on feedback

* Attribution
2021-02-25 13:02:23 -08:00
Joel Speed d3147c3ab2
Merge pull request #1056 from oauth2-proxy/sign-in-logo
Add option for custom logos on the sign in page
2021-02-22 10:37:43 +00:00
Joel Speed 23e545a639
Add option for custom logos on the sign in page 2021-02-19 13:23:55 +00:00
Joel Speed ad2d7b1ae7
Merge pull request #1054 from oauth2-proxy/go-1.16
Update to Go 1.16
2021-02-19 11:37:40 +00:00
Joel Speed d1e7ae6f11
Don't download dependencies using go mod 2021-02-19 11:31:00 +00:00
Joel Speed 756d385154
Extract templates to separate files
This allows our users to easily copy the base templates should they wish 
to make changes to them
2021-02-19 11:30:59 +00:00
Joel Speed 5fe947eb07
Update go version to 1.16
This includes a fix for our samesite cookie parsing. The behaviour
changed in 1.16 so that the default value now leaves it empty, so it's
equivalent to not setting it (as per spec)
2021-02-19 11:30:58 +00:00
Joel Speed 322308aab5
Merge pull request #1052 from oauth2-proxy/update-linter
Update golangci-lint to latest version (v1.36.0)
2021-02-17 20:56:43 +00:00
Joel Speed 9cea4ea89b
Update golangci-lint version in CI workflow 2021-02-17 20:25:37 +00:00
Praveen Chinthala 76269a13b7
Support Traefik ForwardAuth without a 401 handler (#1023)
* GH-1015 Adds support for Traefik to OauthStart on '/oauth2/auth' endpoint

* Fix incorrect reference to signout path and point to signin path

- remove commented out alternative solutions and debug log statements

* Remove skip provider button check as SignIn method already does this

* Updated traefik example to match existing file configuration reference, updated tests

* Update doc and refactor nested conditional statements

* Revert code changes as static upstream provides the same functionality

- Add doc on using static upstream with Traefik ForwardAuth middleware

* update changelog

* Move the doc changes to 7.0.x versioned docs

* Re-add traefik docs update in the main docs overview.md

* add missing oauth2-proxy routing

Co-authored-by: Praveen Chinthala <PraveenChinthala@hollandandbarrett.com>
2021-02-15 19:31:08 +00:00
Joel Speed 845235185d
Merge pull request #1049 from neuralsandwich/add-metrics
Fix #980 CHANGELOG link
2021-02-15 16:27:02 +00:00
Sean Jones b2d0b728ef
Fix #980 CHANGELOG link 2021-02-15 16:19:28 +00:00
Joel Speed 59aeefcd8b
Merge pull request #980 from neuralsandwich/add-metrics
Add Prometheus metrics endpoint
2021-02-15 15:01:37 +00:00
Sean Jones a7c8a233ba
Add Prometheus metrics endpoint
Add the Prometheus http.Handler to serve metrics at MetricsPath ("/metrics"
by default). This allows Prometheus to scrape metrics from OAuth2 Proxy.

Add a new middleware NewRequestMetrics and attach it to the preAuth
chain. This will collect metrics on all requests made to OAuth2 Proxy

Collapse some calls to Prinf() and os.Exit(1) to Fatalf as they are
equivalent. main() has a strict 50 lines limit so brevity in these
calls appreciated
2021-02-15 13:45:26 +00:00
Joel Speed ce29b16d84
Merge pull request #1043 from oauth2-proxy/sign-in-page
Refactor Sign In Page rendering and capture all page rendering code in pagewriter package
2021-02-14 10:26:01 +00:00
Joel Speed 425cff7af1
Add changelog entry for introduction of pagewriter package 2021-02-14 10:21:15 +00:00
Joel Speed 225ff478a1
Move all pagewriter related code to dedicated pagewriter package 2021-02-14 10:21:13 +00:00
Joel Speed e8e2af73df
Wrap templates and page rendering in PageWriter interface 2021-02-14 10:20:26 +00:00
Joel Speed dba6989054
Move SignIn page rendering to app pkg 2021-02-13 11:35:38 +00:00
Joel Speed 1e3d8547d7
Merge pull request #1029 from oauth2-proxy/error-pages
Refactor error page rendering and allow debug messages on error
2021-02-13 10:52:41 +00:00
Joel Speed 9e8c2af86b
Update docs for new show-debug-on-error option 2021-02-13 10:48:03 +00:00
Joel Speed 6ecbc7bc4e
Allow users to choose detailed error messages on error pages 2021-02-12 21:12:28 +00:00
Joel Speed a63ed0225c
Use ErrorPage to render proxy error page 2021-02-12 21:12:27 +00:00
Joel Speed ef457b1765
Move Error page rendering to app package 2021-02-12 21:12:05 +00:00
Joel Speed 9cdcd2b2d4
Merge pull request #1028 from oauth2-proxy/templates
Refactor templates, update theme and provide styled error pages
2021-02-12 21:02:52 +00:00
Joel Speed 881f43f793
Add changelog entry for refactored templates 2021-02-12 16:56:25 +00:00
Joel Speed 0151ca11f6
Move template loading to app package 2021-02-12 16:55:52 +00:00
Joel Speed 84f76c6060
Move template options to their own struct 2021-02-12 16:55:51 +00:00
Joel Speed 801edeba23
Update templates to bulma framework 2021-02-12 16:55:45 +00:00
Joel Speed 465789b044
Merge pull request #1039 from oauth2-proxy/fix-test-logging
Ensure errors in tests are logged to the GinkgoWriter
2021-02-11 09:48:24 +00:00
Joel Speed b6cca79cb9
Ensure errors in tests are logged to the GinkgoWriter 2021-02-10 19:50:04 +00:00
Joel Speed 4fa607f173
Merge pull request #1038 from oauth2-proxy/prep-7.0.1
Prepare for release v7.0.1
2021-02-10 19:34:51 +00:00
Joel Speed e87a51f0e5
Prepare for release v7.0.1 2021-02-10 18:25:39 +00:00
Aleksander Stelmaczonek 7def4bf360
[DOC] Fix broken link to cookie secret generation (#1024)
* [DOC] Fix broken link

* Update auth.md

* Update auth.md

* Update auth.md

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2021-02-10 17:55:42 +00:00
Aleksander Stelmaczonek 0f859215f0
[DOC] Add header to cookie secret paragraph (#1025)
* [DOC] Add header to cookie secret paragraph

* Update overview.md

* Update overview.md

* Update overview.md

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2021-02-08 12:58:38 +00:00
Joel Speed b97c83297e
Update release process to use makefile go version check (#1027)
Co-authored-by: Nick Meves <nick.meves@greenhouse.io>
2021-02-06 15:19:33 -08:00
Nick Meves c9d9769f6f
Merge pull request #1026 from oauth2-proxy/fix-flag-loading
Ensure config flags get parsed correctly when other flags preceed them
2021-02-06 14:49:45 -08:00
Joel Speed ae17e38403
Ensure config flags get parsed correctly when other flags preceed them 2021-02-06 15:25:08 +00:00
Joel Speed 9df3a752a6
Merge pull request #1020 from grnhse/flatten-response-headers
Flatten array-based response headers
2021-02-04 08:10:59 +00:00
Nick Meves c3f31b4dd5
Flatten array-based response headers 2021-02-03 16:48:26 -08:00
Joel Speed 06985879e1
Merge pull request #1007 from oauth2-proxy/release-v7.0.0
Prepare for Release v7.0.0
2021-02-01 18:16:08 +00:00
Joel Speed 1ccaea7710
Add advisory note to changelog 2021-02-01 18:12:34 +00:00
Joel Speed d1a249262f
Create v7.0.x versioned docs
Created within: yarn run docusaurus docs:version 7.0.x
2021-02-01 18:05:47 +00:00
Joel Speed a909d33355
Update CHANGELOG for release v7.0.0 2021-02-01 18:05:44 +00:00
Nick Meves 780ae4f3c9
Merge pull request from GHSA-4mf2-f3wh-gvf2 2021-02-01 18:04:33 +00:00
Nishanth Reddy 48b1658e5d
Update alpine version to 3.13 (#1013)
* Update alpine version to 3.13 

alpine 3.12 has a CVE https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-28928 which got fixed in recent version

* address review comments
2021-01-30 15:33:28 +00:00
Lida Li b541805dc1
Use comma separated multiple values for header (#799)
* Use comma separated value for multiple claims

* Fix lint error

* Fix more tests

* Fix one more test

* Always flatten the headers

* Ensure we test the real multi-groups

* Only update map when necessary

* Update CHANGELOG

* Move to the right location of change log

* Fix blank line
2021-01-22 08:48:34 +00:00
Wilfried OLLIVIER 8087de7a03
Add Gitlab version warning/constaint in documentation (#1004) 2021-01-20 19:57:22 +00:00
Kevin Kreitner 57640764c0
Use logger for sensitive data logging to be able to disable it (#1002)
* Add sensible logging flag to default setup for logger

* Use logger instead of fmt for info logging with sensible data

* Remove sensible logging flag

* Update CHANGELOG.md

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2021-01-20 19:56:13 +00:00
Joel Speed 56075e3776
Merge pull request #903 from oauth2-proxy/reference-generator
Add docs and generated reference for Alpha configuration
2021-01-19 19:27:38 +00:00
Joel Speed fbfc0959cb
Add changelog entry for new alpha configuration docs 2021-01-18 09:57:51 +00:00
Joel Speed 5c64e236fb
Generate reference page in configuration 2021-01-18 09:57:44 +00:00
Joel Speed eb129a342c
Ensure code is generated during CI 2021-01-18 09:56:07 +00:00
Joel Speed 9c126f5740
Merge pull request #964 from grnhse/reverse-proxy-context
Track the ReverseProxy config setting in the request Scope
2021-01-17 18:32:32 +00:00
Nick Meves da02914a9c
Log IsValidRedirect violations and do a final safety call 2021-01-16 13:56:38 -08:00
Nick Meves fa6a785eaf
Improve handler vs helper organization in oauthproxy.go
Additionally, convert a lot of helper methods to be private
2021-01-16 13:55:49 -08:00
Nick Meves 73fc7706bc
Figure out final app redirect URL with proxy aware request utils 2021-01-16 13:55:49 -08:00
Nick Meves f054682fb7
Make HTTPS Redirect middleware Reverse Proxy aware 2021-01-16 13:55:48 -08:00
Nick Meves 6fb3274ca3
Refactor organization of scope aware request utils
Reorganized the structure of the Request Utils due to their widespread use
resulting in circular imports issues (mostly because of middleware & logger).
2021-01-16 13:55:48 -08:00
Nick Meves b625de9490
Track the ReverseProxy option in the request Scope
This allows for proper handling of reverse proxy based headers throughout
the lifecycle of a request.
2021-01-16 13:55:48 -08:00
Nick Meves 8e02fac2cc
Merge pull request #995 from oauth2-proxy/security
Add Security Policy
2021-01-16 13:54:07 -08:00
Joel Speed e50e6ed373
Add Security Policy 2021-01-16 19:47:47 +00:00
Nick Meves a0d37518e0
Merge pull request #989 from rassie/master
Adapt isAjax to support mimetype lists
2021-01-12 15:28:07 -08:00
Nikolai Prokoschenko 81bf1ef8ce Adapt isAjax to support mimetype lists
Fixes #988
2021-01-12 19:37:30 +01:00
Joel Speed dd60fe4fef
Merge pull request #982 from grnhse/maintainer-update
Add NickMeves to MAINTAINERS
2021-01-11 09:03:00 +00:00
Nick Meves d08b9b7cc4
Add NickMeves to MAINTAINERS 2021-01-10 10:56:01 -08:00
Ilia Pertsev 597ffeb121
Fix joined cookie name for those containing underline in the suffix (#970)
* properly handle splitted cookies with names ending with _

* test update

* provide cookieName into joinCookies instead of processing the suffix

* changelog update

* test update
2021-01-04 17:21:17 -08:00
İlteriş Eroğlu 1d74a51cd7
Use X-Forwarded-{Proto,Host,Uri} on redirect as last resort (#957) 2021-01-01 15:23:11 -08:00
Joel Speed 91b3f5973e
Merge pull request #953 from grnhse/keycloak-refactor-provider-methods
Refactor Keycloak Provider Methods
2021-01-01 10:40:55 +00:00
Nick Meves 4b28e6886c
Handle ValidateURL fallback for nil & empty struct cases 2020-12-24 14:04:20 -08:00
Nick Meves 816d9a4566
Use a generic http.HandlerFunc in Keycloak tests 2020-12-24 14:04:19 -08:00
Nick Meves f07a5630f1
Update Keycloak documentation 2020-12-24 14:04:19 -08:00
Nick Meves 138a6b128a
Use ProfileURL for userinfo EnrichSession calls in Keycloak 2020-12-24 14:04:19 -08:00
Nick Meves 0886f8035c
Move all Keycloak unit tests to Ginkgo 2020-12-24 14:04:19 -08:00
Nick Meves 3369799853
Migrate Keycloak to EnrichSession & support multiple groups 2020-12-24 14:04:19 -08:00
Nick Meves 89e0a77a8f
Merge pull request #849 from grnhse/is-831-auth-querystring-groups
Group/Role Access Restriction support in `/oauth2/auth` endpoint
2020-12-24 12:21:40 -08:00
Nick Meves 753f6c548a
Add a detailed allowed_groups example to Important Notes 2020-12-24 12:05:12 -08:00
Nick Meves 65e15f24c1
Support only allowed_groups querystring 2020-12-24 12:05:12 -08:00
Nick Meves 025056cba0
Move AuthOnly authorize logic to a dedicated method 2020-12-24 12:05:11 -08:00
Nick Meves 44d83e5f95
Use StatusForbidden to prevent infinite redirects 2020-12-24 12:04:01 -08:00
Nick Meves 23b2355f85
Allow group authZ in AuthOnly endpoint via Querystring 2020-12-24 12:04:01 -08:00
Joel Speed 8bd2409342
Merge pull request #936 from grnhse/oidc-provider-refactor
OIDC Provider Refactor
2020-12-23 19:04:51 +00:00
Nick Meves d2ffef2c7e
Use global OIDC fields for Gitlab 2020-12-21 16:54:12 -08:00
Nick Meves 42f6cef7d6
Improve OIDC error handling 2020-12-21 16:53:05 -08:00
Nick Meves ea5b8cc21f
Support non-list and complex groups 2020-12-21 16:52:18 -08:00
Nick Meves eb56f24d6d
Deprecate UserIDClaim in config and docs 2020-12-21 16:52:17 -08:00
Nick Meves 74ac4274c6
Move generic OIDC functionality to be available to all providers 2020-12-21 16:52:04 -08:00
Nick Meves a1877434b2
Refactor OIDC to EnrichSession 2020-12-21 16:51:52 -08:00
Kirill Müller 4fda907830
Fix and enhance OIDC example (#934)
* Fix and enhance OIDC example

* Restructure

* Indent

* Add full stop.

* Add link

* Add minimalistic README

* Apply suggestions from code review

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-12-19 15:48:33 +00:00
TAGAMI Yukihiro a5466bb96d
Fix typo and missing InjectResponseHeaders validation (#952) 2020-12-12 10:05:01 -08:00
Mathieu Lecarme d67d6e3152
Add authorization support for Gitlab projects (#630)
* Add support for gitlab projets

* Add group membership in state

* Use prefixed allowed groups everywhere

* Fix: remove unused function

* Fix: rename func that add data to session

* Simplify projects and groups session funcs

* Add project access level for gitlab projects

* Fix: default access level

* Add per project access level

* Add user email when missing access level

* Fix: harmonize errors

* Update docs and flags description for gitlab project

* Add test with both projects and groups

* Fix: log error message

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

* Fix: make doc a markdown link

* Add notes about read_api scope for projects

* Fix: Verifier override in Gitlab Provider

This commit fixes a bug caused by an override of the Verifier value from *ProviderData inside GitlabProvider struct

* Fix: ensure data in session before using it

* Update providers/gitlab.go

Co-authored-by: Nick Meves <nick.meves@greenhouse.io>

* Rename gitlab project initializer

* Improve return value readbility

* Use splitN

* Handle space delimiters in set project scope

* Reword comment for AddProjects

* Fix: typo

* Rework error handling in addProjectsToSession

* Reduce branching complexity in addProjectsToSession

* Fix: line returns

* Better comment for addProjectsToSession

* Fix: enrich session comment

* Fix: email domains is handled before provider mechanism

* Add archived project unit test

* Fix: emails handling in gitlab provider

Co-authored-by: Wilfried OLLIVIER <wollivier@bearstech.com>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
Co-authored-by: Nick Meves <nick.meves@greenhouse.io>
2020-12-05 10:57:33 -08:00
Joel Speed 5117f2314f
Merge pull request #943 from aimichal/patch-1
Update Slack channel name
2020-12-04 14:39:26 +00:00
Michal Guerquin f260c3707a
Update Slack channel name 2020-12-03 15:20:31 -08:00
Joel Speed 87c67b09a7
Merge pull request #907 from oauth2-proxy/alpha-config
Introduce alpha configuration option to enable testing of structured configuration
2020-12-01 09:28:47 +00:00
Joel Speed d749c11e73
Add changelog entry for adding alpha configuration 2020-12-01 08:57:13 +00:00
Joel Speed b201dbb2d3
Add convert-config-to-alpha flag to convert existing configuration to alpha structure 2020-12-01 08:56:51 +00:00
Joel Speed 5b683a7631
Add local environment that uses alpha configuration 2020-12-01 08:56:50 +00:00
Joel Speed f36dfbb494
Introduce alpha configuration loading 2020-12-01 08:56:49 +00:00
Joel Speed 5b003a5657
SecretSource.Value should be plain text in memory 2020-12-01 08:56:46 +00:00
Joel Speed d587030019
Merge pull request #938 from grnhse/naming-refactor-tweaks
Cleanup method name refactors missed in comments
2020-11-30 19:38:43 +00:00
Nick Meves 26ed080bed
Cleanup method name refactors missed in comments 2020-11-29 14:18:14 -08:00
Nick Meves f6ae15e8c3
Merge pull request #869 from grnhse/streamline-provider-naming
Streamline Provider Interface & Bearer Session Handlers
2020-11-28 10:30:09 -08:00
Nick Meves 57a8ef06b4
Fix method renaming in comments and tests 2020-11-28 10:25:12 -08:00
Nick Meves 5f8f856260
Remove failed bearer tokens from logs 2020-11-28 10:25:12 -08:00
Nick Meves 22f60e9b63
Generalize and extend default CreateSessionFromToken 2020-11-28 10:25:12 -08:00
Nick Meves 44fa8316a1
Aggregate error logging on JWT chain failures 2020-11-28 10:25:12 -08:00
Nick Meves 3e9717d489
Decouple TokenToSession from OIDC & add a generic VerifyFunc 2020-11-28 10:25:11 -08:00
Nick Meves e9f787957e
Standardize provider interface method names 2020-11-28 10:25:11 -08:00
Joel Speed 2706909fe3
Merge pull request #850 from grnhse/is-834-userinfo-expansion
Add User & Groups to Userinfo
2020-11-27 16:36:41 +00:00
Nick Meves 7407fbd3a7
Add more UserInfo test cases 2020-11-25 19:00:58 -08:00
Nick Meves 2549b722d3
Add User & Groups to Userinfo 2020-11-25 18:19:48 -08:00
Nick Meves 3ff0c23a9e
Merge pull request #931 from apeschel/topic/stable-repo-url-fix
Use New Stable Chart URL
2020-11-24 20:57:28 -08:00
Aaron Peschel 527c0c311c Use New Stable Chart URL
The existing URL no longer works. This commit updates the Chart
dependencies to use the new Stable chart URL.

This will fix the "Chart not found" errors that occur if these example
resources are used.

Please keep in mind this is only a bandaid, as the repository is still
EOL, and should not be used.
2020-11-23 11:45:34 -08:00
Joel Speed 8bed7aafbd
Merge pull request #925 from oauth2-proxy/fix-basic-auth
Fix basic auth legacy header conversion
2020-11-19 20:14:44 +00:00
Joel Speed 482cd32a17
Fix basic auth legacy header conversion 2020-11-19 20:07:59 +00:00
Joel Speed eb07005a5c
Merge pull request #916 from oauth2-proxy/alpha-config-types
Add AlphaOptions struct to prepare for alpha config loading
2020-11-19 17:11:16 +00:00
Joel Speed aed43a54da
Add DefaultUpstreamFlushInterval to replace magic time.Second value 2020-11-19 10:39:21 +00:00
Joel Speed 8e582ac02a
Add changelog entry for adding alphaoptions struct 2020-11-19 10:35:56 +00:00
Joel Speed d353d94631
Add AlphaOptions struct and ensure that all children have valid JSON tags 2020-11-19 10:35:31 +00:00
Joel Speed b6d6f31ac1
Introduce Duration so that marshalling works for duration strings 2020-11-19 10:35:29 +00:00
Akira Ajisaka ed92df3537
Support TLS 1.3 (#923)
* Support TLS 1.3

* Set TLS 1.3 explicitly to fix gosec warning.

* Add an entry to changelog.

* Fix typo in the changelog.

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-11-19 10:25:53 +00:00
Joel Speed 430355b203
Merge pull request #918 from oauth2-proxy/fix-log-caller
Fix log header output
2020-11-19 10:18:43 +00:00
Joel Speed 3a4660414a
Fix log calldepth 2020-11-15 18:52:59 +00:00
Joel Speed c377466411
Merge pull request #797 from grnhse/refactor-provider-authz
Centralize Provider authorization interface method
2020-11-12 19:38:55 +00:00
Nick Meves d7fa979060
Note legacy areas to refactor away from `groupValidator` 2020-11-12 11:18:59 -08:00
Nick Meves b9661cb6fe
Return 401 Unauthorized if Authorize fails 2020-11-12 11:18:59 -08:00
Nick Meves f21b3b8b20
Authorize in Redeem callback flow 2020-11-12 11:18:59 -08:00
Nick Meves 1b3b00443a
Streamline ErrMissingCode in provider Redeem methods 2020-11-12 11:18:59 -08:00
Nick Meves b92fd4b0bb
Streamline Google to use default Authorize 2020-11-12 11:18:58 -08:00
Nick Meves eb58ea2ed9
Move AllowedGroups to DefaultProvider for default Authorize usage 2020-11-12 11:18:15 -08:00
Nick Meves e7ac793044
Replace ValidateGroup with Authorize for Provider 2020-11-12 11:17:06 -08:00
Joel Speed df56a34ea3
Merge pull request #911 from arcivanov/issue_895
Validate and log provider type on startup
2020-11-12 17:25:14 +00:00
Arcadiy Ivanov 45ae87e4b7
Logs provider name on startup
If invalid provider is specified, stop and error out

fixes #895
2020-11-12 10:39:35 -05:00
Joel Speed 6254ed24ea
Merge pull request #906 from oauth2-proxy/docs-v6.1
Set up v6.1.x versioned documentation as default documentation
2020-11-09 10:15:37 +00:00
Joel Speed 66550db7b9
Add changelog entry for v6.1.x docs 2020-11-08 19:39:39 +00:00
Joel Speed c8a70c6243
Add version dropdown to docs header 2020-11-08 19:37:46 +00:00
Joel Speed 6c483e5674
Set up docs for version 6.1.x 2020-11-08 19:37:43 +00:00
ofir-amir cc6532a282
Use display-htpasswd-form flag (#778)
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-11-08 18:48:01 +00:00
Joel Speed 47710d0094
Merge pull request #905 from grnhse/deprecate-legacy-sessions
Remove v5 JSON session support
2020-11-08 17:41:12 +00:00
Nick Meves 2b15ba0bcf
Remove v5 JSON session support 2020-11-08 08:52:55 -08:00
Joel Speed 289f4f3c5f
Merge pull request #904 from grnhse/default-strip-request-headers
Flip `--skip-auth-strip-headers` to `true` by default
2020-11-08 12:04:47 +00:00
Nick Meves 7d6ff03d13
Fix X-Auth-Request-Preferred-Username in response headers 2020-11-07 12:47:42 -08:00
Nick Meves 1c26539ef0
Align tests to SkipAuthStripHeaders default 2020-11-07 12:33:37 -08:00
Nick Meves 14fd934b32
Flip `--skip-auth-strip-headers` to `true` by default 2020-11-07 11:43:45 -08:00
Nick Meves 5cba642938
Merge pull request #826 from oauth2-proxy/header-middlewares
Integrate new header injectors into project
2020-11-07 11:14:31 -08:00
Joel Speed 1270104806
Update changelog to include integration of new header injection 2020-11-07 17:17:43 +00:00
Joel Speed 92d09343d2
Add tests for legacy header conversion 2020-11-07 17:17:10 +00:00
Joel Speed 8d1bbf33b1
Add tests for headers validation 2020-11-07 17:17:06 +00:00
Joel Speed 1dac1419b3
Add tests for SecretSource validation 2020-11-07 17:17:02 +00:00
Joel Speed 8059a812cd
Integrate new header injectors with OAuth2 Proxy 2020-11-07 17:16:58 +00:00
Joel Speed d26c65ba8d
Add validation for Headers struct 2020-11-07 17:16:54 +00:00
Joel Speed 2dc0d1e7ee
Create LegacyHeaders struct and conversion to new Headers 2020-11-07 17:16:49 +00:00
Ismael Padilla ab3cd58df6
Fixed links to docs in readme (#902)
* Fixed links to docs in readme

* Fixed logo at the top not being displayed
2020-11-06 16:57:23 -08:00
Joel Speed 39f57c6b28
Merge pull request #898 from oauth2-proxy/docusaurus
Migrate documentation to Docusaurus
2020-11-05 22:33:28 +00:00
Joel Speed 5a7ae59f2a
Add changelog entry for migrating to docusaurus 2020-11-05 16:09:02 +00:00
Joel Speed ef2628d5b2
Add github action to deploy docusaurus 2020-11-05 15:36:30 +00:00
Joel Speed 899c743afc
Migrate existing documentation to Docusaurus 2020-11-05 15:36:27 +00:00
Joel Speed 11bfd15566
Merge pull request #893 from oauth2-proxy/remove-travis
Remove Travis configuration
2020-11-04 19:45:48 +00:00
Joel Speed 3ccf74746e
Remove basename from test coverage prefix (#892)
Co-authored-by: Nick Meves <nick.meves@greenhouse.io>
2020-11-04 19:40:40 +00:00
Alexander Block 0e119d7c84
Azure token refresh (#754)
* Implement azure token refresh

Based on original PR https://github.com/oauth2-proxy/oauth2-proxy/pull/278

* Update CHANGELOG.md

* Apply suggestions from code review

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

* Set CreatedAt to Now() on token refresh

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-11-04 11:25:59 -08:00
Joel Speed e9d46bfe32
Remove Travis configuration 2020-11-03 22:22:15 +00:00
Kevin Kreitner 65016c8da1
Enable custom structure for group claim with default name group (#839)
* Allow complex structure for groups in group claim.

* Remove unused constant

* Update variable name

* Fix linting

* Use helper method

* Log error if not possible to append group value

* Add missing import

* Use own logger

* Fix imports

* Remove Dockerfile for testing

* Add Changelog entry

* Use formatGroup helper method and update tests

* Return string instead of string array

* Remove groups variable

* Return error in format method.

* Reorder imports

Co-authored-by: Nick Meves <nick.meves@greenhouse.io>
2020-11-03 10:10:08 -08:00
Jake cc6b808c17
Update README.md (#889)
Fix typo in README.md
2020-11-02 15:22:41 -08:00
Halvard Mørstad 8abc4e6d87
Updated Gitlab docs (#859) 2020-10-21 09:36:17 -07:00
Joel Speed 2aa04c9720
Merge pull request #796 from grnhse/refactor-redeem-code
Refactor redeemCode and support a Provider-wide EnrichSessionState method
2020-10-21 11:09:36 +01:00
Nick Meves 4a54c9421c
Remove EmailDomain verification from GitLab provider
This is handled globally
2020-10-20 10:01:53 -07:00
Nick Meves d9c141ae7c
Remove GetUserName method from Provider 2020-10-19 14:09:46 -07:00
Nick Meves 0da45e97e1
Refactor GitLab to EnrichSessionState 2020-10-19 14:09:45 -07:00
Nick Meves e51f5fe7c9
Refactor GitHub to EnrichSessionState 2020-10-19 14:09:45 -07:00
Nick Meves 2b9e1bbba0
Add EnrichSessionState as main post-Redeem session updater 2020-10-19 14:09:45 -07:00
Nick Meves b6061f0803
Adds tests for redeemCode and enrichSession 2020-10-19 14:09:02 -07:00
Nick Meves 0bd8eb3191
Setup provider.ErrNotImplemented sentinel error 2020-10-19 14:09:02 -07:00
Nick Meves add45c360c
Split session enrichment from code redemption 2020-10-19 14:09:02 -07:00
Jakub Holy 8b44ddd547
config: clarify skip-jwt-bearer-tokens needs (#851)
i.e. that the token must have a recognized `aud` field.
2020-10-19 19:14:50 +01:00
Philippe Pepiot 420a34f814
Document set_xauthrequest with pass_access_token (#829)
* Document set_xauthrequest with pass_access_token

Document feature implemented in https://github.com/oauth2-proxy/oauth2-proxy/pull/68

The feature is already decribed in in the nginx example but not clearly
on each respective parameters documentation.

* Update docs/configuration/configuration.md

Co-authored-by: Nick Meves <nick.meves@greenhouse.io>

Co-authored-by: Nick Meves <nick.meves@greenhouse.io>
2020-10-14 09:17:55 -07:00
Nick Meves f4c292b6c7
Merge pull request #825 from oauth2-proxy/test-reporter
Fix code coverage reporting on GitHub actions
2020-10-13 17:16:53 -07:00
Joel Speed 132c2cb210
Add changelog for fixing test reporting in github actions 2020-10-07 18:49:32 +01:00
Joel Speed 70c585812e
Fix coverage file path recognition 2020-10-07 18:48:14 +01:00
Joel Speed b848663a3d
Move test script to workflows folder 2020-10-07 18:48:11 +01:00
Joel Speed 7861a707cd
Fix name of test report ID variable 2020-10-07 18:47:18 +01:00
Mitsuo Heijo f705d2b5d3
Improve CI (#819)
* simplify github actions workflow

no more GOPATH, update Go to 1.15.x

* add script to install golangci-lint

* drop support for Go 1.14

* check docker build in ci

* update alpine linux to 3.12

* update CHANGELOG

* fix golangci-lint installation

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-10-07 18:46:41 +01:00
Joel Speed a835fc5192
Merge pull request #705 from oauth2-proxy/header-injectors
Add generic Header injectors for upstream request and response headers
2020-10-07 18:40:08 +01:00
Joel Speed 70990327d1
Make claims list of strings 2020-10-07 18:25:00 +01:00
Joel Speed c9b3422801
Add changelog entry for generic header injectors 2020-10-07 18:24:59 +01:00
Joel Speed 6743e3991d
Add header injector middlewares 2020-10-07 18:24:58 +01:00
Joel Speed fc2ff19a19
Add header Injector 2020-10-07 18:24:57 +01:00
Joel Speed eec7565c52
Add Header option structure 2020-10-07 18:24:56 +01:00
Joel Speed d8b0d9059d
Merge pull request #789 from grnhse/skip-auth-http-method
Support HTTP method based allowlists
2020-10-07 18:23:51 +01:00
Nick Meves b7b7ade7c4
Improve AllowedRoute test table formatting 2020-10-07 10:13:41 -07:00
Nick Meves 89a8ac8c1f
Add startup logging for skipped auth routes 2020-10-07 10:13:41 -07:00
Nick Meves fa4ba5e7ea
Convert allowlist validation test to Ginkgo 2020-10-07 10:13:41 -07:00
Nick Meves cfd3de807c
Add tests for skip auth functionality 2020-10-07 10:13:41 -07:00
Nick Meves 183cb124a4
Support HTTP method based allowlists 2020-10-07 10:13:40 -07:00
Mitsuo Heijo fcb83c48f4
Update go-redis/redis to v8 (#801)
* update go-redis/redis to v8

testify, ginko and gomega have also been updated.

* update changelog

* Update pkg/sessions/redis/redis_store_test.go

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-10-07 11:49:27 +01:00
Joel Speed 581c6c3259
Merge pull request #820 from johejo/fix_testdata
Rename test directory to testdata
2020-10-06 13:45:43 +01:00
Mitsuo Heijo 5c62690653 Rename test directory to testdata
See https://golang.org/cmd/go/#hdr-Test_packages
2020-10-06 21:37:25 +09:00
Jakub Holy 3d203a1a03
Home: Add a brief description of the behavior (#794)
* Home: Add a brief description of the behavior

I could not find this information anywhere and think it is quite important for understanding how to use and configure the proxy for different use cases.

(Especially the Ajax part is not mentioned anywhere else I believe.)

I tried to keep it general enough so that it won't need updating often yet useful enough to have good value :)

* Update docs/0_index.md

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-10-05 10:34:42 +01:00
Shinebayar G dc7dbc5d28
ci: migrate to Github Actions, close #546 (#750)
* ci: migrate to Github Actions

* ci: optimize on feedback

* ci: run gocov in correct dir

* ci: running after-build script always

* ci: giving test script execute permission

* ci: correct error handling on test script

* ci: more verbose test script

* ci: configure CC_TEST_REPORTER_ID env

* ci: check existence of CC_TEST_REPORT_ID variable, skip if unset

* ci: check existence of CC_TEST_REPORT_ID variable, skip if unset

* update changelog

* Update CHANGELOG.md

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-10-05 10:29:47 +01:00
Thiago Caiubi 8be97f25e7
Fix build (#813)
* Fix build

Without the v7 path it builds old version of the project (v3.2.0).

* Update CHANGELOG.md
2020-10-03 14:09:40 +01:00
Joel Speed 9bc618bb08
Merge pull request #783 from johejo/go_115
Update Go to 1.15
2020-10-02 18:42:04 +01:00
Mitsuo Heijo e64322b070 Update Go to 1.15 2020-09-30 09:54:43 +09:00
Mitsuo Heijo 3fa42edb73
Fix import path for v7 (#800)
* fix import path for v7

find ./ -name "*.go" | xargs sed -i -e 's|"github.com/oauth2-proxy/oauth2-proxy|"github.com/oauth2-proxy/oauth2-proxy/v7|'

* fix module path

* go mod tidy

* fix installation docs

* update CHANGELOG

* Update CHANGELOG.md

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-09-29 17:44:42 +01:00
Nick Meves 7c4479791c
Merge pull request #753 from codablock/azure-resource
Pass resource parameter in login url
2020-09-29 09:21:14 -07:00
Alexander Block d046782f61 Add link to #753 in changelog 2020-09-29 13:35:40 +02:00
Alexander Block 090eff0197 Add CHANGELOG.md entries for #753 2020-09-28 12:17:06 +02:00
Alexander Block 74918c40d8 Refactor makeLoginURL to accept extraParams
And don't require the caller to know how to use the returned params.
2020-09-28 12:15:06 +02:00
Alexander Block 4eb9612679 Move DefaultGetLoginURL into util.go 2020-09-28 12:15:06 +02:00
Alexander Block 9a64e67d5b De-duplicate code in GetLoginURL of in logingov provider
Also add unit test to ensure logingov specific logic is applied.
2020-09-28 12:15:06 +02:00
Alexander Block fde09bea4e Move azure specific resource parameter handling into azure provider 2020-09-28 12:15:06 +02:00
Alexander Block 97e95fd4ff Move actual implementation of default provider GetLoginURL into DefaultGetLoginURL
This allows us to reuse code from different providers in case slight
modifications to the URL are needed.
2020-09-28 12:15:06 +02:00
Alexander Block 017b9bcfb7 Add unit test for protected resources 2020-09-28 12:15:06 +02:00
Alexander Block 8cbf9219bc Pass resource parameter in login url 2020-09-28 12:15:06 +02:00
Joel Speed e9aa7acf4e
Merge pull request #791 from grnhse/remove-provider-preferred-username-getter
Remove provider GetPreferredUsername getter method
2020-09-24 18:55:33 +01:00
Nick Meves e0d915cc03
Stop shadowing GetEmailAddress errors in redeemCode 2020-09-24 10:50:18 -07:00
Nick Meves 3371284a36
Remove GetPreferredUsername method from Provider interface
It isn't used in any providers and we have future plans
to remove the specialness of PreferredUsername and make it
an optional field in the session.

User, Email & Groups will eventually be the only first class
fields on the session that are always set.
2020-09-24 10:49:50 -07:00
Joel Speed 160685abd7
Merge pull request #722 from grnhse/redis-startup-validation
Redis configuration startup validation
2020-09-24 18:48:55 +01:00
Nick Meves 6db1aeb9c6
Validate Redis session store health on startup 2020-09-24 10:41:43 -07:00
Joel Speed 93870ec0ff
Merge pull request #575 from grnhse/deprecate-sha1
Stop accepting legacy SHA1 signed cookies
2020-09-24 18:36:52 +01:00
Nick Meves 56f199a24f
Stop accepting legacy SHA1 signed cookies 2020-09-24 10:31:34 -07:00
Nick Meves 55a941b76e
Merge pull request #788 from blz-ea/patch-1
docs: fix Keycloak provider documentation
2020-09-23 09:54:40 -07:00
blz-ea 4a04ff4529
docs: fix Keycloak provider documentation 2020-09-22 20:13:00 -04:00
Nick Meves 8eb9c69a9a
Merge pull request #616 from stefansedich/group-claim
Add support to ensure user belongs in required groups when using the OIDC provider
2020-09-21 13:04:27 -07:00
Stefan Sedich 9d59519a96
Add support to ensure user belongs in required groups when using the OIDC provider 2020-09-21 10:43:54 -07:00
Joel Speed a87beab1a0
Merge pull request #764 from lentzi90/patch-1
Document bcrypt encryption for htpasswd
2020-09-11 14:26:03 +01:00
Lennart Jern e14d6ab791 Document bcrypt encryption for htpasswd
Remove mention of (insecure) SHA option for encryption.
2020-09-11 13:32:00 +03:00
Joel Speed ef08d01b98
Merge pull request #757 from ManoManoTech/doc/cookieSession
Doc: cookie-secret is a mandatory field for cookie session
2020-09-04 15:30:47 +01:00
Aurélien LAJOIE 0eb0024e87 Doc: cookie-secret is a mandatory field for cookie session 2020-09-04 16:20:41 +02:00
Joel Speed e4e5580852
Merge pull request #748 from oauth2-proxy/release-6.1.1
Prepare CHANGELOG for v6.1.1 release
2020-08-31 17:18:45 +01:00
Joel Speed 1337f56188
Prepare CHANGELOG for v6.1.1 release 2020-08-31 17:01:52 +01:00
Joel Speed 841bf77f7f
Merge pull request #746 from oauth2-proxy/fix-static
Fix conversion of static responses in upstreams
2020-08-31 16:58:55 +01:00
Joel Speed bd619ab63e
Fix conversion of file upstreams 2020-08-31 16:54:13 +01:00
Joel Speed b40517bbe3
Fix conversion of static responses in upstreams 2020-08-31 16:54:01 +01:00
Joel Speed 73f0094486
Merge pull request #729 from grnhse/x-forwarded-host-redirect
Use X-Forwarded-Host in Redirects
2020-08-31 16:48:20 +01:00
Nick Meves 29b24793e3
Use X-Forwarded-Host consistently 2020-08-31 08:31:45 -07:00
Tomoyuki KOYAMA bd5fab478d
fix docs: command line options (#744) 2020-08-29 09:26:24 +01:00
Joel Speed 37026b60ce
Merge pull request #741 from oauth2-proxy/release-6.1.0
Prepare changelog for v6.1.0 release
2020-08-27 15:15:24 +01:00
Joel Speed 43bf36425d
Prepare changelog for v6.1.0 release 2020-08-27 15:08:46 +01:00
Joel Speed 4134a9010e
Merge pull request #742 from oauth2-proxy/domain-log
Only log no cookie match if cookie domains specified
2020-08-27 15:01:32 +01:00
Joel Speed 105d5acb7b
Only log no cookie match if cookie domains specified 2020-08-27 14:48:00 +01:00
Dan Bond d7abd56981
dist.sh: remove go version from asset links (#733)
* dist.sh: remove go version from asset links

* update changelog
2020-08-25 08:41:14 -07:00
Joel Speed 5fa5b3186f
Merge pull request #562 from oauth2-proxy/auth-header-helper
Create generic Authorization Header constructor
2020-08-17 16:44:38 +01:00
Joel Speed d05e08cba3
Create generic Authorization Header constructor 2020-08-16 20:04:34 +01:00
Joel Speed 9a338d8a34
Merge pull request #715 from oauth2-proxy/session-nil-time
Ensure session times are not nil before printing them
2020-08-16 19:57:55 +01:00
Joel Speed 16a30002df
Ensure session times are not nil before printing them 2020-08-16 19:53:52 +01:00
Joel Speed aceb9e2762
Merge pull request #700 from grnhse/oidc-no-email-tokens
Allow OIDC Bearer Tokens without emails
2020-08-16 13:03:43 +01:00
Nick Meves 0645e19c24
Cleanup internalSession params & handle profileURL Bearer case better
`findClaimsFromIDToken` would always have a `nil` access token and not be
able to hit the userinfo endpoint in Bearer case. If access token is nil,
default to legacy `session.Email = claim.Subject` that all JWT bearers used
to have, even if a valid profileURL is present.
2020-08-14 13:31:38 -07:00
Nick Meves dcc75410a8
Handle claim finding differently in bearer vs standard IDTokens 2020-08-14 13:31:38 -07:00
Nick Meves 514db45d1a
Allow OIDC Bearer Tokens without emails
This reverts to functionality before #499 where an OIDC
provider could be used with `--skip-jwt-bearer-tokens` and
tokens without an email or profileURL would still be valid.
This logic mirrors `middleware.createSessionStateFromBearerToken`
which used to be the universal logic before #499.
2020-08-14 13:31:38 -07:00
Joel Speed 8515da3e91
Merge pull request #714 from grnhse/redis-sentinel-password
Support Password & SentinelPassword in Redis session store
2020-08-14 14:09:54 +01:00
Nick Meves 51a9062044
Support Password & SentinelPassword in Redis session store 2020-08-11 12:22:05 -07:00
Nick Meves 35ed7a313b
Merge pull request #719 from grnhse/gosec-x-oauth-basic-skip
Add `x-oauth-basic` nosec annotation & address gosec unhandled errors
2020-08-11 11:56:07 -07:00
Nick Meves b6e78efc1e
Add `x-oauth-basic` nosec annotation & address gosec unhandled errors 2020-08-10 15:15:16 -07:00
Phil Taprogge d69fd6af22
Allow Logging to stdout with separate Error Log Channel (#718)
* Add dedicated error logging writer

* Document new errors to stdout flag

* Update changelog

* Thread-safe the log buffer

* Address feedback

* Remove duplication by adding log level

* Clean up error formatting

* Apply suggestions from code review

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-08-10 11:44:08 +01:00
Nick Meves 33e04cc52f
Merge pull request #690 from grnhse/gosec-findings-fixes
Address gosec findings
2020-08-09 08:24:37 -07:00
Nick Meves a1358d2070
Panic on any logger errors
Any template errors instead of IO
errors are caught in validation.
2020-08-09 07:55:41 -07:00
Nick Meves e88d29f16a
Refactor SignInMessage out of main 2020-08-09 07:55:41 -07:00
Nick Meves 46cc21d8cf
Skip gosec linting on tests 2020-08-09 07:55:41 -07:00
Nick Meves 45222395e0
Attempt to log still on template errors 2020-08-09 07:55:40 -07:00
Nick Meves 542bf1fad1
Add gosec to .golangci.yml 2020-08-09 07:55:40 -07:00
Nick Meves ad52587ae6
Document GoSec nosec skip comments 2020-08-09 07:55:40 -07:00
Nick Meves 2bb0160bf3
Streamline error page usage 2020-08-09 07:55:40 -07:00
Nick Meves 1c8c5b08d7
Handle cookie signing errors 2020-08-09 07:55:40 -07:00
Nick Meves 65c228394f
Address gosec findings
Mostly handling unhandled errors appropriately.
If logging to STDERR fails, we panic. Added #nosec
comments to findings we are OK with.
2020-08-09 07:55:39 -07:00
Joel Speed 7b21f53aad
Merge pull request #689 from grnhse/finicky-logging-time-test
Fix time issue causing finicky failures in logging tests
2020-08-07 08:32:17 +01:00
Nick Meves 81ec9edf53
Fix time issue causing finicky failures in logging tests 2020-08-06 15:44:05 -07:00
Nick Meves 0cf0fd88e8
Merge pull request #710 from ryandesign/patch-1
Fix typos and other minor edits
2020-08-04 07:58:53 -07:00
Ryan Schmidt 6e31eb28d5
Fix typos and other minor edits 2020-08-04 01:29:00 -05:00
Joel Speed bbf00bc92b
Merge pull request #701 from jhutchings1/patch-1
Add pull request events to CodeQL action
2020-07-29 12:23:08 +01:00
Justin Hutchings 43189a7854
Add pull request events to CodeQL action
This will validate pull requests from forks to ensure that changes don't end up impacting you negatively.
2020-07-28 21:42:21 -07:00
Joel Speed 2318716a89
Merge pull request #699 from grnhse/refactor-persistence-tests
Align persistence ginkgo tests to conventions
2020-07-22 11:23:49 +01:00
Nick Meves 19836f85ac
Align persistence ginkgo tests to conventions 2020-07-21 22:13:17 -07:00
Andy Voltz 88ef888752
Preserve query when building redirect (fix for #695) (#696)
* Add test for GetRedirect to check query and fragments.

* Preserve query and fragment when building redirect.

* Add changelog entry for redirect fix
2020-07-21 16:38:13 +01:00
Joel Speed c5da3dff9c
Merge pull request #561 from oauth2-proxy/provider-urls-refactor
Move provider URLs to package level vars
2020-07-20 11:50:47 +01:00
Nick Meves 9643a0b10c
Centralize Ticket management of persistent stores (#682)
* Centralize Ticket management of persistent stores

persistence package with Manager & Ticket will handle
all the details about keys, secrets, ticket into cookies,
etc. Persistent stores just need to pass Save, Load &
Clear function handles to the persistent manager now.

* Shift to persistence.Manager wrapping a persistence.Store

* Break up the Redis client builder logic

* Move error messages to Store from Manager

* Convert ticket to private for Manager use only

* Add persistence Manager & ticket tests

* Make a custom MockStore that handles time FastForwards
2020-07-19 21:25:13 +01:00
Joel Speed f141f7cea0
Merge pull request #688 from oauth2-proxy/session-middlewares
Refactor session loading to make use of middleware pattern
2020-07-19 20:40:17 +01:00
Joel Speed 1aac37d2b1
Merge pull request #593 from oauth2-proxy/proxy-refactor
Integrate upstream package with OAuth2 Proxy
2020-07-19 20:10:56 +01:00
Joel Speed d4dd34a65a
Move provider URLs to package level vars 2020-07-19 18:34:55 +01:00
Joel Speed 3f00143175
Add changelog entry for session middleware refactor 2020-07-19 17:24:58 +01:00
Joel Speed eb234011eb
Integrate sessions middlewares 2020-07-19 17:24:12 +01:00
Joel Speed 034f057b60
Add session loader from session storage 2020-07-19 17:21:42 +01:00
Joel Speed 7d6f2a3f45
Add Basic Auth session loader middleware 2020-07-19 17:21:42 +01:00
Joel Speed c81a7ed197
Add JWT session loader middleware 2020-07-19 17:21:42 +01:00
Joel Speed 2768321929
Add request scope middleware 2020-07-19 17:21:42 +01:00
Joel Speed d43b372ca9
Use bool pointers for upstream options that default to true 2020-07-19 14:01:36 +01:00
Joel Speed 6b27069812
Add changelog entry for integrating new upstream proxy 2020-07-19 14:01:36 +01:00
Joel Speed 71dc70222b
Break legacy upstream options into LegacyUpstreams struct 2020-07-19 14:01:36 +01:00
Joel Speed 5dbcd73722
Configure OAuth2 Proxy to use new upstreams package and LegacyConfig 2020-07-19 08:17:53 +01:00
Joel Speed e932381ba7
Add LegacyOptions and conversion to new Options
This will be temporary until we switch to structured config, then we can remove the LegacyOptions and conversions
2020-07-19 08:17:53 +01:00
Joel Speed e02f99eb58
Merge pull request #687 from oauth2-proxy/htpasswd-validator
Refactor HTPasswd Validator
2020-07-18 17:29:50 +01:00
Joel Speed e73db7df7b
Add HTPasswd validator refactor to changelog 2020-07-18 11:01:49 +01:00
Joel Speed 2981a5ed1a
Integrate HTPasswdValidator into OAuth2 Proxy 2020-07-18 11:01:49 +01:00
Joel Speed 7d8ee61254
Add HTPasswdValidator to basic authentication package 2020-07-18 11:01:49 +01:00
devopsix 895403cb9b
Document what provider have support for --cookie-refresh. (#543)
Co-authored-by: Dirk Weinhardt <dirk.weinhardt@etl.de>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-07-15 00:05:13 +01:00
Nick Meves abeb0236d8
Strip X-Forwarded auth headers from whitelisted paths (#624)
* Strip X-Forwarded auth headers from whitelisted paths

For any paths that match skip-auth-regex, strip normal
X-Forwarded headers that would be sent based on pass-user-headers
or pass-access-token settings. This prevents malicious injecting
of authentication headers through the skip-auth-regex paths in
cases where the regex might be misconfigured and too open.
Control this behavior with --skip-auth-strip-headers flag. This
flag is set to TRUE by default (this is secure by default, but
potentially breaks some legacy configurations).

Only x-Forwarded headers stripped, left the Authorization header
untouched.

* Strip authorization header if it would be set

* Improve TestStripAuthHeaders test table

* Improve --skip-auth-strip-headers flag documentation
2020-07-14 23:46:44 +01:00
Nick Meves bb5977095f
Add option to remove tokens from cookie sessions (#673)
* Add option to remove tokens from cookie sessions

* Move Minimal to be an option on CookieSession

* Add sessionOptionsDefaults helper
2020-07-14 23:02:10 +01:00
Nick Meves a09eecc6a2
Reduce SessionState size better with MessagePack + LZ4 (#632)
* Encode sessions with MsgPack + LZ4

Assumes ciphers are now mandatory per #414. Cookie & Redis sessions
can fallback to V5 style JSON in error cases. TODO: session_state.go
unit tests & new unit tests for Legacy fallback scenarios.

* Only compress encoded sessions with Cookie Store

* Cleanup msgpack + lz4 error handling

* Change NewBase64Cipher to take in an existing Cipher

* Add msgpack & lz4 session state tests

* Add required options for oauthproxy tests

More aggressively assert.NoError on all
validation.Validate(opts) calls to enforce legal
options in all our tests.
Add additional NoError checks wherever error return
values were ignored.

* Remove support for uncompressed session state fields

* Improve error verbosity & add session state tests

* Ensure all marshalled sessions are valid

Invalid CFB decryptions can result in garbage data
that 1/100 times might cause message pack unmarshal
to not fail and instead return an empty session.
This adds more rigor to make sure legacy sessions
cause appropriate errors.

* Add tests for legacy V5 session decoding

Refactor common legacy JSON test cases to a
legacy helpers area under session store tests.

* Make ValidateSession a struct method & add CHANGELOG entry

* Improve SessionState error & comments verbosity

* Move legacy session test helpers to sessions pkg

Placing these helpers under the sessions pkg removed
all the circular import uses in housing it under the
session store area.

* Improve SignatureAuthenticator test helper formatting

* Make redis.legacyV5DecodeSession internal

* Make LegacyV5TestCase test table public for linter
2020-07-13 20:56:05 +01:00
mkontani dd36138965
docs: Fix required ruby-version (#675)
* fix required ruby-version

Signed-off-by: mkontani <itoama@live.jp>

* add a changelog entry

Signed-off-by: mkontani <itoama@live.jp>

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-07-12 16:09:34 +01:00
dreadnought 18716142b4
Use double dashes in service example (#678) 2020-07-12 15:50:19 +01:00
Joel Speed 19b5606126
Merge pull request #674 from oauth2-proxy/fix-changelog
Move changelog entry to correct release
2020-07-11 18:36:46 +01:00
Joel Speed d1c7be565b
Move changelog entry to correct release
This changelog entry was merged into the wrong release, this puts it back to the correct release
2020-07-11 11:14:12 +01:00
Isabelle COWAN-BERGMAN 64ae31b5a0
Implements --trusted-ip option (#552)
* Implements --ip-whitelist option

* Included IPWhitelist option to allow one-or-more selected CIDR ranges
  to bypass OAuth2 authentication.
* Adds IPWhitelist, a fast lookup table for multiple CIDR ranges.

* Renamed IPWhitelist ipCIDRSet

* Fixed unessesary pointer usage in ipCIDRSet

* Update CHANGELOG.md

* Update CHANGELOG.md

* Updated to not use err.Error() in printf statements

* Imrpoved language for --ip-whitelist descriptions.

* Improve IP whitelist options error messages

* Clarify options single-host normalization

* Wrote a book about ipCIDRSet

* Added comment to IsWhitelistedIP in oauthproxy.go

* Rewrite oauthproxy test case as table driven

* oops

* Support whitelisting by low-level remote address

* Added more test-cases, improved descriptions

* Move ip_cidr_set.go to pkg/ip/net_set.go

* Add more whitelist test use cases.

* Oops

* Use subtests for TestIPWhitelist

* Add minimal tests for ip.NetSet

* Use switch statment

* Renamed ip-whitelist to whitelist-ip

* Update documentation with a warning.

* Update pkg/apis/options/options.go

* Update CHANGELOG.md

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

* Update pkg/ip/net_set_test.go

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

* Update pkg/ip/net_set_test.go

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

* Update pkg/ip/net_set_test.go

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

* Apply suggestions from code review

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

* fix fmt

* Move ParseIPNet into abstraction

* Add warning in case of --reverse-proxy

* Update pkg/validation/options_test.go

* Rename --whitelist-ip to --trusted-ip

* Update oauthproxy.go

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

* fix

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-07-11 11:10:58 +01:00
Nick Meves e6903d8c1f
Merge pull request #669 from oauth2-proxy/docker-ignore
Reduce docker context to improve build times
2020-07-07 13:43:38 -07:00
Joel Speed 7ffe9b7620
Reduce docker context to improve build times 2020-07-07 20:51:43 +01:00
Mariano Vallés a999270cf3
Add req.host to targetURL when redirecting to https (#668)
* Add req.host to targetURL when redirecting to https

The req.URL.Host might not be present when redirecting to https if the
given req.URL is something like "/". In such scenario, the req.Host is
still present and valid.

This commit adds the original req.Host to the targetURL before returning
the 308 status, to avoid having a `Location: https:///` in the response.

* Bring back empty line

* Wrap the setting of targetURL.Host in a condition

* Add a comment to the test explaining why the redirectURL includes example.com

* Add changelog entry
2020-07-07 09:55:38 +01:00
Joel Speed d29766609b
Merge pull request #660 from oauth2-proxy/request-builder
Use builder pattern to simplify requests to external endpoints
2020-07-06 21:01:55 +01:00
Joel Speed de9e65a63a
Migrate all requests to result pattern 2020-07-06 20:38:00 +01:00
Joel Speed d0b6c04960
Add tests for request result 2020-07-06 20:37:36 +01:00
Joel Speed fbf4063245
Switch Builder.Do() to return a Result 2020-07-06 18:31:31 +01:00
Joel Speed 02410d3919
Update changelog to add request builder entry 2020-07-06 18:31:28 +01:00
Joel Speed 028a0ed62e
Remove old requests code 2020-07-06 18:31:11 +01:00
Joel Speed 53142455b6
Migrate all requests to new builder pattern 2020-07-06 18:31:09 +01:00
Joel Speed 21ef86b594
Add tests for the request builder 2020-07-06 18:29:58 +01:00
Joel Speed 0bc0feb4bb
Add request builder to simplify request handling 2020-07-06 18:29:57 +01:00
Joel Speed 9d39816709
Merge pull request #662 from johejo/issue-661
Do not add Cache-Control header to response from auth only endpoint
2020-07-06 14:33:36 +01:00
Joel Speed 830065a128
Merge branch 'master' into issue-661 2020-07-06 13:39:19 +01:00
Joel Speed efa1e9b448
Merge pull request #663 from Jonher937/patch-1
Make example args a codeblock for OIDC Provider
2020-07-06 12:18:06 +01:00
Mitsuo Heijo 97ab3fa005 update CHANGELOG 2020-07-06 19:09:02 +09:00
Mitsuo Heijo 4c1047866b fix: do not add Cache-Control header to response from auth only endpoint
fix #661
related #453
2020-07-06 19:04:31 +09:00
Jonathan Herlin 416c8b0a5c
Make example args a codeblock
Making this a code block aligns with the rest of the examples and makes it easier to read
2020-07-06 12:04:16 +02:00
Joel Speed 215aeec8b9
Merge pull request #650 from jordancrawfordnz/issue-649
Only set healthcheck user agents when the ping-user-agent is set, and don't check blank user agents against healthcheck user agents
2020-07-06 09:00:13 +01:00
Jordan Crawford 6346dafc1e (#649) Remove blank helthcheck user agents and paths when setting up the healthcheck middleware
A blank user agent is considered == to an empty string. When no -ping-user-agent option is specified, this is considered to be an empty string.

This reveals two problems:
- When no ping-user-agent is specified, main.go sets up a health check user agent of ""
- When no user agent is specified, the empty string is still checked against the health check user agents.

Now the health check middleware ignores blank user agents and paths in order to sanitise it's input to avoid this issue.

Additional tests have been added to verify these situations.
2020-07-06 14:07:38 +12:00
Joel Speed 99481b3a39
Merge pull request #591 from oauth2-proxy/upstream-proxy
Introduce upstream package with new reverse proxy implementation
2020-07-05 20:36:47 +01:00
Joel Speed 37c76b6376
Update changelog to add upstream proxy entry 2020-07-05 10:22:24 +01:00
Joel Speed 5b95ed3033
Add tests for upstream package 2020-07-05 10:21:05 +01:00
Joel Speed fa8e1ee033
Allow file server to handle windows filesystems 2020-07-05 10:21:05 +01:00
Joel Speed e1c3e938cc
Add upstream package with Proxy server implementation 2020-07-05 10:21:05 +01:00
Joel Speed b6b5194190
Add Upstreams options struct with validation 2020-07-05 10:21:05 +01:00
Joel Speed fb1bef2757
Merge pull request #576 from oauth2-proxy/cookie-validation
Separate Cookie validation
2020-07-05 09:35:19 +01:00
Joel Speed 3e13f3197f
Ensure that cookie names over 256 characters are rejected by validation 2020-07-05 09:18:48 +01:00
Joel Speed eb933cc3f4
Add changelog entry for cookie validation separation 2020-07-05 09:18:45 +01:00
Joel Speed 211fd3a010
Rename CookieOptions to Cookie 2020-07-05 09:18:21 +01:00
Joel Speed 285c65a2d4
Add tests for cookie validation
This also removes the check for the decoded from the valid secret size
check. The code was unreachable because encryption.SecretBytes will only
return the decoded secret if it was the right length after decoding.
2020-07-05 09:17:28 +01:00
Joel Speed 900061b88a
Move CookieOptions validation to it's own file 2020-07-05 09:17:28 +01:00
Joel Speed b3ba2594c6
Create Cookie FlagSet and Defaults 2020-07-05 09:17:28 +01:00
Nick Meves 016f4aa276
Merge pull request #656 from grnhse/cookie-splitting-precision
Split cookies more precisely at 4096 bytes
2020-07-04 11:15:07 -07:00
Nick Meves 48a2aaadc1
Count complete cookie content in byte splitting 2020-07-03 23:41:08 -07:00
Nick Meves c6f1daba2f
Split cookies more precisely at 4096 bytes 2020-07-03 20:38:04 -07:00
Joel Speed c4cf15f3e1
Merge pull request #619 from oauth2-proxy/https-redirect-middleware
Improve Redirect to HTTPs behaviour
2020-07-03 17:25:24 +01:00
Joel Speed 1c1106721e
Move RedirectToHTTPS to middleware package
Moves the logic for redirecting to HTTPs to a middleware package and adds tests for this logic.
Also makes the functionality more useful, previously it always redirected to the HTTPS address of the proxy, which may not have been intended, now it will redirect based on if a port is provided in the URL (assume public facing 80 to 443 or 4180 to 8443 for example)
2020-07-03 17:19:09 +01:00
Joel Speed 39c01d5930
Merge pull request #654 from oauth2-proxy/redis-test-client-close
Close client connections after each redis test
2020-07-03 16:43:42 +01:00
Joel Speed 5c8a66bcc9
Close client connections after each redis test 2020-07-03 16:24:47 +01:00
k-wall b0375e85fa
Fix #635: Support specifying alternative provider TLS trust source(s) (#645)
* Fix #635: Support specifying alternative provider TLS trust source(s)

* Update pkg/apis/options/options.go

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

* Update pkg/validation/options.go

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

* Address review comments

* upd CHANGELOG.md

* refactor test to assert textual subjects + add openssl gen cmd

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-07-03 16:09:17 +01:00
Joel Speed 390d479d28
Update CODEOWNERS to request review from reviewers team (#613)
This means that we can keep the list of reviewers up to date based on team membership, rather than this file. Will make it easier to add and remove people going forward
2020-07-02 21:09:55 +01:00
Joel Speed 4313553122
Merge pull request #542 from oauth2-proxy/refactor-session-tests
Move SessionStore tests to independent package
2020-07-01 23:00:23 +01:00
Joel Speed 34137f7305
Move SessionStore tests to independent package 2020-07-01 06:41:35 +01:00
Joel Speed d9a45a3b47
Merge pull request #577 from oauth2-proxy/session-store-cipher
Move Cipher and Session Store initialisation out of Validation
2020-06-28 18:29:48 +01:00
Joel Speed 6e1b3b9660
Switch to in session store initialisation 2020-06-28 12:50:55 +01:00
Joel Speed 778463906a
Update changelog for session storage initialisation move 2020-06-28 12:32:06 +01:00
Joel Speed 5ce9e75c21
Initialise Session Storage in NewOAuthProxy instead of validation 2020-06-28 12:32:06 +01:00
Joel Speed c8dbf1cf60
Move Cipher intialisation to session store initialisation 2020-06-28 12:03:03 +01:00
Joel Speed d9af3ffc5e
Merge pull request #641 from oauth2-proxy/release-v6.0.0
Update changelog ready for release v6.0.0
2020-06-27 16:09:26 +01:00
Joel Speed 6b43b41638
Fix tests broken by security advisory 2020-06-27 12:41:46 +01:00
Joel Speed 25154ede41
Update changelog ready for release v6.0.0 2020-06-27 12:10:27 +01:00
Joel Speed ee5662e0f5
Merge pull request from GHSA-5m6c-jp6f-2vcv
* Add more Open Redirect test cases

* Add whitelisted domain to test

* Add more test cases

* Improve invalid redirect regex
2020-06-27 12:07:24 +01:00
İlteriş Eroğlu 1b6c54cae1
Change how gitlab-group is parsed on options (#639)
* Changed how gitlab-group is parsed, from string to []string

See #637

* Point out that gitlab-group can be a list

See #637

* Reflect to the []string change on pkg/apis/options/options.go

See #637

* Move cfg option gitlab_group to gitlab_groups

See #637

* Renamed Group to Groups

See #637

* Reflect the change on gitlab.go as well

See #637

* Added #639

* Added the author of #639 to the CHANGELOG

* Add the gitlab_groups env change to CHANGELOG.md

See #639

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-06-26 23:26:07 +01:00
Joel Speed daedbbd353
Merge pull request #615 from EvgeniGordeev/helm-example
helm kubernetes example based on kind cluster and nginx ingress
2020-06-26 19:06:50 +01:00
Evgeni Gordeev 054979978f Merge remote-tracking branch 'upstream/master' into helm-example
# Conflicts:
#	CHANGELOG.md
2020-06-25 15:24:00 -05:00
Joel Speed 3686b0b442
Merge pull request #596 from grnhse/extra-jwt-token-session
Verify main vs extra JWT bearers differently
2020-06-25 19:16:49 +01:00
Evgeni Gordeev 88a8a70537 update k8s manifest 2020-06-19 22:33:40 -05:00
Evgeni Gordeev 8bec67beb7 code review comments 2020-06-19 22:27:36 -05:00
Evgeni Gordeev e8fce0b14d Merge remote-tracking branch 'upstream/master' into helm-example
# Conflicts:
#	CHANGELOG.md
2020-06-19 22:25:14 -05:00
Nick Meves a3eef1709a
Improve default CreateSessionStateFromBearerToken tests 2020-06-19 11:48:23 -07:00
Nick Meves c2c1caa404
Set User = Subject in ExtraJWTBearer sessions 2020-06-19 11:48:23 -07:00
Nick Meves 788d8ecc1b
Verify main v extra JWT bearers differently
When using the configured provider JWT Verifier, it makes
sense to use the provider `CreateSessionStateFromBearerToken`
method. For any extra JWT Issuers, they should use a generic
default verifier.
2020-06-19 11:47:36 -07:00
Joel Speed 5817028bb1
Merge pull request #597 from oauth2-proxy/no-log-empty-redirect
Don't log invalid redirect if redirect is empty
2020-06-19 19:40:48 +01:00
Joel Speed dc756b9de3
Don't log invalid redirect if redirect is empty 2020-06-19 18:17:05 +01:00
Joel Speed 713c3927a9
Merge pull request #620 from oauth2-proxy/healthcheck-middleware
Add HealthCheck middleware
2020-06-19 18:15:36 +01:00
Evgeni Gordeev 84360114e2 polish 2020-06-17 19:18:52 -05:00
Evgeni Gordeev fa7855a99d get rid of test-connection pods for hello-world and httpbin 2020-06-16 16:59:56 -05:00
Evgeni Gordeev c85e5297b5 * some polish 2020-06-16 16:47:10 -05:00
Evgeni Gordeev 11c033e2c8 * move httpbin and hello-world charts outside.
* expose kind to 443 port
* make helm optional
* rename folder to kubernetes
2020-06-16 16:39:11 -05:00
Evgeni Gordeev 9a495e996b Merge remote-tracking branch 'upstream/master' into helm-example
# Conflicts:
#	CHANGELOG.md
2020-06-16 16:38:01 -05:00
Joel Speed ba3e40ab1c
Add changelog entry for healthcheck middleware 2020-06-14 21:06:14 +01:00
Joel Speed 9bbd6adce9
Integrate HealthCheck middleware 2020-06-14 21:05:17 +01:00
Joel Speed ca416a2ebb
Add HealthCheck middleware 2020-06-14 21:05:17 +01:00
Evgeni Gordeev 43f214ce8b
Add Keycloak local testing environment (#604)
* Adding one more example - keycloak - alongside with dex IDP.

* don't expose keycloak and proxy ports to the host

* specify email-domain list option in documentation

* get rid of nginx and socat to simplify the example as per https://github.com/oauth2-proxy/oauth2-proxy/pull/604#issuecomment-640054390

* get rid of the scripts - use static file for keycloak startup

* changelog entry

* Update CHANGELOG.md

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-06-14 14:06:12 +01:00
Joel Speed a197a17bc3
Merge pull request #539 from grnhse/encryption-efficiency-improvements
Encryption efficiency improvements
2020-06-14 13:23:14 +01:00
Nick Meves 1979627534
Move Encrypt/Decrypt Into helper to session_state.go
This helper method is only applicable for Base64 wrapped
encryption since it operated on string -> string primarily.
It wouldn't be used for pure CFB/GCM ciphers. After a messagePack
session refactor, this method would further only be used for
legacy session compatibility - making its placement in cipher.go
not ideal.
2020-06-12 14:46:35 -07:00
Nick Meves 014fa682be
Add EncryptInto/DecryptInto Unit Tests 2020-06-12 14:42:42 -07:00
Nick Meves e43c65cc76
Fix SessionOptions struct spacing 2020-06-12 14:37:00 -07:00
Nick Meves c6939a40c5
Move nested Encrypt/Decrypt test to helper function 2020-06-12 14:36:59 -07:00
Nick Meves 9382293b0b
Ensure Cipher.Encrypt doesn't mangle input data []byte 2020-06-12 14:36:59 -07:00
Nick Meves 7bb5fc0a81
Ensure Cipher.Decrypt doesn't mangle input ciphertext []byte 2020-06-12 14:36:59 -07:00
Nick Meves e823d874b0
Improve cipher_test.go organization with subtests 2020-06-12 14:36:59 -07:00
Nick Meves 559152a10f
Add subtests inside of encryption unit test loops 2020-06-12 14:36:59 -07:00
Nick Meves f60e24d9c3
Split non-cipher code to utils.go out of ciphers.go 2020-06-12 14:36:58 -07:00
Nick Meves ce2e92bc57
Improve design of Base64Cipher wrapping other ciphers.
Have it take in a cipher init function as an argument.
Remove the confusing `newCipher` method that matched legacy behavior
and returns a Base64Cipher(CFBCipher) -- instead explicitly ask for
that in the uses.
2020-06-12 14:36:58 -07:00
Nick Meves b6931aa4ea
Add GCM Cipher support
During the upcoming encoded session refactor, AES GCM is ideal
to use as the Redis (and other DB like stores) encryption wrapper
around the session because each session is encrypted with a
distinct secret that is passed by the session ticket.
2020-06-12 14:36:58 -07:00
Nick Meves f7cca1d0b3
Refactor encryption.Cipher to be an Encrypt/Decrypt Interface
All Encrypt/Decrypt Cipher implementations will now take
and return []byte to set up usage in future binary compatible
encoding schemes to fix issues with bloat encrypting to strings
(which requires base64ing adding 33% size)
2020-06-12 14:36:58 -07:00
Nick Meves b4530b9292
Allow binary values in signed cookies
Make signedValue & Validate operate on []byte
by default and not assume/cast string. Any casting
will be done from callers.
2020-06-12 14:36:58 -07:00
Nick Meves f9025a8f8f
Add binary native AES CFB encryption helpers.
These will take in []byte and not automatically
Base64 encode/decode.
2020-06-12 14:36:56 -07:00
Evgeni Gordeev 363eaf1fac changelog entry 2020-06-12 13:55:38 -05:00
Evgeni Gordeev dbf1b451d9 polish 2020-06-12 13:15:43 -05:00
Evgeni Gordeev a73d0ec268
Merge branch 'master' into helm-example 2020-06-12 13:14:15 -05:00
Evgeni Gordeev 0f343cf0ad helm kubernetes example based on kind cluster 2020-06-12 13:12:59 -05:00
Joel Speed 1683aa5978
Merge pull request #601 from oauth2-proxy/fix-fallback
Ensure decrypted user/email are valid UTF8
2020-06-12 15:47:33 +01:00
Joel Speed 808084b744
Ensure decrypted user/email are valid UTF8 2020-06-12 15:36:55 +01:00
Christopher Kohnert 2c851fcd4f
Allow a health/ping request to be identified by User-Agent (#567)
* Add an option to allow health checks based on User-Agent.

* Formatting fix

* Rename field and avoid unnecessary interface.

* Skip the redirect fix so it can be put into a different PR.

* Add CHANGELOG entry

* Adding a couple tests for the PingUserAgent option.
2020-06-12 14:56:31 +01:00
Joel Speed 160bbaf98e
Fallback to UserInfo is User ID claim not present (#560)
Co-authored-by: Henry Jenkins <henry@henryjenkins.name>
2020-06-04 17:41:29 +01:00
Scott Guymer 3aeca4368c
ACR values should not be automatically added when blank (#598)
* ACR values should not be automatically added when blank

* Added changelog
2020-06-02 18:17:27 +01:00
Yoshiki Nakagawa d8d43bb51b
Support new option "github-user" (#421)
* feat(github): support new option "github-user"

* feat(github): rename github-user to github-users

* feat(github): update docs for github-users option

* feat(github): remove unneeded code

* feat(github): remove logging

* feat(github-user): use github-user as flagset options

* feat(github-user): remove optionns.go

* feat(github-user): add github-user flagset

* feat(github): improve readability in the docs

* feat(github-user): refactored SetUsers method

* Update flag description

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-06-01 20:02:07 +01:00
Joel Speed a17c48810f
Merge pull request #548 from oauth2-proxy/move-logging-options
Separate logging options out of main options structure
2020-05-31 14:15:18 +01:00
Joel Speed 94e31f8b65
Ensure exclude-logging-paths is consistent with other options 2020-05-31 14:09:28 +01:00
Joel Speed f7c88f53d1
Update changelog for logging options move 2020-05-31 14:09:24 +01:00
Joel Speed bbc4eee17e
Create Logging FlagSet and Default 2020-05-31 14:08:00 +01:00
Joel Speed 3cbac6122d
Move configuration of logger to separate file 2020-05-31 14:08:00 +01:00
Joel Speed 3afcadae76
Move logging options to a struct 2020-05-31 14:08:00 +01:00
Joel Speed f7b28cb1d3
Improvements to Session State code (#536)
* Drop SessionStateJSON wrapper
* Use EncrpytInto/DecryptInto to reduce sessionstate

Co-authored-by: Henry Jenkins <henry@henryjenkins.name>
2020-05-30 08:53:38 +01:00
Amnay 6a88da7f7a
Parse Redis cluster and sentinel urls (#573)
* Parse Redis cluster and sentinel urls

* Add changelog entry for #573

* Add unit tests for redis session store

* Use %v for error fmt

Co-authored-by: Amnay Mokhtari <amnay.mokhtari@adevinta.com>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-05-27 18:40:50 +01:00
Joel Speed 11c8a983c8
Merge pull request #582 from oauth2-proxy/dependabot/bundler/docs/activesupport-6.0.3.1
Bump activesupport from 6.0.2.1 to 6.0.3.1 in /docs
2020-05-27 10:03:56 +01:00
dependabot[bot] d1bab0e22e
Bump activesupport from 6.0.2.1 to 6.0.3.1 in /docs
Bumps [activesupport](https://github.com/rails/rails) from 6.0.2.1 to 6.0.3.1.
- [Release notes](https://github.com/rails/rails/releases)
- [Changelog](https://github.com/rails/rails/blob/v6.0.3.1/activesupport/CHANGELOG.md)
- [Commits](https://github.com/rails/rails/compare/v6.0.2.1...v6.0.3.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-05-27 08:55:47 +00:00
Joel Speed 03a0e1a0e3
Merge pull request #414 from ti-mo/cookie-secret-cipher-xauthrequest
Always encrypt sessions regardless of configuration
2020-05-24 21:27:22 +01:00
Timo Beckers 276d1c6f19
Always encrypt sessions regardless of configuration 2020-05-24 21:23:04 +01:00
Amnay 0c9795a964
render error page on 502 proxy status (#574)
Co-authored-by: Amnay Mokhtari <amnay.mokhtari@adevinta.com>
2020-05-24 21:09:00 +01:00
Joel Speed 810a9e9967
Rename cookie-domain config to cookie-domains (#559)
Co-authored-by: Henry Jenkins <henry@henryjenkins.name>
2020-05-24 20:19:56 +01:00
Isabelle COWAN-BERGMAN fc11d8d508
Updated autocompletion for `--` long options. (#569)
* Updated autocompletion for `--` long options.

* Added CHANGELOG.md entry.
2020-05-24 17:12:28 +01:00
Joel Speed a0085e9015
Add changelog entry for 489 (#572) 2020-05-23 18:49:09 +01:00
Joel Speed 236c7fa60e
Merge pull request #489 from oauth2-proxy/move-options
Move Options and Validation to packages
2020-05-23 15:59:29 +01:00
Joel Speed cce2c680d8
Move RealClientIP code to IP packages 2020-05-23 15:17:41 +01:00
Joel Speed c3f9cbeb3d
Remove Env tags from Cookie and Session Options 2020-05-21 22:43:42 +01:00
Joel Speed 189ed4de8f
Move FlagSet to Options package 2020-05-21 22:43:42 +01:00
Joel Speed 1fd4ebe546
Remove Env tags from Options 2020-05-21 22:43:42 +01:00
Joel Speed 44b27e0208
Move Options and Validation to package 2020-05-21 22:43:42 +01:00
Amnay de0c92af06
fix small typo in docs (#570)
Co-authored-by: Amnay Mokhtari <amnay.mokhtari@adevinta.com>
2020-05-21 21:24:25 +01:00
Nick Meves 7e5c8bb579
Fix secretBytes adding unintended padding (#556)
* Fix secretBytes adding unintended padding

* Add more SecretBytes test scenarios

* Add CHANGELOG entry about breaking secret padding change

* Add SecretBytes tests explanation comments
2020-05-21 19:29:45 +01:00
Nick Meves d228d5a928
Refactor the utils package to other areas (#538)
* Refactor the utils package to other areas

Move cookieSession functions to cookie session store
& align the double implementation of SecretBytes to be
united and housed under encryption

* Remove unused Provider SessionFromCookie/CookieForSession

These implementations aren't used, these are handled in the cookie store.

* Add changelog entry for session/utils refactor
2020-05-14 10:16:35 +01:00
Isabelle COWAN-BERGMAN 111d17efde
Implements --real-client-ip-header option. (#503)
* Implements -real-client-ip-header option.

* The -real-client-ip-header determines what HTTP header is used for
  determining the "real client IP" of the remote client.
* The -real-client-ip-header option supports the following headers:
  X-Forwarded-For X-ProxyUser-IP and X-Real-IP (default).
* Introduces new realClientIPParser interface to allow for multiple
  polymorphic classes to decide how to determine the real client IP.
* TODO: implement the more standard, but more complex `Forwarded` HTTP
  header.

* Corrected order of expected/actual in test cases

* Improved error message in getRemoteIP

* Add tests for getRemoteIP and getClientString

* Add comment explaining splitting of header

* Update documentation on -real-client-ip-header w/o -reverse-proxy

* Add PR number in changelog.

* Fix typo repeated word: "it"

Co-Authored-By: Joel Speed <Joel.speed@hotmail.co.uk>

* Update extended configuration language

* Simplify the language around dependance on -reverse-proxy

Co-Authored-By: Joel Speed <Joel.speed@hotmail.co.uk>

* Added completions

* Reorder real client IP header options

* Update CHANGELOG.md

* Apply suggestions from code review

Co-authored-by: Isabelle COWAN-BERGMAN <Izzette@users.noreply.github.com>

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
Co-authored-by: Henry Jenkins <henry@henryjenkins.name>
2020-05-12 18:41:25 +01:00
Joel Speed d0cfca4b73
Merge pull request #529 from oauth2-proxy/test-environment
Add local test environments for testing changes and new features
2020-05-12 16:19:27 +01:00
Joel Speed 2e37da4dc4
Update changelog for test environment addition 2020-05-12 16:07:17 +01:00
Joel Speed afef9c7588
Add nginx test environment to demonstrate protecting multiple subdomains 2020-05-12 16:06:17 +01:00
Joel Speed 0ccfc73ab2
Add test environment docker-compose files 2020-05-12 16:06:16 +01:00
Joel Speed 4e3dd09cf2
Drop fallback to email when user is empty (#537) 2020-05-12 16:04:51 +01:00
John Clayton 7cf685140b
Restrict access using Github collaborators (#497)
* Allow access based on Github repository
2020-05-11 18:02:40 +01:00
Mitsuo Heijo e642daef4e Support context in providers (#519)
Co-authored-by: Henry Jenkins <henry@henryjenkins.name>
2020-05-10 13:34:59 +01:00
Joel Speed 53d8e99f05
Remove Syscll as a maintainer (#540) 2020-05-10 11:51:15 +01:00
Joel Speed de280824de
Drop support for pre v3.1 cookies (#535)
Co-authored-by: Henry Jenkins <henry@henryjenkins.name>
2020-05-10 10:09:53 +01:00
Joel Speed 24cdfa68b6
Set up code coverage within Travis for Code Climate (#533)
* Set up code coverage within Travis for Code Climate
* Include CodeClimate badges on ReadMe
2020-05-10 07:29:37 +01:00
n-i-x be9eaaeb48
Add basic string functions to templates (#514)
* Add basic string functions to templates

Co-authored-by: Oliver <oliver006@users.noreply.github.com>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
Co-authored-by: Henry Jenkins <henry@henryjenkins.name>
2020-05-09 21:05:51 +01:00
Nick Meves 9d626265e8 Migrate cookie signing to SHA256 from SHA1 (#524)
Also, cleanup the code & make the specific
hashing algorithm chosen a function variable.

Co-authored-by: Henry Jenkins <henry@henryjenkins.name>
2020-05-09 16:14:19 +01:00
Joel Speed 07df29db37
Drop configure script in favour of native Makefile env and checks (#515)
Co-authored-by: Henry Jenkins <henry@henryjenkins.name>
2020-05-09 16:07:46 +01:00
Henry Jenkins 9ed5a43516
Use double dashes in docs (#530)
We only supports double dash (`--`) now, so update docs to reflect this.
2020-05-09 15:39:47 +01:00
Joel Speed 8d3de2dc75
Tidy changelog and update releases to v5.1.1 (#526) 2020-05-06 19:00:12 +01:00
Joel Speed 0d5fa211df
Merge pull request from GHSA-j7px-6hwj-hpjg 2020-05-06 12:42:02 +01:00
Oliver 36da6e2be9
Add Gitea to auth config docs (#510)
* add gitea to auth config docs

* PR feedback

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-05-04 21:59:09 +01:00
Joel Speed f7c050e7ba
Switch flags to PFlag to remove StringArray (#487) 2020-05-03 16:55:20 +01:00
Joel Speed eae652d986
Merge pull request #484 from oauth2-proxy/cookie-options-rename
Replace configuration loading with Viper
2020-05-03 12:14:17 +01:00
Joel Speed 00fed1a31f
Return an error when unknown options are found in the config file 2020-04-29 20:00:16 +01:00
Joel Speed c5be09ca48
Replace options loading with viper 2020-04-29 19:51:24 +01:00
Joel Speed 8749cbb424
Add Viper based config loader 2020-04-29 19:51:24 +01:00
Joel Speed e49f8542bc
Rename Session Options to improve structure 2020-04-29 19:51:24 +01:00
Joel Speed 458710149c
Rename Cookie Options to remove extra 'Cookie' 2020-04-29 19:51:24 +01:00
Grey Baker 842d764a5f
Add code scanning workflow (#507) 2020-04-29 16:29:30 +01:00
Christian Schyma e27f7e0bcb
typo fixed (#505) 2020-04-28 14:35:42 +01:00
Jakub Holy 1961424561
Feature/configurable userid claim minimal (#499)
* Add -user-id-claim to support other claims than email

Fix #431 - This is a minimal change to allow the user to configure which claim is
the source of the "user ID".

- Add the option `user-id-claim` (defaults to email)
- OIDC extracts this claim into session.Email (to be renamed later)
- providers: add `CreateSessionStateFromBearerToken` with a default impl taken from
  `GetJwtSession` and overridden by oidc to respect `user-id-claim`

Once #466 is merged, I can continue to rename SessionState.Email to .UserID
and add HTTP headers with a corresponding name.

* Apply suggestions from code review

Co-Authored-By: Joel Speed <Joel.speed@hotmail.co.uk>

* Review feedback: Don't extract claims manually

Instead, parse them twice - it might be sligtly slower but less bug-prone as the code evolves.

* Fix indentation

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-04-28 07:46:46 +01:00
yaroslavros 4d21b8a04f
Make sure websockets respect ssl-upstream-insecure-skip-verify setting. (#494)
* Make sure websockets respect ssl-upstream-insecure-skip-verify setting.

Signed-off-by: Yaroslav Rosomakho <yaroslavros@gmail.com>

* Updated changelog for websockets taking into account ssl-upstream-insecure-skip-verify

Signed-off-by: Yaroslav Rosomakho <yaroslavros@gmail.com>

Co-authored-by: Henry Jenkins <henry@henryjenkins.name>
2020-04-19 17:41:29 +01:00
Christopher Kohnert c6294c40a3
Allow the OIDC issuer verification to be skipped if desired. (#467)
* Allow the OIDC issuer verification to be skipped if desired.

* Remove stale warning

* Add CHANGELOG entry

Co-authored-by: Henry Jenkins <henry@henryjenkins.name>
Co-authored-by: Dan Bond <pm@danbond.io>
2020-04-19 12:19:21 +01:00
Henry Jenkins 6fa3d6c74c
Merge pull request #488 from oauth2-proxy/fix-set-basic-default
Set-Basic-Auth should default to false
2020-04-16 10:27:56 +01:00
Dan Bond 5fc6bd0e6f
Merge branch 'master' into fix-set-basic-default 2020-04-14 09:37:11 +01:00
Mitsuo Heijo dd05e7ff0b
Add new linters (#486)
* add new linters and fix issues

* fix deprecated warnings

* simplify return

* update CHANGELOG

* fix staticcheck issues

* remove a deprecated linter, minor fixes of variable initialization
2020-04-14 09:36:44 +01:00
Joel Speed 581475feec
Set-Basic-Auth should default to false 2020-04-13 14:57:24 +01:00
Henry Jenkins 4341ab4420
Merge pull request #483 from oauth2-proxy/split-warning
Warn users when session cookies are split
2020-04-12 12:36:37 +01:00
Joel Speed fcd52e042e
Warn users when session cookies are split 2020-04-12 12:01:38 +01:00
Eric Dahlseng a659b9558e
Allow multiple cookie domains to be specified (#412)
* Allow multiple cookie domains to be specified

* Use X-Forwarded-Host, if it exists, when selecting cookie domain

* Perform cookie domain sorting in config validation phase

* Extract get domain cookies to a single function

* Update pkg/cookies/cookies.go

Co-Authored-By: Joel Speed <Joel.speed@hotmail.co.uk>

* Update changelog

Co-authored-by: Marcos Lilljedahl <marcosnils@gmail.com>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-04-12 12:00:44 +01:00
Mitsuo Heijo 7f72a22227
feature: switch Azure AD graph API to Microsoft Graph API (#440)
* feature: switch Azure AD graph API to Microsoft Graph API

* Update CHANGELOG

* Expand Breaking Changes notice

* Update CHANGELOG.md

Co-Authored-By: Joel Speed <Joel.speed@hotmail.co.uk>

* fix: use constant http method

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-04-12 11:53:30 +01:00
Moraru Costel b0b87563dc
Add set basic auth param (#413)
* addint redirect capability to sign_out

* updating changelog

* Add a new param to set the Authorization header to up-stream systems as Basic user:password

* Resolving code review

* mutual exclusiv changes for Basic and Bearer Authorization header

* Fixed the merge mixup and comment error

* Updated changelog and fixed typo

* Adding the new entry in changelog

Co-authored-by: Costel Moraru <costel.moraru-germany@ibm.com>
2020-04-10 14:41:28 +01:00
Mitsuo Heijo 7efc162aaa
Prevent browser caching during auth flow (#453)
* Prevent browser caching during auth flow

* simplify no-cache logic, add tests and update changelog

* checking noCacheHeaders does not exists in response headers from upstream

* remove unnecessary codes

* add no-cache headers in SignInPage and OAuthStart for proxy mode

https://github.com/oauth2-proxy/oauth2-proxy/pull/453#discussion_r405072222
2020-04-09 15:39:07 +01:00
Trevor Box 7c3efe4f42
Update okta doc (#481)
* updated Okta docs and added localhost example

* add changelog entry

* added pull request # to changelog

Co-authored-by: tbox <tbox@redhat.com>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-04-08 21:28:00 +01:00
Josh Bielick f9f98cb3a7
print full error message when non-api error (#474)
when type asserting fails here, err is reassigned with nil and the
default block of the switch prints out <nil> in the error message. This
makes debugging a configuration or access token issue difficult

The particular error this surfaces is:

Response: {
  "error": "unauthorized_client",
  "error_description": "Client is unauthorized to retrieve access tokens using this method, or client not authorized for any of the scopes requested."
}

Signed-off-by: Josh Bielick <jbielick@gmail.com>
2020-04-06 09:27:24 +01:00
Mitsuo Heijo c7bfbdecef
Implement graceful shutdown and propagate request context (#468)
* feature: Implement graceful shutdown

Propagate the request context to the Redis client.
It is possible to propagate a context cancel to Redis client if the connection is closed by the HTTP client.
The redis.Cmdable cannot use WithContext, so added the Client interface to handle redis.Client and redis.ClusterClient transparently.

Added handling of Unix signals to http server.

Upgrade go-redis/redis to v7.

* Update dependencies

- Upgrade golang/x/* and google-api-go
- Migrate fsnotify import from gopkg.in to github.com
- Replace bmizerany/assert with stretchr/testify/assert

* add doc for  wrapper interface

* Update CHANGELOG.md

* fix: upgrade fsnotify to v1.4.9

* fix: remove unnessary logging

* fix: wait until  all connections have been closed

* refactor: move chan to main for testing

* add assert to check if stop chan is empty

* add an idiomatic for sync.WaitGroup with timeout
2020-04-04 16:12:38 +01:00
Siim Tiilen bdc686103e
Allow html in banner message (#462)
* allow html in banner message

* Fix changelog (move under new version)
2020-04-04 15:01:11 +01:00
Phil Taprogge 3f7837b955
Add logging in case of invalid redirects (#471)
* Add logging in case of invalid redirects

* update changelog

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-04-02 09:51:38 +01:00
Christopher J. Ruwe eb31850470
clarify the nginx auth_request_set/set problem with proxy_pass (#454)
* clarify the nginx auth_request_set/set problem with proxy_pass

* reworded/extended as result of review
2020-04-01 20:06:33 +01:00
Joel Speed c02d560bf4
Merge pull request #432 from oauth2-proxy/update-deps
Update ruby dependencies for documentation
2020-03-29 17:41:58 +01:00
Theo 8641bc4738
Update docs deps 2020-03-29 17:34:17 +01:00
Joel Speed c0fb7e81fc
Merge pull request #464 from oauth2-proxy/migration
Migrate to oauth2-proxy/oauth2-proxy
2020-03-29 16:32:39 +01:00
Joel Speed f832eb1446
Update changelog and readme to reflect migration 2020-03-29 16:24:41 +01:00
Joel Speed 802754caad
Migrate to oauth2-proxy/oauth2-proxy 2020-03-29 15:40:10 +01:00
Joel Speed 4cdedc8f50
Merge pull request #463 from pusher/release-5.1.0
Update Changelog for Release 5.1.0
2020-03-29 13:41:30 +01:00
Joel Speed 9dcd8255bf
Update CHANGELOG for v5.1.0 release 2020-03-29 13:19:38 +01:00
Joel Speed 8d69d55de4
Update Go and GolangCI-Lint 2020-03-29 13:17:54 +01:00
Mitsuo Heijo 362cdf7713
Fix http.Cookie SameSite is not copied. (#450)
* fix: http.Cookie SameSite is not copied.

* Update CHANGELOG.md
2020-03-17 18:48:52 +00:00
Jakub Holy 3108f765a5
Fix #381, expose acr_values to all providers (#445) 2020-03-17 17:57:33 +00:00
Mariusz Strzelecki 4eef21cf3d
Bitbucket Auth Provider docs (#447)
* Bitbucket Auth Provider docs

* Typo fixed
2020-03-16 11:39:12 +00:00
Erico Fusco 4d7349f9c6
Update CHANGELOG.md (#446)
Fix PR link for #435
2020-03-16 10:14:38 +00:00
Mitsuo Heijo 81b9a63e51
Support Go 1.14 (#419)
* Upgrade base image tags and golangci-lint

* Upgrade golang and golangci-lint in travis-ci

* fix:  tests, pointed out by golangci-lint and format files

* Upgrade dependencies

* update changelog

* fix: tests related to https://github.com/pusher/oauth2_proxy/pull/418

* Separate tests using go version build tags

* Update CHANGELOG

* Revert "Separate tests using go version build tags"

This reverts commit 9b7e65eb90cae954dc7b6316345d3207205d488a.

* fix test to support go1.14 and go1.13

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-03-14 10:14:15 +00:00
Jakub Holy 400aea3653
Document how to use the sign_out endpoint (#443)
Fixes #441

+ a minor link fix
2020-03-14 10:07:23 +00:00
Wolfgang Richter fad6fff16d
Cleaned up source to make golangci-lint pass (#418)
* cleaned up source to make golangci-lint pass

* providers/azure_test.go: use build in POST constant

* options_test.go: do not export unnecessary variables

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-03-14 09:58:29 +00:00
Jakub Holy b1c81e2abe
Support prompt in addition to auth-prompt (#444)
Fix #380
2020-03-14 09:53:43 +00:00
Jakub Holy 0fc4131c72
configuration.md: clarify CLI -> config options (#442)
Clarify how to rename CLI options to be able to set them in the config file. I have just spent an hour trying to find out why `whitelist_domain="..."` does not work :-)

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-03-13 20:21:15 +00:00
Erico Fusco 8d0149ccf8
Fix issue with group validation called on every request (#435)
* Revert group validation on every request

* Fix syntax

* Remove unit tests associated with reverted change

* Update CHANGELOG
2020-03-13 20:10:38 +00:00
Joel Speed e3fb25efe6
Merge pull request #434 from jordancrawfordnz/pass-user-headers-prefer-email
Support the PreferEmailToUser option on PassUserHeaders
2020-03-08 15:31:34 +00:00
Jordan Crawford 4cd43ef397 Support the PreferEmailToUser option on PassUserHeaders
Previously in #401, an option was added to support forwarding the email
address as the username to the upstream service when the PassBasicAuth
option is used.

The PassBasicAuth option is not appropriate for all users, with PassUserHeaders
allowing very similar functionality without specifying a basic auth headers.

The PreferEmailToUser option has been expanded to support the PassUserHeaders
option.
2020-03-04 11:47:13 +13:00
Joel Speed 666d4c3db1
Merge pull request #430 from pusher/stale-action
Add GitHub Action to tidy stale issues
2020-03-02 10:34:51 +00:00
Dan Bond d94cf45ea8
Update .github/workflows/stale.yml
Co-Authored-By: Theo Barber-Bany <theo.barberbany@pusher.com>
2020-03-02 10:09:58 +00:00
Dan Bond 8ee8bd8bc2
Update .github/workflows/stale.yml
Co-Authored-By: Theo Barber-Bany <theo.barberbany@pusher.com>
2020-03-02 10:09:52 +00:00
Joel Speed 85891a2261
Add GitHub Action to tidy stale issues 2020-03-01 15:59:52 +00:00
Felix Fontein d934309b44
Add preferred_username support (OIDC provider) (#420)
* Add support for preferred username.

* Add missing TOC entries.

* Add note about preferred_username support.

* Adjust tests.

* Check on not implemented error for GetPreferredUsername() call.

Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-03-01 15:02:51 +00:00
ume 0bca3564b5
Fix to work with python 3 (#427)
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-02-29 18:13:49 +00:00
D. Spindel 51f4d88028
Add option to prefer an Email address to a Username (#401)
With some providers the Username is an upstream Unique ID, like fex. in the
case of Google.

When matching this with downstream databases, it's sometimes preferred to use
the email address as the  known identifier.

However, when _mixing_ this with sometimes other sources, like htaccess, which
doesn't have a concept of an email address, it can turn difficult.

This change makes the headers _prefer_ to use the Email address, if such exists,
for the Username identifier when passing data to downstream services.

Defaults to Off.

Signed-off-by: D.S. Ljungmark <ljungmark@modio.se>

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-02-29 17:38:32 +00:00
dependabot[bot] 0c7400a924
Bump nokogiri from 1.10.4 to 1.10.8 in /docs (#422)
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.10.4 to 1.10.8.
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
- [Changelog](https://github.com/sparklemotion/nokogiri/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.10.4...v1.10.8)

Signed-off-by: dependabot[bot] <support@github.com>
2020-02-28 18:26:40 +00:00
Timo Beckers 907de4e141
Use OAuthProxy.GetRedirect in /sign_in, honoring the 'rd' query parameter (#405)
* Use OAuthProxy.GetRedirect in /sign_in, honoring the 'rd' query parameter

* CHANGELOG.md - Add a changelog entry for #405
2020-02-28 09:59:27 +00:00
Luke Tainton 4f553bcfc8
Add nsswitch.conf to Docker image (#400)
* Add nsswitch.conf to Docker image

Created nsswitch.conf to use locally defined translations before DNS. Copied to /etc/nsswitch.conf in the image.

* Add new line

* Updated Changelog

Co-authored-by: Dan Bond <danbond@protonmail.com>
2020-02-23 18:16:18 +00:00
Jakub Holy bd79b976da
Docs: Fix link to sessions.md (#403) 2020-02-19 13:20:07 +00:00
Nir Aizik edd6ad6ae5
Add client-secret-file to main FlagSet (#399) 2020-02-17 14:21:04 +00:00
Iain Buclaw 2033ce81c3
Implement ValidateSessionState for GitHubProvider (#385)
Refactors the setting of the Authorization header into getGitHubHeader.

Refs #382

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-02-15 15:11:14 +00:00
Jakub Holy 7a6204c8fd
Fix #384 - link to sessions.md (#391)
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-02-15 14:41:35 +00:00
Pavel Kirichenko f2661c47ba
Support for client secret file. (#355)
* added ClientSecretFile in ProviderData

* add documentation notes on client secret file

* added Changelog entry for Client Secret File PR

* fixing configuration.md

* addressing PR issue of ClientSecret property naming

* Update providers/provider_data.go

Co-Authored-By: Joel Speed <Joel.speed@hotmail.co.uk>

* corrected changelog entry

* fixed typo in GetClientSecret

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-02-15 13:44:39 +00:00
Devin Nemec 3a843f815d
GitHub Provider - Fallback to secondary verified email (#372)
* Fallback to secondary verified email

* Add change to changelog
2020-02-15 13:36:28 +00:00
Ben Letton 10adb5c516
Support optional id_tokens in refresh responses (#335)
* OIDC Token Refresh works without id_tokens

Addresses https://github.com/pusher/oauth2_proxy/issues/318

Refactoring the OIDC provider so that the refresh process works when there are
no id_tokens present in the response. Added unit tests to the oidc_test.go to prove
the redeem and refresh still work.

The expiry time of the session is now taken from the outh token expiry and not
the id_token (preventing stale access_tokens in sessions).

* Refactoring the to use a KeySetStub in the oidc_test.go. This allows the
elimination of the slightly contrived function passing elements used
previously. (This change is being applied to address the bug #318)

* Changes as per the PR comments and preparing for 5.x release

* Fixup changelog

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-02-06 18:09:30 +00:00
Yan Yao 18d20364a8
Extension of Redis Session Store to Support Redis Cluster (#363)
* Extend the redis session store to support redis cluster

* rename function newRedisClient to newRedisCmdable

* update docs about redis cluster as session store

* update autocomplete script with redis cluster options

* add check about conflict between option redis-use-sentinel and redis-use-cluster

* update change log

* Update docs/configuration/sessions.md

Co-Authored-By: Joel Speed <Joel.speed@hotmail.co.uk>

* Update pkg/sessions/redis/redis_store.go

Co-Authored-By: Joel Speed <Joel.speed@hotmail.co.uk>

* add the dropped option back

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-02-06 17:59:12 +00:00
Nick Watts 3ae261031e
Add sign_out endpoint to endpoint documentation page (#383) 2020-02-05 16:28:51 +00:00
Jakub Holy 61007250f2
lates version is v5 not v4 (#379) 2020-02-03 15:39:14 +00:00
Felix Fontein 9670f54dd0
Fix login page fragment handling after soft reload on Firefox (#353)
* Fix login page fragment handling after soft reload on Firefox.

* Add comments.

* Move changelog entry to correct place.

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
Co-authored-by: Felix Fontein <felix@fontein.de>
2020-01-31 11:11:15 +00:00
David Stark c49d3628cd
Merge pull request #368 from pusher/advisory-notes
Open redirect (security vulnerability) notes
2020-01-29 12:56:42 +00:00
David Stark 3b0e8c3cb3
Open redirect (security vulnerability) notes 2020-01-29 12:45:19 +00:00
David Stark a316f8a06f
Merge pull request from GHSA-qqxw-m5fj-f7gv
check for /\ redirects
2020-01-29 12:37:58 +00:00
David Stark e21f09817e
note about open redirect vulneravility 2020-01-29 12:36:11 +00:00
David Stark 8c765779b5
Merge branch 'master' into advisory-fix-1 2020-01-29 12:24:42 +00:00
David Stark fc59a6d683
Merge pull request #367 from pusher/feature/changelog-release-5
Release 5.0.0 / changelog update
2020-01-29 12:15:43 +00:00
David Stark c32a7d8e2c
Release v5.0.0
Changelog updated
2020-01-29 12:10:03 +00:00
David Stark 5c8220d085
Merge pull request #365 from tomelliff/remove-cgo-from-release-builds
Disable cgo on release builds, will add this to the changelog for next release
2020-01-29 11:47:53 +00:00
Tom Elliff 1d808a47d1 Disable cgo on release builds
Tries to link against libc which isn't present in musl based distributions (such as Alpine Linux).

Closes https://github.com/pusher/oauth2_proxy/issues/329
2020-01-28 09:05:04 +00:00
David Stark 0198dd6e93
check for /\ redirects 2020-01-26 15:09:07 +00:00
Martin Campbell d9362d3bb9 Add reverse proxy setting (#331)
* Add reverse proxy setting (#321)
2020-01-24 17:54:13 +00:00
Joel Speed 79a0759c10
Merge pull request #358 from pusher/JoelSpeed-codeowners
Add @JoelSpeed to CODEOWNERS
2020-01-23 14:25:28 +00:00
Joel Speed cfc2daa220
Merge pull request #361 from nawa/fix-linting
Fix linting error about const
2020-01-22 12:18:01 +00:00
siarhei.navatski dec3647669
Fix linting error about const 2020-01-22 13:57:00 +03:00
Joel Speed 14db073807
Add JoelSpeed to CODEOWNERS 2020-01-20 19:39:31 +00:00
Joel Speed 5f86ea5c75
Merge pull request #357 from pusher/dependabot/bundler/docs/rubyzip-2.0.0
Bump rubyzip from 1.2.2 to 2.0.0 in /docs
2020-01-20 19:34:46 +00:00
dependabot[bot] a7672c82bc
Bump rubyzip from 1.2.2 to 2.0.0 in /docs
Bumps [rubyzip](https://github.com/rubyzip/rubyzip) from 1.2.2 to 2.0.0.
- [Release notes](https://github.com/rubyzip/rubyzip/releases)
- [Changelog](https://github.com/rubyzip/rubyzip/blob/master/Changelog.md)
- [Commits](https://github.com/rubyzip/rubyzip/compare/v1.2.2...v2.0.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-01-20 19:28:58 +00:00
Joel Speed ec72ee8bf1
Merge pull request #339 from clubhouse/pgroudas/add-samesite-cookie-options
Add SameSite cookie configuration value for session cookie
2020-01-20 19:24:23 +00:00
Joel Speed 17d9961cb9
Merge branch 'master' into pgroudas/add-samesite-cookie-options 2020-01-20 19:21:51 +00:00
Joel Speed 038ee169bd
Merge pull request #280 from kamaln7/kamal/whitelist-redirects-with-ports
Allow redirects to whitelisted hosts with ports
2020-01-15 14:44:10 +00:00
Dan Bond 11cc396059
Merge branch 'master' into kamal/whitelist-redirects-with-ports 2020-01-15 14:03:17 +00:00
Kamal Nasser eee4b55e0f DigitalOcean Auth Provider (#351)
* DigitalOcean provider

* documentation: digitalocean provider

* changelog: digitalocean provider

* codeowners: digitalocean provider
2020-01-15 11:09:34 +00:00
Dan Bond 625909e445
Merge branch 'master' into kamal/whitelist-redirects-with-ports 2020-01-10 09:48:25 +00:00
sushiMix f94dee6f0d Update keycloak provider configuration doc (#347)
* update keycloak provider configuration doc

* Add changelog entry
2020-01-10 09:41:08 +00:00
Kamal Nasser 5489d1624e
Merge branch 'master' into kamal/whitelist-redirects-with-ports 2020-01-08 22:24:56 +02:00
Paul Groudas afb7247ad5 Add item to CHANGELOG for SameSite configuration. 2020-01-06 12:21:52 -05:00
Paul Groudas 5d0827a028 Add configuration for cookie 'SameSite' value.
Values of 'lax' and 'strict' can improve and mitigate
some categories of cross-site traffic tampering.

Given that the nature of this proxy is often to proxy
private tools, this is useful to take advantage of.

See: https://www.owasp.org/index.php/SameSite
2020-01-06 12:21:52 -05:00
Paul Groudas 90f8117fba Fix typos in doc strings. 2019-12-20 11:27:10 -05:00
Joel Speed 7663565cd3
Merge pull request #332 from pusher/fix-changelog
Fix changelog entry release
2019-12-17 13:35:35 +00:00
Joel Speed effe1e0bdb
Fix changelog entry release 2019-12-17 12:17:05 +00:00
Joel Speed bb55b13242
Merge pull request #179 from Ramblurr/nextcloud-provider
Add nextcloud provider
2019-12-17 11:58:46 +00:00
Joel Speed 3a8b33a017
Merge branch 'master' into nextcloud-provider 2019-12-17 11:56:43 +00:00
Joel Speed 1fb6fb8173
Merge pull request #326 from thought-machine/release-notes
Add notes on how to create a release
2019-12-17 10:45:47 +00:00
Henry Jenkins 8602aa4f13
Update RELEASE.md 2019-12-16 16:13:51 +00:00
Henry Jenkins b8bfa226dd
Update README.md
Co-Authored-By: Joel Speed <Joel.speed@hotmail.co.uk>
2019-12-16 16:08:44 +00:00
Henry Jenkins 61137f67a9
Update RELEASE.md 2019-12-10 17:56:14 +00:00
Henry Jenkins c5ae0afea9
Merge branch 'master' into release-notes 2019-12-10 17:54:27 +00:00
hjenkins 28d64c90d9 Add notes on how to create a release 2019-12-10 17:50:34 +00:00
Dan Bond ef8b7b5e25
dist.sh: use sha256sum (#325)
* dist.sh: use sha256sum

* update CHANGELOG
2019-12-10 17:24:15 +00:00
Dan Bond 8165f6c483
Update CHANGELOG for v4.1.0 (#323) 2019-12-10 16:34:33 +00:00
Florian Kaiser f6790265e1 dist.sh: Add build for FreeBSD (#317) 2019-11-26 16:38:22 +00:00
Casey Link 227ea5da44 Add Nextcloud provider (#179) 2019-11-25 18:47:21 +01:00
Felix Fontein 11205c7399 Allow to change provider's name (#296)
* Allow to change provider's name.

* Add changelog entry.

* Linting.

* provider-name -> provider-display-name.

* Add flag in main.go.

* Update CHANGELOG.md
2019-11-25 17:20:37 +00:00
Moraru Costel ca0b8375da Add redirect capability to sign_out (#314)
* addint redirect capability to sign_out

* updating changelog
2019-11-19 17:17:26 +00:00
Joel Speed 68abf7b2d8
Merge pull request #265 from cgroschupp/feat/static-upstream
Add upstream with static response
2019-11-19 15:01:44 +00:00
Christian Groschupp 6d74a42e57
Merge branch 'master' into feat/static-upstream 2019-11-19 12:23:42 +01:00
Joel Speed 5c9a0f8308 Fixup Changelog entries (#312) 2019-11-15 04:02:09 -08:00
Kamal Nasser 6d1b5fc4b0
Merge branch 'master' into kamal/whitelist-redirects-with-ports 2019-11-14 17:19:21 +02:00
Kamal Nasser 898b6b81c9 remove unnecessary if conditional 2019-11-14 17:17:12 +02:00
Joel Speed 9fdb8acec6
Merge pull request #274 from toshi-miura/ap-gh-pagination-with-lastpage
Added pagination support for /user/teams github api with link header .
2019-11-14 14:26:02 +00:00
Joel Speed 6326660699
Merge branch 'master' into ap-gh-pagination-with-lastpage 2019-11-14 14:21:45 +00:00
Joel Speed 9f920b0fc1
Merge pull request #309 from lleszczu/customCaForRedis
Add support for Redis with custom CA.
2019-11-12 16:30:32 +00:00
Lukasz Leszczuk 06a283e581 Fix settings naming 2019-11-12 16:11:27 +01:00
Lukasz Leszczuk befab0521a log message in case of failure during loading system cert pool 2019-11-12 11:42:49 +01:00
Łukasz Leszczuk d7a51e4aab
Update main.go
Co-Authored-By: Joel Speed <Joel.speed@hotmail.co.uk>
2019-11-12 11:34:14 +01:00
Lukasz Leszczuk 3c10aee62c Code formatting. Add missing CHANGELOG entry. 2019-11-09 13:57:40 +01:00
Lukasz Leszczuk 3f7ed36e46 Add support for Redis with custom CA. 2019-11-08 10:47:18 +01:00
Konstantine fef940da9a Added userinfo endpoint (#300)
* Added userinfo endpoint

* Added documentation for  the userinfo endpoint

* Update oauthproxy.go

Co-Authored-By: Dan Bond <pm@danbond.io>

* Suggested fixes :  Streaming json to rw , header set after error check

* Update oauthproxy.go

Co-Authored-By: Dan Bond <pm@danbond.io>

* fix session.Email

* Ported tests and updated changelog
2019-11-07 14:38:36 -08:00
Kimball Leavitt 2a07983a36 Add bash completion script (#307)
* added bash completion script

* added install instructions for bash completion
2019-11-05 18:39:10 -08:00
Christian Groschupp 9e4a7ee84e
Merge branch 'master' into feat/static-upstream 2019-11-01 17:34:27 +01:00
Joel Speed 004b74332b
Merge pull request #304 from pusher/logos
Add new Logo! 🎉
2019-10-30 12:02:51 +00:00
Joel Speed 0df5a77c53
Update changlog 2019-10-30 10:25:51 +00:00
Joel Speed bb8b6c0d51
Add logo to ReadMe 2019-10-30 10:04:41 +00:00
Joel Speed acb0d3ab79
Add logo to docs site 2019-10-30 10:04:29 +00:00
Joel Speed 14601093c4
Add logos to docs folder 2019-10-30 09:57:24 +00:00
Dan Bond f40dab8748 Rewrite dist script (#302)
* Rewrite dist scripts

* add changelog entry

* remove multiple loops in dist

* styling
2019-10-29 17:27:08 +00:00
Dan Bond ba21c90c7a
fix broken changelog link (#301)
* fix broken changelog link

* Update CHANGELOG.md
2019-10-28 10:42:43 -07:00
Johannes-Maria Frank 292d2dc639 Added version check for bash version gteq 4 (#292)
* Added version check for bash version gteq 4

* Added entry to CHANGELOG for bash 4.0 configure script dependency

* Corrected changelog entry to right format

* Fixed link in changelog entry

* Remove uneeded new line.
2019-10-28 09:39:22 -07:00
Joel Speed 572654a27b
Merge pull request #297 from syscll/docs-configuration-grammar
fix bad grammar in upstreams configuration docs
2019-10-26 15:05:54 +01:00
Dan Bond 90a6915ab1 fix bad grammar in upstreams configuration docs 2019-10-25 13:47:28 -07:00
toshi-miura eb89047e3a
Merge branch 'master' into ap-gh-pagination-with-lastpage 2019-10-24 11:23:15 +09:00
Tom Deadman 35f2ae9a36 Improved request errors (#286)
* worked on wrapping errors in requests.go, added defer statements

* removed .idea (generated by goland)

* added another require.NoError

* Update pkg/requests/requests.go

Co-Authored-By: Dan Bond <pm@danbond.io>

* fixed out-of-order imports

* changelog entry added

* swapped error definitions to use fmt.Errorf rather than Wrap()

* formatting changes, added new defers to requests_test.go

* suppot for go1.12 pipeline removed from travis pipeline, .idea/ added to gitignore

* Reorder changelog entry
2019-10-23 09:55:34 -07:00
Kamal Nasser 1af7c208ee Update documentation and changelog 2019-10-23 16:48:16 +03:00
Kamal Nasser 3a84033989
Merge branch 'master' into kamal/whitelist-redirects-with-ports 2019-10-23 16:41:04 +03:00
Kamal Nasser a12bae35ca update port whitelisting rules, refactor IsValidRedirect tests 2019-10-23 16:38:44 +03:00
Joel Speed 6b8d2bdcc3
Merge pull request #285 from jmickey/Issue#259-RedirectToHTTPS
Redirect to HTTPS
2019-10-22 14:46:42 +01:00
Josh Michielsen c0bfe0357a
Confirm that the proto is not empty, and change condition to OR
Co-Authored-By: Joel Speed <Joel.speed@hotmail.co.uk>
2019-10-22 14:21:06 +01:00
Josh Michielsen fe9efba0c5
Documentation change
Co-Authored-By: Joel Speed <Joel.speed@hotmail.co.uk>
2019-10-22 14:19:39 +01:00
Josh Michielsen 8d1a4c527f
Merge branch 'master' into Issue#259-RedirectToHTTPS 2019-10-21 23:23:48 +01:00
Josh Michielsen dcc430f6f1 Check `X-Forwared-Proto` for https (via another reverse proxy)
Signed-off-by: Josh Michielsen <github@mickey.dev>
2019-10-21 23:21:35 +01:00
Joel Speed 535f6b8e63
Merge branch 'master' into ap-gh-pagination-with-lastpage 2019-10-21 10:21:10 +01:00
toshi-miura e34f18ef2c
Update CHANGELOG.md
Co-Authored-By: Joel Speed <Joel.speed@hotmail.co.uk>
2019-10-21 18:14:01 +09:00
Dan Bond 9d0a0c7426
remove unnecessary validator tests (#288)
* remove unnecessary validator tests

* fix WriteString error
2019-10-18 08:49:33 -07:00
Josh Michielsen 052451edef Merge branch 'Issue#259-RedirectToHTTPS' of github.com:jmickey/oauth2_proxy into Issue#259-RedirectToHTTPS 2019-10-17 22:20:21 +01:00
Josh Michielsen 56d195a433 Docs and changelog
Signed-off-by: Josh Michielsen <github@mickey.dev>
2019-10-17 22:20:15 +01:00
Josh Michielsen 9cecc01aac
Merge branch 'master' into Issue#259-RedirectToHTTPS 2019-10-17 22:13:07 +01:00
Josh Michielsen bed0336608 Add SSL check and test no redirect when HTTPS
Signed-off-by: Josh Michielsen <github@mickey.dev>
2019-10-17 22:04:24 +01:00
Joel Speed 86977f7c7f
Merge pull request #258 from leyshon/feature/azure-idtoken
Add IDToken for Azure provider
2019-10-17 20:49:08 +01:00
Josh Michielsen 271efe776e Added tests
Signed-off-by: Josh Michielsen <github@mickey.dev>
2019-10-17 16:37:36 +01:00
Josh Michielsen aae91b0ad6 Add new handler to redirect to HTTPS if flag is set
Signed-off-by: Josh Michielsen <github@mickey.dev>
2019-10-17 16:30:48 +01:00
Josh Michielsen e24e4ef880 Add force-https option and flag
Signed-off-by: Josh Michielsen <github@mickey.dev>
2019-10-17 16:30:18 +01:00
leyshon c3cdcae49b
Merge branch 'master' into feature/azure-idtoken 2019-10-14 11:04:04 +01:00
Alex e04411a789 Update README - add more badges (#281) 2019-10-13 15:33:18 -07:00
Kamal Nasser ae4e9155d2 implicit/explicit redirect port matching 2019-10-12 23:47:23 +03:00
toshi-miura 610ee6d0ec Fix typo. 2019-10-12 02:30:58 +09:00
Kamal Nasser bfb22506ff allow redirects to whitelisted hosts with ports 2019-10-11 15:39:57 +03:00
Joel Speed eb1d64a666
Merge branch 'master' into ap-gh-pagination-with-lastpage 2019-10-11 12:02:31 +01:00
toshi-miura 0d256a329f add change log. 2019-10-11 19:49:08 +09:00
toshi-miura e71797b409 ReadAll() & Close()  close together. 2019-10-11 16:02:04 +09:00
Christian Groschupp f570fb9f58
Update changelog 2019-10-10 10:15:04 +02:00
Christian Groschupp 3d17159c5c
replace getRootEndpoint by getEndpointWithCookie 2019-10-10 10:14:01 +02:00
Christian Groschupp a46ee952a6
Move responceCode out of HandleFunc. 2019-10-10 10:14:01 +02:00
Christian Groschupp dc36836800
Add tests for static upstream 2019-10-10 10:14:01 +02:00
Christian Groschupp 1295f87b33
Add static upstream 2019-10-10 10:14:00 +02:00
toshi-miura 31d7b61cc4 Added handling of link header in githubAPI paging process
======================================================
changelog note

[#274](https://github.com/pusher/oauth2_proxy/pull/274)  Add github api pagination support (@toshi-miura ,@apratina)

======================================================

I didn't edit CHANGELOG.md.
Since # 102 was taken over and the change difference of CHANGELOG.md was large
2019-10-10 05:35:00 +09:00
Christian Franke 62bf233682 Update CONTRIBUTING.md (#277)
Commit e245ef4854 switched dependency management from dep to go module.

This should be reflected in `CONTRIBUTING.md`.
2019-10-09 09:57:59 -07:00
Joel Speed 1afaf46656
Merge pull request #276 from sosiska/patch-1
Some code improvements
2019-10-09 17:41:36 +01:00
Kirill Motkov e64e6fa514 Some code improvements
* Remove shadowing of predeclared identifier: new.
* strings.ReplaceAll instead of strings.Replace with -1.
* Change strings.ToLower comparison to strings.EqualFold.
* Rewrite if-else-if-else chain as a switch.
2019-10-09 15:44:26 +03:00
Joel Speed 63da5c64db
Merge pull request #275 from syscll/debian-buster
docker: build from debian buster
2019-10-08 11:22:36 +01:00
Dan Bond 486521da96 fix previous CHANGELOG error 2019-10-07 17:11:38 -07:00
Dan Bond a97710d3d2 update CHANGELOG 2019-10-07 17:11:14 -07:00
Dan Bond e270dd0066 docker: build from debian buster 2019-10-07 17:03:15 -07:00
Dhi Aurrahman de16df232d Support Go 1.13.x and allow to override REGISTRY (#273)
Signed-off-by: Dhi Aurrahman <dio@tetrate.io>
2019-10-07 13:53:46 -07:00
leyshon ef22a0f4b6
Merge branch 'master' into feature/azure-idtoken 2019-10-04 13:32:29 +01:00
Joel Speed ac10bc04ed
Merge pull request #272 from pusher/fix-links
Fix permalinks for configuration and sessions
2019-10-03 17:19:37 +01:00
toshi-miura 1c36b5e2e9 Merge branch 'ap-gh-paginate' of https://github.com/apratina/oauth2_proxy into ap-gh-pagination-with-lastpage 2019-10-03 22:34:56 +09:00
leyshon 0b2eb91fa4
Update docs/2_auth.md
Co-Authored-By: Joel Speed <Joel.speed@hotmail.co.uk>
2019-10-03 11:46:04 +01:00
Joel Speed b515b90b34
Fix permalinks for configuration and sessions 2019-10-03 11:10:06 +01:00
leyshon d8d4c687df
Merge branch 'master' into feature/azure-idtoken 2019-10-02 10:33:08 +01:00
Joel Speed 49f1320be6
Merge pull request #269 from YenTheFirst/escape-k8s-auth-signin
Escape original request URI in sample kubernetes ingress configuration
2019-10-02 09:33:54 +01:00
T S 513af9b714 Escape original request URI in sample kubernetes ingress configuration
The current sample configuration for kubernetes ingress demonstrates
using the `auth-signin` annotation to redirect a user to oauth2_proxy's
signin page. It constructs the link to do so by directly concatenating
`$request_uri` as the `rd` parameter, so the sign-in page knows where to
send the user after signin is complete.

However, this does not work correctly if the original request URI
contains multiple query parameters separated by an ampersand, as that
ampersand is interpereted as separating query parameters of the
`/oauth2/start` URI. For example:

If the user requests a URL:
  https://example.com/foo?q1=v1&q2=v2
they may be redirected to the signin url
  https://example.com/oauth2/start?rd=https://example.com/foo?q1=v1&q2=v2
and after completing signin, oauth2_proxy will redirect them to
  https://example.com/foo?q1=v1

nginx-ingress added an $escaped_request_uri variable about a year ago,
to help resolve this kind of issue
(https://github.com/kubernetes/ingress-nginx/pull/2811)
2019-10-01 12:28:00 -07:00
Joel Speed 721d28bd4f
Merge pull request #248 from VidAngel/support-x-auth-request-redirect
More fully support X-Auth-Request-Redirect header
2019-09-30 17:53:26 +01:00
Joel Speed ac0d010371
Merge branch 'master' into support-x-auth-request-redirect 2019-09-30 17:21:05 +01:00
Joel Speed 44cdcc79c3
Merge pull request #227 from Ofinka/keycloak-provider
Add keycloak provider
2019-09-25 21:39:11 +01:00
Dan Bond a122ac60e4
Fix CHANGELOG errors 2019-09-25 13:33:58 -07:00
Dan Bond 85a1ed5135
Merge branch 'master' into keycloak-provider 2019-09-25 13:21:46 -07:00
Ian Hunter 8098094fc2 Merge branch 'master' of github.com:pusher/oauth2_proxy into support-x-auth-request-redirect 2019-09-19 11:27:27 -05:00
Ian Hunter 18a77e6618 Reflect #248 PR in CHANGELOG.md 2019-09-19 11:26:18 -05:00
leyshon 1aad87d7ca Fixing a small typo in the docs 2019-09-02 16:03:48 +01:00
leyshon 21aba50ea5 Adding a note to the Azure provider documentation to mention issues with the size of the cookie session storage 2019-09-02 16:00:28 +01:00
leyshon b4afbae0d3 Merge branch 'feature/azure-idtoken' of github.com:leyshon/oauth2_proxy into feature/azure-idtoken 2019-09-02 15:18:14 +01:00
leyshon 41ed9f7429 Updating the changelog to include details of the change 2019-09-02 14:56:20 +01:00
leyshon eb5a31e48f
Merge branch 'master' into feature/azure-idtoken 2019-08-29 15:43:18 +01:00
leyshon 311f14c7eb Fixing linting errors: Making sure err is checked in azure_test and gofmt has been run 2019-08-29 15:37:25 +01:00
leyshon 0c541f6f5e Adding additional asserts to the TestAzureProviderREdeemReturnsIdToken to ensure that the refresh token and expires on date are both being set 2019-08-29 15:01:15 +01:00
leyshon c8a89eca08 Adding the IDToken to the session for the Azure Provider. 2019-08-29 14:32:01 +01:00
Nelson Menezes 82a3d5afdc Add clarification about plural env vars (#252) 2019-08-27 09:15:33 -07:00
Joel Speed 6683e35008
Merge pull request #250 from pusher/dependabot/bundler/docs/nokogiri-1.10.4
Bump nokogiri from 1.10.1 to 1.10.4 in /docs
2019-08-21 11:09:48 +01:00
dependabot[bot] b83b7565f3
Bump nokogiri from 1.10.1 to 1.10.4 in /docs
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.10.1 to 1.10.4.
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
- [Changelog](https://github.com/sparklemotion/nokogiri/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.10.1...v1.10.4)

Signed-off-by: dependabot[bot] <support@github.com>
2019-08-21 10:05:52 +00:00
Ian Hunter a209a52df1 More fully support X-Auth-Request-Redirect header
Docs showed that the X-Auth-Request-Redirect header can specify a redirect URI, but only the rd POST parameter was being honored
This fixes that.
2019-08-17 15:50:44 -05:00
Henry Jenkins 71dfd44149
Merge branch 'master' into keycloak-provider 2019-08-17 08:10:37 +01:00
Joel Speed d00c14a2a7
Merge pull request #247 from pusher/release-v4.0.0
Update changelog for v4.0.0 release
2019-08-16 15:19:32 +01:00
Joel Speed 44ea6920a7
Update changelog for v4.0.0 release 2019-08-16 15:06:53 +01:00
aledeganopix4d fa6c4792a1 Add Bitbucket provider. (#201)
Add a new provider for Bitbucket,
can be configured from the options
specifying team and/or repository
that the user must be part/have access
to in order to grant login.
2019-08-16 14:53:22 +01:00
Joel Speed a165928458
Merge pull request #226 from continusec/makeheadersettingdeterministic
Made setting of proxied headers deterministic based on configuration alone
2019-08-16 14:41:14 +01:00
Adam Eijdenberg d5d4878a29 Made setting of proxied headers deterministic based on configuration
alone

Previously some headers that are normally set by the proxy (and may be
replied upstream for authorization decisiions) were not being set
depending on values in the users sesssion.

This change ensure that if a given header is sometimes set, it will
always be either set or removed.

It might be worth considerating always deleting these headers if we
didn't add them.
2019-08-16 11:44:43 +10:00
Joel Speed c4559ea372
Merge pull request #241 from thought-machine/fix-docs-links
Fix links in docs
2019-08-15 12:07:37 +01:00
Henry Jenkins a65d38d181
Merge branch 'master' into fix-docs-links 2019-08-14 12:04:23 +01:00
Henry Jenkins 57851f6850
Merge pull request #239 from bradym/docFormat
Docs only:  format Command Line Options using a table
2019-08-14 12:03:03 +01:00
Joel Speed 7e3ad6b215
Merge branch 'master' into docFormat 2019-08-14 11:12:54 +01:00
Henry Jenkins c941f3ce0d
Merge branch 'master' into fix-docs-links 2019-08-13 21:23:45 +01:00
Henry Jenkins 9240538939
Merge pull request #244 from ferhatelmas/typo-fix
Fix some typos
2019-08-13 21:23:18 +01:00
Brady Mitchell 272fb96024 add back nginx-auth-request <a name 2019-08-13 09:12:48 -07:00
Brady Mitchell bc5fc5a513 remove unnecessary <a> tags 2019-08-13 09:01:38 -07:00
Dan Bond 49e124eb87
Merge branch 'master' into typo-fix 2019-08-13 16:25:23 +01:00
Dan Bond 6453e78db3
Merge branch 'master' into docFormat 2019-08-13 16:22:18 +01:00
Joel Speed b167744b0a
Merge pull request #145 from rtluckie/feature/add_oidc_userinfo_support
Add OIDC support for UserInfo Endpoint Email Verification
2019-08-13 15:35:51 +01:00
ferhat elmas fb52bdb90c Fix some typos 2019-08-13 12:42:23 +02:00
Ryan Luckie c457eeb711
Merge branch 'master' into feature/add_oidc_userinfo_support 2019-08-12 17:32:29 -05:00
Brady Mitchell 9938bb95d9
Merge branch 'master' into docFormat 2019-08-11 17:23:33 -07:00
Brady Mitchell 4b985992d8 add missing header border 2019-08-11 17:21:32 -07:00
Henry Jenkins 8b61559b8d Fix links in docs
- Fixed a bunch of references to the repo, which were 404ing
- Fixed a couple of things that 301/302ed
- Fixed some in page references
2019-08-11 16:07:03 +01:00
Henry Jenkins e1b70dc9f0
Merge pull request #240 from vitaliytv/patch-1
[docs] Fix link to oauth2_proxy.cfg
2019-08-11 15:20:58 +01:00
Vitalii Tverdokhlib 9e37de53e3
docs: fix path to oauth2_proxy.cfg 2019-08-11 14:55:19 +03:00
Brady Mitchell 18156713e3 indent content in ordered list, fixes 165 2019-08-10 21:46:13 -07:00
Brady Mitchell 14c25c1d8a use a table for command line options 2019-08-10 21:45:18 -07:00
Joel Speed a91cce7ab9
Merge pull request #238 from thought-machine/fix-typo
Fix typos in changelog
2019-08-07 19:36:03 +01:00
hjenkins 02dfa87f11 Fix typos in changelog 2019-08-07 18:00:37 +01:00
jansinger 7134d22bcc New flag "-ssl-upstream-insecure-skip-validation" (#234)
* New flag "-ssl-upstream-insecure-skip-validation" to skip SSL validation for upstreams with self generated / invalid SSL certificates.

* Fix tests for modified NewReverseProxy method.

* Added change to the changelog.

* Remove duplicate entries from changelog.
2019-08-07 17:48:53 +01:00
mikesiegel d85660248c Adding docs for how to configure Okta for the OIDC provider (#235)
* Adding documentation for Okta OIDC provider.

* additional clean up.

* Clearer heading

* Forgot a word.

* updated documentation based on ReillyProcentive review.

* Per steakunderscore review: removed defaults. Removed extra hardening steps (expiration, https only etc) not directly related to setting up Okta w/ OIDC
2019-08-07 11:57:18 +01:00
Henry Jenkins 64672c34eb
Merge pull request #236 from thought-machine/slack
Adds reference to slack channel in readme
2019-08-06 12:47:10 +01:00
Dan Bond c3eac4f6d4
Merge branch 'master' into slack 2019-08-06 12:23:45 +01:00
Alexander Overvoorde 4de49983fb Rework GitLab provider (#231)
* Initial version of OIDC based GitLab provider

* Add support for email domain check to GitLab provider

* Add gitlab.com as default issuer for GitLab provider

* Update documentation for GitLab provider

* Update unit tests for new GitLab provider implementation

* Update CHANGELOG for GitLab provider

* Rename GitLab test access token as response to linter
2019-08-06 12:20:54 +01:00
hjenkins 5f9a65f6b1 Adds reference to slack channel in readme 2019-08-06 12:16:03 +01:00
Justin Palpant 7d910c0ae8 Check Google group membership with hasMember and get. (#224)
* Check Google group membership with hasMember and get.

This PR is an enhancement built on
https://github.com/pusher/oauth2_proxy/pull/160. That PR reduces the
number of calls to the Google Admin API and simplifies the code by
using the hasMember method. It also supports checking membership in
nested groups.

However, the above message doesn't handle members who are not a part
of the domain. The hasMember API returns a 400 for that case. As a
fallback, when the API returns a 400, this change will try using the
`get` API which works as expected for members who aren't a part of the
domain. Supporting members who belong to the Google group but aren't
part of the domain is a requested feature from
https://github.com/pusher/oauth2_proxy/issues/95.

https://developers.google.com/admin-sdk/directory/v1/reference/members/get

Note that nested members who are not a part of the domain will not be
correctly detected with this change.

* Update CHANGELOG.

* Fix incorrect JSON and stop escaping strings.

* Add comments for each scenario.
2019-08-06 10:38:24 +01:00
Henry Jenkins 69c723af81
Merge pull request #232 from ReillyBrogan/fix-changelog-typos
[DOCS] Fix a bunch of places where the repo link was incorrect
2019-08-05 11:28:21 +01:00
Joel Speed a882788efb
Merge branch 'master' into fix-changelog-typos 2019-08-05 11:17:28 +01:00
Joel Speed 88a7f9f483
Merge pull request #233 from steakunderscore/remove-dep
Remove dep from Travis CI & pre-install modules
2019-08-05 09:44:16 +01:00
hjenkins 8a24dd797f Download modules in travis install step 2019-08-05 09:26:42 +01:00
Henry Jenkins d346219293 Remove dep from Travis CI
Was missed from previous switch to go modules
2019-08-04 21:24:21 +01:00
Reilly Brogan 1ab63304a1 Fix a bunch of places where the repo link was incorrect 2019-08-03 13:22:42 -05:00
Karel Pokorny 436936836d Fix typo in env tag 2019-07-31 14:39:34 +02:00
Karel Pokorny a025228a6d Set env tag appropriately 2019-07-31 14:36:13 +02:00
Karel Pokorny 4eab98e65b Fix travis analysis 2019-07-28 16:58:11 +02:00
Karel Pokorny 53524875d1 Get rid of dependencies on bitly/oauth2_proxy/api 2019-07-28 16:46:16 +02:00
Karel Pokorny 800a3694c2 Add docs and record in CHANGELOG 2019-07-28 16:26:09 +02:00
Karel Pokorny 583ec18fa2 Add keycloak provider 2019-07-28 15:54:39 +02:00
Joel Speed 3f219bd85c
Merge pull request #225 from pusher/fix-codeowners
Fix CODEOWNERS file
2019-07-24 09:37:15 +01:00
Joel Speed 23309adc7c
Fix CODEOWNERS file 2019-07-24 09:21:08 +01:00
Joel Speed 6c4aca957e
Merge pull request #223 from pusher/maintainers
Add MAINTAINERS and update CODEOWNERS
2019-07-23 16:45:32 +01:00
Joel Speed e48d28d1b9
Add MAINTAINERS and update CODEOWNERS 2019-07-23 16:20:45 +01:00
Ryan Luckie 4a6b703c54 Update CHANGELOG 2019-07-19 09:03:01 -05:00
Ryan Luckie 93cb575d7c Fix error message for clarity 2019-07-19 08:59:29 -05:00
Ryan Luckie f537720b52 fix lint errors 2019-07-19 08:57:05 -05:00
Ryan Luckie 122ec45dd8 Requested changes 2019-07-19 08:55:14 -05:00
Ryan Luckie 0d94f5e515 fix lint error 2019-07-19 08:53:20 -05:00
Ryan Luckie 2eecf756e4 Add OIDC support for UserInfo Endpoint Email Verification
* Current OIDC implementation asserts that user email check must come
from JWT token claims. OIDC specification also allows for source
of user email to be fetched from userinfo profile endpoint.
http://openid.net/specs/openid-connect-core-1_0.html#UserInfo

* First, attempt to retrieve email from JWT token claims.  Then fall back to
requesting email from userinfo endpoint.

* Don't fallback to subject for email

https://github.com/bitly/oauth2_proxy/pull/481
2019-07-19 08:53:20 -05:00
Joel Speed 8635391543
Merge pull request #178 from kskewes/pinglog
Add silence-ping-logging flag
2019-07-19 11:30:31 +01:00
Karl f29e353586
Update options.go
Co-Authored-By: Joel Speed <Joel.speed@hotmail.co.uk>
2019-07-19 22:11:53 +12:00
Joel Speed 2c104c4e7d
Merge pull request #211 from steakunderscore/go-mod
Switch from dep to go modules
2019-07-17 10:21:09 +01:00
Joel Speed 7bf00b7f4a
Merge pull request #213 from pusher/fix-tls-flags
Correct TLS Flags broken in #186
2019-07-17 10:10:18 +01:00
Joel Speed 7b1132df13
Fix tls-*-file docs 2019-07-17 09:58:11 +01:00
Karl Skewes 6bf3f2a51b
Correct tls cert flag name per 186 2019-07-16 13:32:57 +01:00
Karl Skewes f00a474d91 Correct tls cert flag name per 186 2019-07-16 11:39:06 +12:00
Karl Skewes b57d7f77e1 Use ok naming convention for map presence check 2019-07-16 10:06:29 +12:00
Karl Skewes 84da3c3d8c update changelog with both flags 2019-07-16 10:06:29 +12:00
Karl Skewes 9ed5623f2a Change env vars to suit incoming PR186 2019-07-16 10:05:10 +12:00
Karl Skewes 7236039b9d remove remnant from rebase 2019-07-16 10:04:09 +12:00
Karl Skewes 289dfce28a logger.go ExcludedPaths changed to slice of paths.
- `logger.go` convert slice of paths to map for quicker lookup
- `options.go` combines csv paths and pingpath into slice
2019-07-16 10:04:09 +12:00
Karl Skewes 4e10cc76e0 Add silence ping logging flag using ExcludePath
- Add `ping-path` option to enable switching on and passing to `logger.go`
  Default remains unchanged at: `"/ping"`
- Add note in configuration.md about silence flag taking precedence

Potential tests:
- `options.go` sets `logger.SetExcludePath` based on silence flag?
- Changing `PingPath` reflected in router?
2019-07-16 09:46:53 +12:00
Karl Skewes 08021429ea formatting and extra test
Can probably slim down the `ExcludePath` tests.
2019-07-16 09:43:48 +12:00
Karl Skewes c4f20fff3d Add exclude logging path option
Useful for excluding /ping endpoint to reduce log volume.
This is somewhat more verbose than a simple bool to disable logging of
the `/ping` endpoint.

Perhaps better to add `-silence-ping-logging` bool flag to `options.go` and
pass in the `/ping` endpoint as part of `logger` declaration in `options.go`.

Could be extended into a slice of paths similar to go-gin's `SkipPaths`:
https://github.com/gin-gonic/gin/blob/master/logger.go#L46
2019-07-16 09:43:47 +12:00
Karl Skewes ec97000169 Add silence ping logging flag
Add ability to silence logging of requests to /ping endpoint, reducing
log clutter

Pros:
- Don't have to change all handlers to set/not set silent ping logging
- Don't have to duplicate `loggingHandler` (this could be preferable yet)

Cons:
- Leaking oauth2proxy logic into `package logger`
- Defining default pingPath in two locations

Alternative:
- Add generic exclude path to `logger.go` and pass in `/ping`.
2019-07-16 09:42:24 +12:00
Henry Jenkins 03f218a63c Ensure gomodules are used when downloading 2019-07-15 21:49:38 +01:00
Henry Jenkins bc81a0f6e4 Merge branch 'master' into go-mod
* master:
  Move docker dep commands to earlier in the build
2019-07-15 21:38:55 +01:00
Joel Speed e952ab4bdf
Merge pull request #209 from dekimsey/improve-docker-rebuild-caching
Move docker dep commands to earlier in the build
2019-07-15 16:09:22 +01:00
Henry Jenkins 56f51417ae
Merge branch 'master' into go-mod 2019-07-15 16:08:21 +01:00
Daniel Kimsey 816c2a6da9 Move docker dep commands to earlier in the build
This will let Docker cache the results of the vendor dependencies.
Making re-builds during testing faster.

Also clean-up spurious test & rm in ./configure
2019-07-15 10:00:34 -05:00
Joel Speed d7e88a4718
Merge pull request #186 from pusher/consistent-config
Make configuration consistent
2019-07-15 15:35:11 +01:00
Joel Speed 874c147e04
Fix tls-key-file and tls-cert-file consistency 2019-07-15 12:01:44 +01:00
Joel Speed bdcdfb74f9
Update docs and changelog 2019-07-15 12:01:43 +01:00
Joel Speed f0d006259e
Ensure all options use a consistent format for flag vs cfg vs env 2019-07-15 11:59:46 +01:00
Joel Speed 6311fa2950
Merge pull request #187 from pusher/refactor
Move root packages to pkg folder
2019-07-15 11:43:50 +01:00
Joel Speed 630db3769b
Merge branch 'master' into refactor 2019-07-15 11:30:43 +01:00
Joel Speed 4bc0a91e2e
Merge pull request #210 from steakunderscore/alpine-3-10
Update to Alpine 3.10
2019-07-15 11:25:12 +01:00
Henry Jenkins 179ee6c2db Update CHANGELOG 2019-07-14 13:51:46 +01:00
Henry Jenkins e92e2f0cb4 Update CHANGELOG 2019-07-14 13:32:37 +01:00
Henry Jenkins 27bdb194b1 Update to Alpine 3.10 2019-07-13 22:14:05 +01:00
Henry Jenkins c98ff79aba Update other docker files 2019-07-13 22:12:20 +01:00
Henry Jenkins e245ef4854 Switch from dep to go mod
Update modules to avoid issues with golangci-lint
2019-07-13 21:54:45 +01:00
Joel Speed a83c5eabb6
Merge pull request #159 from djfinlay/wip/allow-unverified-email
Create option to skip verified email check in OIDC provider
2019-07-11 16:38:17 +01:00
Daryl Finlay 9823971b7d Make insecure-oidc-allow-unverified-email configuration usage consistent 2019-07-11 15:58:31 +01:00
Daryl Finlay 776d063b98 Update changelog to include --insecure-oidc-allow-unverified-email 2019-07-11 15:30:57 +01:00
Daryl Finlay 39b6a42d43 Mark option to skip verified email check as insecure 2019-07-11 15:29:48 +01:00
Daryl Finlay 018a25be04 Create option to skip verified email check in OIDC provider 2019-07-11 15:29:48 +01:00
Joel Speed ecd0f89c84
Merge pull request #206 from nniikkoollaaii/feature/update_docs_nginx_auth_request
update configuration.md auth_request section
2019-07-10 09:38:21 +01:00
Seip, Nikolai 387a7267e1 update configuration.md auth_request section 2019-07-10 10:26:31 +02:00
Joel Speed 4eefc01600
Merge pull request #195 from steakunderscore/banner-flag
Adds banner flag
2019-07-04 11:24:16 +01:00
Henry Jenkins aa37564655
Merge branch 'master' into banner-flag 2019-07-02 14:03:21 +01:00
Joel Speed 85c5cef783
Merge pull request #198 from steakunderscore/switch_to_golangci-lint
Switch linter to golangci-lint
2019-07-01 16:37:26 +01:00
hjenkins ce7e384095 Remove TODO vetshadow as it's part of govet 2019-07-01 16:27:19 +01:00
Henry Jenkins b9cfa8f49f Add changelog entry 2019-06-25 16:42:24 +01:00
Henry Jenkins 924eab6355 Adds banner flag
This is to override what's displayed on the main page.
2019-06-25 16:41:51 +01:00
Henry Jenkins 5bcb998e6b Update changelog 2019-06-23 21:39:13 +01:00
Henry Jenkins d24aacdb5c Fix lint errors 2019-06-23 21:39:13 +01:00
Henry Jenkins 411adf6f21 Switch linter to golangci-lint 2019-06-23 20:44:16 +01:00
Joel Speed 317f09f41e
Merge pull request #65 from lsst/jwt_bearer_passthrough
JWT bearer passthrough
2019-06-21 15:40:34 +01:00
Brian Van Klaveren 3881955605 Update unit tests for ValidateGroup 2019-06-20 16:57:20 -07:00
Brian Van Klaveren bd651df3c2 Ensure groups in JWT Bearer tokens are also validated
Fix a minor auth logging bug
2019-06-20 13:40:04 -07:00
Brian Van Klaveren 058ffd1047 Update unit tests for username 2019-06-17 13:11:49 -07:00
Brian Van Klaveren 5a50f6223f Do not infer username from email 2019-06-17 12:58:40 -07:00
Brian Van Klaveren 100f126405 Make JwtIssuer struct private 2019-06-17 12:52:44 -07:00
Brian Van Klaveren 2f6dcf3b5f Move refreshing code to block acquiring cookied session 2019-06-17 12:52:44 -07:00
Brian Van Klaveren 48dbb391bc Move around CHANGELOG.md update 2019-06-17 12:52:44 -07:00
Brian Van Klaveren 54d91c69cc Use logger instead of log 2019-06-17 12:52:13 -07:00
Brian Van Klaveren 350c1cd127 Use JwtIssuer struct when parsing 2019-06-17 12:52:13 -07:00
Brian Van Klaveren 58b06ce761 Fall back to using sub if email is none (as in PR #57) 2019-06-17 12:52:13 -07:00
Brian Van Klaveren 79acef9036 Clarify skip-jwt-bearer-tokens default and add env tags 2019-06-17 12:52:13 -07:00
Brian Van Klaveren 10f65e0381 Add a more realistic test for JWT passthrough 2019-06-17 12:52:13 -07:00
Brian Van Klaveren 1ff74d322a Fix imports 2019-06-17 12:52:13 -07:00
Brian Van Klaveren 69cb34a04e Add unit tests for JWT -> session translation 2019-06-17 12:52:13 -07:00
Brian Van Klaveren 187960e9d8 Improve token pattern matching
Unit tests for token discovery
2019-06-17 12:52:13 -07:00
Brian Van Klaveren 8413c30c26 Update changelog with info about -skip-jwt-bearer-tokens 2019-06-17 12:52:13 -07:00
Brian Van Klaveren b895f49c52 Use idToken expiry because that's the time checked for refresh
RefreshSessionIfNeeded checks the token expiry, we want to use
the ID token's expiry
2019-06-17 12:51:35 -07:00
Brian Van Klaveren 8083501da6 Support JWT Bearer Token and Pass through 2019-06-17 12:51:35 -07:00
Joel Speed 0af18d6d7c
Merge pull request #141 from openai/googleGroupEmail
Check google group membership based on email address
2019-06-15 14:05:56 +02:00
Joel Speed 77e1fff753
Merge pull request #185 from jonas/check-against-validate-url-string
Only validate tokens if ValidateURL resolves to a non-empty string
2019-06-15 12:30:03 +02:00
Joel Speed 0d6fa6216d
Merge pull request #180 from govau/littletidyups
Minor restructure for greater confidence that only authenticated requests are proxied
2019-06-15 12:21:54 +02:00
Joel Speed 6366690927
Fix gofmt for changed files 2019-06-15 11:34:00 +02:00
Joel Speed 417fde190c
Update changelog 2019-06-15 11:33:59 +02:00
Joel Speed fb9616160e
Move logger to pkg/logger 2019-06-15 11:33:58 +02:00
Joel Speed d1ef14becc
Move cookie to pkg/encryption 2019-06-15 11:33:57 +02:00
Adam Eijdenberg d69560d020 No need for case when only 2 conditions 2019-06-15 18:48:27 +10:00
Jonas Fonseca 7a8fb58ad1
Only validate tokens if ValidateURL resolves to a non-empty string
Fix an unsupported protocol scheme error when validating tokens by
ensuring that the ValidateURL generates a non-empty string. The Azure
provider doesn't define any ValidateURL and therefore uses the default
value of `url.Parse("")` which is not `nil`.

The following log summary shows the issue:

    2019/06/14 12:26:04 oauthproxy.go:799: 10.244.1.3:34112 ("10.244.1.1") refreshing 16h26m29s old session cookie for Session{email:jonas.fonseca@example.com user:jonas.fonseca token:true} (refresh after 1h0m0s)
    2019/06/14 12:26:04 internal_util.go:60: GET ?access_token=eyJ0...
    2019/06/14 12:26:04 internal_util.go:61: token validation request failed: Get ?access_token=eyJ0...: unsupported protocol scheme ""
    2019/06/14 12:26:04 oauthproxy.go:822: 10.244.1.3:34112 ("10.244.1.1") removing session. error validating Session{email:jonas.fonseca@example.com user:jonas.fonseca token:true}
2019-06-14 12:52:22 -04:00
Joel Speed 8027cc454e
Move api to pkg/requests 2019-06-08 07:40:43 +01:00
Adam Eijdenberg f35c82bb0f The AuthOnly path also needs the response headers set 2019-06-07 14:25:12 +10:00
Adam Eijdenberg 9e59b4f62e Restructure so that serving data from upstream is only done when explicity allowed, rather
than as implicit dangling else
2019-06-07 13:50:44 +10:00
Joel Speed 572646e0d5
Merge pull request #175 from govau/bumpoidc
Bump go-oidc
2019-06-06 17:54:25 +01:00
Joel Speed 78feaec6fa
Merge branch 'master' into bumpoidc 2019-06-06 17:38:19 +01:00
Joel Speed 55a853cf51
Merge pull request #155 from lsst/redis-session-store
Redis session store
2019-06-05 11:39:47 +01:00
Brian Van Klaveren 405f9b3bb0 Update CHANGELOG with descriptions about redis support
Add updates from master
2019-06-05 00:12:11 -07:00
Joel Speed 4721da02f2 Ensure SessionStores can handle recieving cookies for the wrong implementation
(cherry picked from commit 131206cf41697543583751ac2714287898c19ad0)
2019-06-05 00:11:42 -07:00
Joel Speed c1ae0ca807 Make sure the cookie exists before we clear the session in redis
(cherry picked from commit 6d7f0ab57d554706425f76aed4df60717dd63ece)
2019-06-05 00:11:42 -07:00
Joel Speed 22199fa417 Fix ticket retrieval with an invalid ticket
(cherry picked from commit 66bbf146ec45d127bdd374120743aeef936894a7)
2019-06-05 00:11:42 -07:00
Joel Speed 3155ada287 Ensure sessions are refreshable in redis session store
(cherry picked from commit 48edce3003d187a3eadc4ea96236845271dd9360)
2019-06-05 00:11:42 -07:00
Joel Speed 2e2327af6c Check SaveSession works when an existing session is present
(cherry picked from commit 9dc1a96d817741632cb476456755a645b732db7d)
2019-06-05 00:11:42 -07:00
Brian Van Klaveren ae0258a203 Documentation updates around Redis and Redis Sentinel use 2019-06-05 00:11:42 -07:00
Joel Speed 518c1d3e8e Add Redis sentinel compatibility
(cherry picked from commit ff36b61f8cee4ecf0b91a90b5e1b651b526bb6b6)
2019-06-05 00:11:42 -07:00
Brian Van Klaveren fc06e2dbef Update documentation and changelog for redis store 2019-06-05 00:11:42 -07:00
Joel Speed 5095c3647d Add redis-connection-url flag 2019-06-05 00:10:51 -07:00
Joel Speed 4f5dbace9f Refactor persistent tests with more Context 2019-06-05 00:10:51 -07:00
Joel Speed 7e7bfb5daf Stop miniredis after each test 2019-06-05 00:10:51 -07:00
Joel Speed bc3d75a2ed Run persistent tests with multiple option groups 2019-06-05 00:10:51 -07:00
Joel Speed 42f14a41d9 Clean up persistent SessionStore tests 2019-06-05 00:10:51 -07:00
Joel Speed a7693cc72a Tranfser all cookies in tests 2019-06-05 00:10:51 -07:00
Joel Speed 93df7d9132 Remove spurious comment 2019-06-05 00:10:51 -07:00
Joel Speed a6b8f7bde2 Rename expire -> expiration 2019-06-05 00:10:51 -07:00
Joel Speed 2f61e42c37 More obvious comment on CFB 2019-06-05 00:10:51 -07:00
Joel Speed f435fa68ab Make loadSessionFromString private 2019-06-05 00:10:51 -07:00
Joel Speed 130d03758d Fix comments on Redis options 2019-06-05 00:10:51 -07:00
Joel Speed 7a1fc52e33 Fix go-redis version pin 2019-06-05 00:10:51 -07:00
Joel Speed b255ed56ef Sign cookies in the Redis Session store 2019-06-05 00:10:51 -07:00
Joel Speed 2c566a5f5b Use session CreatedAt for cookie timings 2019-06-05 00:10:51 -07:00
Joel Speed 296d989e58 Simplify redis store options 2019-06-05 00:10:51 -07:00
Brian Van Klaveren f2562e8973 Pin version of go-redis 2019-06-05 00:10:51 -07:00
Brian Van Klaveren 42731f0617 Check cookie error and doc on cookie handling 2019-06-05 00:10:51 -07:00
Brian Van Klaveren b1bd3280db Add support for a redis session store 2019-06-05 00:10:51 -07:00
Brian Van Klaveren e881612ea6 Fix session_state type 2019-06-05 00:10:51 -07:00
Adam Eijdenberg b6c60f52ee Bump go-oidc 2019-06-04 10:58:35 +10:00
Joel Speed 1355c1ce30
Merge pull request #170 from zeha/release-tarballs-as-before
Make release tarballs look like bitly's
2019-06-03 16:23:30 +01:00
Joel Speed df6b6b7ce0
Merge pull request #176 from govau/fixnogopath
Stop assuming that GOPATH is always set, and is a single directory
2019-06-03 16:21:39 +01:00
Joel Speed 40cf6b2626
Merge pull request #168 from pusher/drop-1.11
Drop Go 1.11 from Travis CI
2019-06-03 15:22:35 +01:00
Joel Speed 006322562d
Bump go version in configure to check for go 1.12 2019-06-03 14:59:58 +01:00
Joel Speed f0b6f1525b
Update changelog 2019-06-03 14:59:56 +01:00
Joel Speed 29fb71fac5
Drop Go 1.11 from Travis CI 2019-06-03 14:59:16 +01:00
Adam Eijdenberg 37475637cd Install gometalinter in travis instead 2019-06-03 17:53:47 +10:00
Adam Eijdenberg e7d29590cd Fix travis so that if "configure" fails, it doesn't try to run make 2019-06-03 17:47:51 +10:00
Adam Eijdenberg b05eb71adf Stop assuming that GOPATH is always set, and is a single directory
As of I think go1.8 GOPATH is by default $HOME/go so it is incorrect to
assume that it is set.

If not set, then the Makefile assumes gometalinter will be in
/bin/gometalinter, which it likely is not, and thus fails.

We could change configure to set GOPATH in the .env, however then we
would be assuming that GOPATH is a single entry - whereas like other
paths, it can contain more than one value.

So instead this commit stops trying to install gometalinter, and like
dep, it assumes that it is installed prior.

(and since the current behaviour of the Makefile is affecting state
external to the project, that seems more logical)
2019-06-03 17:25:48 +10:00
Joel Speed 0d56a4c570
Merge pull request #171 from benbro/master
Fix repo link
2019-06-01 10:06:05 +01:00
benbro 60bb8fc7ea
Fix repo link 2019-06-01 05:36:28 +03:00
Chris Hofstaedtler 076484297e Make release tarballs look like bitly's
Fixes #162
2019-05-31 14:46:54 +02:00
Joel Speed e374805f8e
Merge pull request #169 from kskewes/alpine3.9
Update Docker base Alpine image to 3.9
2019-05-31 09:10:02 +01:00
Karl Skewes d3f0cb43ca Update Alpine to 3.9 2019-05-31 18:54:20 +12:00
Joel Speed f26ed5f3d1
Merge pull request #166 from cschyma/patch-1
fix typo
2019-05-28 14:32:41 +01:00
Christian Schyma 91346df5ac
fix typo 2019-05-28 15:26:22 +02:00
Joel Speed 10e240c8bf
Merge pull request #148 from pusher/proxy-session-store
Proxy session store
2019-05-20 12:55:39 +02:00
Joel Speed d40a61613e
Update Changelog 2019-05-20 11:39:41 +02:00
Joel Speed 093f9da881
Move cipher creation to options and away from oauth2_proxy.go 2019-05-20 11:26:13 +02:00
Joel Speed 76bd23738f
Simplify cookie creation form *options.CookieOptions 2019-05-20 11:26:12 +02:00
Joel Speed 37e31b5f09
Remove dead code 2019-05-20 11:26:11 +02:00
Joel Speed c61f3a1c65
Use SessionStore for session in proxy 2019-05-20 11:26:10 +02:00
Joel Speed 34cbe0497c
Add CreatedAt to SessionState 2019-05-20 11:26:09 +02:00
Joel Speed fbee5eae16
Initialise SessionStore in Options 2019-05-20 11:26:04 +02:00
Joel Speed 17e97ab884
Merge pull request #147 from pusher/session-store
Add initial session-store interface and implementation
2019-05-20 10:18:47 +01:00
Joel Speed 4ad4b11411
Update documentation to include session storage 2019-05-18 13:30:34 +02:00
Joel Speed 72fd3b96a6
Update changelog 2019-05-18 13:10:59 +02:00
Joel Speed 54393b91ed
Increase linter deadline 2019-05-18 13:10:13 +02:00
Joel Speed 1d29a0d094
Drop Session suffix from SessionStore methods 2019-05-18 13:10:12 +02:00
Joel Speed 455e0004b8
Include SessionOptions in Options struct 2019-05-18 13:10:11 +02:00
Joel Speed 1048584075
Add session-store-type flag 2019-05-18 13:10:10 +02:00
Joel Speed 65302ed34b
Rename RunCookieTests to RunSessionTests 2019-05-18 13:10:09 +02:00
Joel Speed 02e80b7aab
Check all information is encoded when cookie-secret set 2019-05-18 13:10:08 +02:00
Joel Speed 553cf89579
Add tests for saving and loading a session in SessionStore 2019-05-18 13:10:08 +02:00
Joel Speed 1c2ee715b3
Refactor session_store_test.go 2019-05-18 13:10:07 +02:00
Joel Speed b965f25c10
Implement SaveSession in Cookie SessionStore 2019-05-18 13:10:06 +02:00
Joel Speed 15a2cf8b9e
Implement ClearSession for cookie SessionStore 2019-05-18 13:10:05 +02:00
Joel Speed 8b3a3853eb
Implement LoadSession in Cookie SessionStore 2019-05-18 13:10:04 +02:00
Joel Speed 965d95fd4f
Update dependencies 2019-05-18 13:10:03 +02:00
Joel Speed 0204054005
Add tests to check cookies set by SessionStores 2019-05-18 13:10:02 +02:00
Joel Speed 6d162a1d78
Define session options and cookie session store types 2019-05-18 13:10:01 +02:00
Joel Speed 530acff38c
Add SessionStore interface 2019-05-18 13:10:00 +02:00
Joel Speed fd6655411b
Move cookie configuration to separate package 2019-05-18 13:09:59 +02:00
Joel Speed 2da89f8425
Allow embedded structs in env_options 2019-05-18 13:09:58 +02:00
Joel Speed 14d559939f
Fix dependencies 2019-05-18 13:09:57 +02:00
Joel Speed 2ab8a7d95d
Move SessionState to its own package 2019-05-18 13:09:56 +02:00
Joel Speed a1130e41a3
Merge pull request #156 from pusher/fix-templates
Fix templating escaping for logging templates in docs
2019-05-10 15:27:02 +01:00
Joel Speed e10b8860a6
Merge pull request #157 from pusher/docs-instructions
Add make targets for serving docs locally
2019-05-10 15:26:56 +01:00
Icelyn Jennings 5d7d0c4b4b
Shorten README.md (#154)
* Update README.md

* Add changelog entry

Co-Authored-By: Joel Speed <Joel.speed@hotmail.co.uk>
2019-05-10 12:25:05 +01:00
Joel Speed 16734dbee8
Add make targets for serving docs locally 2019-05-10 12:07:16 +01:00
Joel Speed 090bc50ec3
Fix templating escaping for logging templates in docs 2019-05-10 11:45:14 +01:00
Icelyn Jennings f262ec84d5
Fix broken link in installation doc (#153) 2019-05-09 15:12:27 +01:00
Joel Speed bd3bbbdf54
Merge pull request #152 from pusher/jekyll-url
Set Jekyll URL to https://pusher.github.io/oauth2_proxy
2019-05-09 13:53:08 +01:00
Joel Speed 4d233c44dc
Set Jekyll URL to https://pusher.github.io/oauth2_proxy 2019-05-09 11:52:11 +01:00
Icelyn Jennings 701c012567
Merge pull request #114 from pusher/jekyll-docs
Created docs directory, split README contents into separate pages.
2019-05-09 11:33:10 +01:00
devopsice 9200eb8e97
split README.MD into pages 2019-05-09 11:06:32 +01:00
Joel Speed b8137ba666
Initialise Jekyll site 2019-05-09 10:48:35 +01:00
Phil Taprogge 908ac24257
Merge pull request #146 from pusher/no-infer-username
Do not infer username from email
2019-05-09 10:30:28 +01:00
Phil Taprogge d4341ec40c
Add breaking changes section to changelog 2019-05-09 10:26:40 +01:00
Phil Taprogge 39d2f28a40
Add comment; update changelog 2019-05-09 10:14:01 +01:00
Joel Speed ec036d1005
Merge pull request #149 from timothy-spencer/fixredeemcodelogging
fixing code redemption error string logging
2019-05-08 17:38:49 +01:00
Benjamin Chess 7179c5796a make unable to fetch user a warning message 2019-05-08 08:29:38 -07:00
timothy-spencer 1a8bd70b46
fixing code redemption error string logging 2019-05-07 10:47:15 -07:00
Phil Taprogge 56da8387c0
Include JWT sub as User 2019-05-07 11:57:17 +01:00
Phil Taprogge 15f48fb95e
Don't infer username from email local part if username not set 2019-05-07 10:36:00 +01:00
Phil Taprogge 3f2d21dde9
Remove go list - no longer needed 2019-05-07 10:35:30 +01:00
Phil Taprogge 8519e7ccae
Merge pull request #144 from kskewes/goversion
build: use go 1.12 for arm as well
2019-05-03 12:43:51 +01:00
Phil Taprogge 8b06d255f7
Merge branch 'master' into goversion 2019-05-03 12:37:15 +01:00
Phil Taprogge 81c9185ee3
Merge pull request #142 from kskewes/user
fix Docker user on arm
2019-05-03 12:34:13 +01:00
Karl Skewes 8fca58cf49 build: use go 1.12 for arm as well 2019-05-03 22:01:36 +12:00
Karl Skewes 308bcc06a4 fix Docker user on arm
Use simple USER directive.
Using `addgroup` in final `arm` image when building on amd64 doesn't work.
I must have made a mistake during cross build verification.

Alternative is to use qemu-static but it's not worth it for this.
2019-05-03 20:54:21 +12:00
Benjamin Chess 3f2fab10e6 check google group based on email address 2019-05-02 17:11:25 -07:00
Joel Speed 93b7d31332
Merge pull request #52 from MisterWil/enhanced_logging
Added auth and standard logging with templating and file rolling
2019-05-01 15:44:23 +01:00
Mister Wil 9eaa9fdcbf
Standardizing log messages to colons 2019-04-23 09:36:18 -07:00
Mister Wil 8a17ef8d71
Fixing accidental variable name change. 2019-04-23 09:29:01 -07:00
Mister Wil 72da47509f
Update CHANGELOG.md 2019-04-23 09:22:46 -07:00
Mister Wil 88c518885c
Merge branch 'master' into enhanced_logging 2019-04-16 06:53:45 -07:00
Joel Speed 46a0d7ca54
Merge pull request #111 from timothy-spencer/jwtsigningkeyfile
added jwt-key-file option
2019-04-16 10:38:29 +01:00
timothy-spencer 1ae62a3343
added jwt-key-file option, update docs 2019-04-15 09:49:05 -07:00
MisterWil 79bcfebb77 Final conflicts 2019-04-12 09:53:07 -07:00
MisterWil 40ba565975 Requested changes 2019-04-12 09:48:21 -07:00
MisterWil d77119be55 Merging changes 2019-04-12 09:26:44 -07:00
MisterWil 1f15631547 Added list of variables for logging formats. 2019-04-12 09:00:54 -07:00
MisterWil 562db1e2da Updated changelog 2019-04-12 09:00:54 -07:00
MisterWil c22731afa0 Fixed linting errors. 2019-04-12 08:59:46 -07:00
MisterWil 37c415b889 Self code review changes 2019-04-12 08:59:46 -07:00
MisterWil 8ec025f536 Auth and standard logging with file rolling 2019-04-12 08:59:46 -07:00
Joel Speed ee4ebe53bf
Merge pull request #123 from pusher/release-3.2.0
Update changelog for release v3.2.0
2019-04-12 11:26:55 +01:00
Joel Speed 6545a33f93
Update changelog for release v3.2.0 2019-04-12 11:23:14 +01:00
Dan Bond bf9fedb3cf
build: use go 1.12 (#124)
* build: use go 1.12

* Update CHANGELOG.md
2019-04-12 11:15:29 +01:00
Joel Speed 66a82435de
Merge pull request #44 from martin-loetzsch/update-readme-for-azure-ad
Update Readme for Azure Active Directory
2019-04-12 10:26:10 +01:00
Joel Speed 484771b98a Update README.md
Co-Authored-By: martin-loetzsch <martin.loetzsch@gmail.com>
2019-04-12 11:23:12 +02:00
Joel Speed 70c4ca95b6 Update README.md
Co-Authored-By: martin-loetzsch <martin.loetzsch@gmail.com>
2019-04-12 11:23:01 +02:00
Joel Speed 6df85b9787 Update README.md
Co-Authored-By: martin-loetzsch <martin.loetzsch@gmail.com>
2019-04-12 11:08:42 +02:00
Joel Speed dd3244e465 Update README.md
Co-Authored-By: martin-loetzsch <martin.loetzsch@gmail.com>
2019-04-12 11:08:34 +02:00
Joel Speed 2511f1cd75 Update README.md
Co-Authored-By: martin-loetzsch <martin.loetzsch@gmail.com>
2019-04-12 11:08:26 +02:00
Joel Speed a8a68284c9 Update README.md
Co-Authored-By: martin-loetzsch <martin.loetzsch@gmail.com>
2019-04-11 21:29:12 +02:00
Joel Speed d3b8232876
Merge pull request #96 from caarlos0/verified
fix: github should check if email is verified
2019-04-11 13:55:50 +01:00
Joel Speed d00e3bddf5
Merge branch 'master' into verified 2019-04-11 13:49:56 +01:00
Joel Speed 3f4420fd58
Merge pull request #120 from costelmoraru/session_state_email
Encrypting user/email from cookie
2019-04-10 13:57:56 +01:00
Joel Speed bd64aeb7ee
Merge pull request #122 from costelmoraru/expose_cookie_path
Expose -cookie-path as configuration parameter
2019-04-10 13:55:12 +01:00
Costel Moraru f7c85a4d16 Removing obsolete comment from EncodeSessionState 2019-04-10 15:28:03 +03:00
Costel Moraru 862e75a4e4 Adjusted the cookie path sample in the documentation 2019-04-10 14:50:19 +03:00
Costel Moraru dc8934ca93 Update documentation, to add the flag to the list of flags 2019-04-10 12:52:50 +03:00
Costel Moraru f5f64e7d6c Update the changelog 2019-04-10 00:42:17 +03:00
Costel Moraru 071d17b521 Expose -cookie-path as configuration parameter 2019-04-10 00:36:35 +03:00
Costel Moraru f5a6609b45 Fixing lint error 2019-04-09 15:17:40 +03:00
Costel Moraru 6da6ee7f84 Encrypting user/email from cookie, add changelog 2019-04-09 15:00:17 +03:00
Costel Moraru 4f7517b2f9 Encrypting user/email from cookie 2019-04-09 14:55:33 +03:00
Joel Speed e9d4f6e0a1
Merge pull request #110 from timothy-spencer/gcphealthcheck
added an option to enable GCP healthcheck endpoints
2019-03-27 11:58:14 +00:00
Joel Speed da0d4ac50d
Merge pull request #113 from daB0bby/patch-1
fixes typo
2019-03-26 16:00:39 +00:00
timothy-spencer 6bb32c8059
It's not really mine 2019-03-26 08:59:03 -07:00
daB0bby 9660839667
fixes typo in set-authorization-header 2019-03-26 16:49:04 +01:00
timothy-spencer 2679579f44
updated documentation to reflect GKE ingress support too 2019-03-25 11:44:17 -07:00
timothy-spencer d44f58f0e2
found another edge case to test 2019-03-25 10:47:30 -07:00
timothy-spencer ff4e5588d8
incorporate suggestions from @benfdking 2019-03-25 10:32:29 -07:00
timothy-spencer 1ff17a3fa1
travis ci tests had a temporary failure, so this is to get it to retest 2019-03-25 10:10:07 -07:00
timothy-spencer e2755624ec
made gcp healthcheck test better 2019-03-25 10:03:22 -07:00
Tim Spencer 189bda3781
Merge branch 'master' into gcphealthcheck 2019-03-25 09:57:52 -07:00
timothy-spencer 3d22a11658
added better tests for gcp healthcheck stuff 2019-03-25 09:56:56 -07:00
Joel Speed a38b0dcec2
Merge pull request #112 from gyson/improve-websocket-support
Improve websocket support
2019-03-25 10:27:08 +00:00
gyson b67614c90f Update CHANGELOG.md 2019-03-22 17:41:55 -04:00
gyson 978c0a33e4 Improve websocket support 2019-03-22 17:19:38 -04:00
timothy-spencer e9f36fa4b5
added the PR to the changelog 2019-03-20 14:44:01 -07:00
timothy-spencer 2147ae8cfd
added gcp-healthchecks flag in readme, fixed link to logingov-provider 2019-03-20 14:38:06 -07:00
timothy-spencer 3476daf322
added an option to enable GCP healthcheck endpoints 2019-03-20 14:29:44 -07:00
Carlos Alexandro Becker 24f36f27a7
fix: check if it is both primary and verified 2019-03-20 13:52:30 -03:00
Carlos Alexandro Becker 95ee4358b2
Merge remote-tracking branch 'upstream/master' into verified 2019-03-20 13:46:04 -03:00
Joel Speed ca89bb833d
Merge pull request #108 from pkoenig10/patch-1
Set redirect URL path when host is present
2019-03-20 16:41:09 +00:00
Patrick Koenig 6f9eac5190
Set redirect URL path when host is present 2019-03-20 09:25:04 -07:00
YAEGASHI Takeshi 2070fae47c Use encoding/json for SessionState serialization (#63)
* Use encoding/json for SessionState serialization

In order to make it easier to extend in future.

* Store only email and user in cookie when cipher is unavailable

This improves safety and robustness, and also preserves the existing
behaviour.

* Add TestEncodeSessionState/TestDecodeSessionState

Use the test vectors with JSON encoding just introduced.

* Support session state encoding in older versions

* Add test cases for legacy session state strings

* Add check for wrong expiration time in session state strings

* Avoid exposing time.Time zero value when encoding session state string

* Update CHANGELOG.md
2019-03-20 13:59:24 +00:00
Berjou a656435d00 Implement Getter interface for StringArray (#104)
This commit fix the issue #98
2019-03-20 13:58:14 +00:00
Tim Spencer 8cc5fbf859 add login.gov provider (#55)
* first stab at login.gov provider

* fixing bugs now that I think I understand things better

* fixing up dependencies

* remove some debug stuff

* Fixing all dependencies to point at my fork

* forgot to hit save on the github rehome here

* adding options for setting keys and so on, use JWT workflow instead of PKCE

* forgot comma

* was too aggressive with search/replace

* need JWTKey to be byte array

* removed custom refresh stuff

* do our own custom jwt claim and store it in the normal session store

* golang json types are strange

* I have much to learn about golang

* fix time and signing key

* add http lib

* fixed claims up since we don't need custom claims

* add libs

* forgot ioutil

* forgot ioutil

* moved back to pusher location

* changed proxy github location back so that it builds externally, fixed up []byte stuff, removed client_secret if we are using login.gov

* update dependencies

* do JWTs properly

* finished oidc flow, fixed up tests to work better

* updated comments, added test that we set expiresOn properly

* got confused with header and post vs get

* clean up debug and test dir

* add login.gov to README, remove references to my repo

* forgot to remove un-needed code

* can use sample_key* instead of generating your own

* updated changelog

* apparently golint wants comments like this

* linter wants non-standard libs in a separate grouping

* Update options.go

Co-Authored-By: timothy-spencer <timothy.spencer@gsa.gov>

* Update options.go

Co-Authored-By: timothy-spencer <timothy.spencer@gsa.gov>

* remove sample_key, improve comments related to client-secret, fix changelog related to PR feedback

* github doesn't seem to do gofmt when merging.  :-)

* update CODEOWNERS

* check the nonce

* validate the JWT fully

* forgot to add pubjwk-url to README

* unexport the struct

* fix up the err masking that travis found

* update nonce comment by request of @JoelSpeed

* argh.  Thought I'd formatted the merge properly, but apparently not.

* fixed test to not fail if the query time was greater than zero
2019-03-20 13:44:51 +00:00
Akshay Pratinav 6d15fe004e change per_page value from 200 to 100 2019-03-15 08:00:20 -07:00
einfachchr f715c9371b Fixes deletion of splitted cookies - Issue #69 (#70)
* fixes deletion of splitted cookies

* three minor adjustments to improve the tests

* changed cookie name matching to regex

* Update oauthproxy.go

Co-Authored-By: einfachchr <einfachchr@gmail.com>

* removed unused variable

* Changelog
2019-03-15 07:18:37 +00:00
Akshay Pratinav e73f6501f0 limit => per_page 2019-03-14 20:04:45 -07:00
Akshay Pratinav 3c19c364bd add pagination support for /user/teams 2019-03-12 21:24:47 -07:00
Joel Speed cfd1fd83bd
Merge pull request #101 from pusher/fix-callback-path
Revert OAuthCallbackPath
2019-03-12 17:33:24 +00:00
Joel Speed e195a74e26
Revert OAuthCallbackPath 2019-03-12 16:46:37 +00:00
Carlos Alexandro Becker 58b8bbe491
fix: changelog 2019-03-11 14:55:02 -03:00
Carlos Alexandro Becker b49aeb222b
fix: should check if email is verified 2019-03-11 14:52:08 -03:00
Joel Speed 056089bbcc
Merge pull request #92 from butzist/feature/wsproxy
Merge websocket proxy feature from openshift/oauth-proxy
2019-03-11 13:22:20 +00:00
Adam Szalkowski c7193b4085 Merge websocket proxy feature from openshift/oauth-proxy. Original author: Hiram Chirino <hiram@hiramchirino.com> 2019-03-11 14:05:16 +01:00
Joel Speed 21c9d38ada
Merge pull request #57 from aigarius/patch-1
Fall back to using OIDC Subject instead of Email
2019-03-08 14:20:12 +00:00
Aigars Mahinovs 4e6593bc60 Update changelog for pull request #57 2019-03-08 13:41:15 +01:00
Aigars Mahinovs 7acec6243b Fall back to using OIDC Subject instead of Email
Email is not mandatory field, Subject is mandatory and expected to be unique. Might want to take a look at UserInfo first, however.

Issue: #56
2019-03-08 13:39:08 +01:00
Joel Speed 84d7c51bb6
Merge pull request #85 from kskewes/dockernoroot
Use non-root user in docker images
2019-03-05 20:32:39 +00:00
Joel Speed bfccc1f261
Update CHANGELOG.md
Co-Authored-By: kskewes <karl.skewes@gmail.com>
2019-03-05 11:42:11 -08:00
dt-rush 549766666e fix redirect url param handling (#10)
* Added conditional to prevent user-supplied redirect URL getting
clobbered

Change-type: patch

* use redirectURL as OAuthCallbackURL (as it should be!)

Change-type: patch
2019-03-05 14:58:26 +00:00
Ben 66c5eb3174 Small clarification around health checks (#84)
Type: docs
I simply added the word health check. I was searching all over the
package for a health check, to only realise that it had been called
ping. I think the small addition might help others avoid my troubles.
2019-03-05 14:09:30 +00:00
Gabor Lekeny eacba4ec7d Add id_token refresh to Google provider (#83) 2019-03-05 14:07:10 +00:00
Karl Skewes 80b5873a26 Potentially breaking change: docker user & group
Run as non-root user and group

In the unlikely event that you are currently persisting data to disk then this
change may break file read/write access due to a change in the UID/GID that the
oauth2_proxy process runs as.

Run as non-root system user and group `oauth2proxy` with UID/GID `2000` to avoid clashing with typical local users.
An alternative to creating a separate user is to ~~chown binary and~~ run as `USER nobody`, which also works, can amend this PR if required.

Least access privileges.
Close: https://github.com/pusher/oauth2_proxy/issues/78

Locally with Docker (`-version`):
```
$ ps aux | grep oauth2
2000     25192  6.0  0.0      0     0 ?        Ds   15:53   0:00 [oauth2_proxy]
```

Running in Kubernetes 1.13 with the following also specified:
```
        securityContext:
          readOnlyRootFilesystem: true
          runAsNonRoot: true
          runAsUser: 10001
```
```
$ kubectl exec -it -n oauth2-proxy oauth2-proxy-85c9f58ffc-dz9lr sh
/opt $ whoami
whoami: unknown uid 10001
/opt $ ps aux
PID   USER     TIME  COMMAND
    1 10001     0:00 /opt/oauth2_proxy --whitelist-domain=.example.com --cookie-domain=example.com --email-domain=example.com --upstream=file:///dev/null --http-address=0.0.0.0:4180
   11 10001     0:00 sh
   17 10001     0:00 ps aux
```

<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->

- [x] My change requires a change to the documentation or CHANGELOG.
- [x] I have updated the documentation/CHANGELOG accordingly.
- [x] I have created a feature (non-master) branch for my PR.
2019-03-05 21:37:04 +13:00
Marcel D. Juhnke 8816a2a972 Add -skip-oidc-discovery option (#41)
* added karrieretutor go-oidc fork for using an AAD B2C Policy

* added karrieretutor go-oidc fork for using an AAD B2C Policy

* added --skip-oidc-discovery option

* added --skip-oidc-discovery option

* add simple test for skip-oidc-discovery option

* revert Dockerfile to pusher upstream

* revert Dockerfile to pusher upstream

* remove karrieretutor b2c option leftover

* remove karrieretutor b2c option leftover

* Fix typo (missing letters)

Co-Authored-By: marratj <marrat@marrat.de>

* Fix typo (missing letters)

Co-Authored-By: marratj <marrat@marrat.de>

* replace fake http client with NewProvider() from go-oidc

* remove OIDC UserInfo URL option (not required)

* add info about -skip-oidc-discovery to README

* add note to changelog

* Update outdated comment
2019-03-04 13:54:22 +00:00
MisterWil 2ca2c48bd9 Added list of variables for logging formats. 2019-02-26 08:53:41 -08:00
MisterWil 45742d326d Merge remote-tracking branch 'origin/master' into enhanced_logging 2019-02-26 08:27:06 -08:00
Mathias Söderberg fb1614c873
Merge pull request #76 from simplesurance/improve_configure_gopath
build: fix: configure fails if GOPATH environment variable not set
2019-02-25 10:17:48 +00:00
Fabian Holler 1c16c2c055 build: fix: configure fails if GOPATH environment variable not set
If the GOPATH enviroment variable was not set, go uses the default
GOPATH (~/go/).

The configure script was only checking if the GOPATH environment
is set. If it wasn't the script was failing.

Instead of checking if the GOPATH environment variable is set, check if
"go env GOPATH" returns a non-emtpy string.
2019-02-25 10:48:19 +01:00
David Holsgrove 2280b42f59 Access token forwarding through nginx auth request (#68)
* Access token forwarding through nginx auth request

Related to #420.

(cherry picked from commit b138872bea)
Signed-off-by: David Holsgrove <david.holsgrove@biarri.com>

* Improved documentation for auth request token

(cherry picked from commit 6fab314f72)
Signed-off-by: David Holsgrove <david.holsgrove@biarri.com>

* Update README.md

Example should set header as `X-Access-Token`

Co-Authored-By: davidholsgrove <davidholsgrove@users.noreply.github.com>

* Update Changelog to reference https://github.com/pusher/oauth2_proxy/pull/68

* Fix Changelog message location
2019-02-22 07:49:57 +00:00
Martin Loetzsch 8d73740425 Remove backslashes from azure configuration example 2019-02-19 14:59:13 +01:00
Joel Speed c83335324e
Merge pull request #59 from aslafy-z/patch-1
Add oidc-issuer-url arg to README
2019-02-17 11:56:05 +00:00
MisterWil 398f85c30f Updated changelog 2019-02-15 10:29:24 -08:00
MisterWil 8a2dc3c51d Merge remote-tracking branch 'origin/master' into enhanced_logging 2019-02-15 10:14:18 -08:00
MisterWil b8da1dec4a Fixed linting errors. 2019-02-15 10:07:25 -08:00
Zadkiel da7d340519
Reorder arg line 2019-02-13 16:36:45 +01:00
Zadkiel 7404195c6e
Add oidc-issuer-url arg to README 2019-02-13 16:34:46 +01:00
MisterWil 2e5c877dd1 Self code review changes 2019-02-10 09:01:13 -08:00
MisterWil b46e34be72 Auth and standard logging with file rolling 2019-02-10 08:37:45 -08:00
Joel Speed ec4444fa3b
Merge pull request #50 from pusher/release-v3.1.0
Update release notes for v3.1.0
2019-02-09 10:13:09 +00:00
Joel Speed 09c6bd77ed
Add note on changed flush-interval behaviour 2019-02-08 14:16:41 +00:00
Joel Speed 5b95ed3552
Update release notes for v3.1.0 2019-02-08 11:57:17 +00:00
Joel Speed 402ce6f0cb
Merge pull request #39 from pusher/arm-quay
Add Quay links to ARM repositories
2019-02-08 11:07:58 +00:00
Joel Speed bdf68cc5f0
Remove --long from git describe 2019-02-08 10:10:52 +00:00
Joel Speed b7fd0a1b7e
Add push target to Makefile 2019-02-08 10:07:02 +00:00
Martin Loetzsch 2ca5de9d44 update Readme for Azure Active Directory 2019-02-06 23:07:53 +01:00
Joel Speed dd9781ddfe
Merge pull request #43 from rafaelmagu/gzip-binary-archives
Ensure binary archives are gzipped
2019-02-06 21:31:20 +00:00
Rafael Fonseca 2bfcb4ca22
Ensure binary archives are gzipped 2019-02-07 09:59:19 +13:00
Joel Speed 92c4424639
Merge pull request #37 from kskewes/dockerarm
feat(arm): Cross build arm and arm64 docker images
2019-02-04 10:36:40 +00:00
Joel Speed fb13ee87c8
Merge pull request #34 from marratj/cookie-separator
Change cookie index separator to underscore
2019-02-03 13:21:51 +00:00
Joel Speed fa2545636b
Merge pull request #15 from pusher/whitelist-domains
Whitelist domains
2019-02-02 18:55:37 +00:00
Marcel D. Juhnke 72d4c49be0 remove duplicate lines 2019-02-02 15:00:10 +01:00
Joel Speed cd37a14fc0
Added more context as suggested by JoelSpeed.
Co-Authored-By: marratj <marrat@marrat.de>
2019-02-02 12:47:21 +01:00
Karl Skewes f289543dc6 fix(docker): simplify build by copying ca-certificates.crt 2019-02-02 20:01:27 +13:00
Karl Skewes 90e6bd278e feat(arm): Cross build arm and arm64 docker images
- Requires `qemu-user-static`, added to travis - maybe incorrect?
- Add build guide
- `.gitignore` `release/` directory
2019-02-02 13:25:20 +13:00
Marcel Juhnke c574346086 add nginx cookie part extraction to README 2019-02-01 18:10:44 +01:00
Joel Speed c6d2126dcc
Merge pull request #35 from kskewes/build
feat(arm): Makefile add armv6 and arm64 to releases
2019-01-31 20:29:45 +00:00
Karl Skewes 2bdf00a692 feat(arm): Makefile add armv6 and arm64 to releases 2019-02-01 08:30:50 +13:00
Marcel Juhnke a339baf94e change cookie index separator to underscore 2019-01-31 20:07:28 +01:00
Joel Speed b5b0633e0b
Merge pull request #32 from ccojocar/ajax_401
Returns HTTP unauthorized for ajax requests instead of redirecting to the sign-in page
2019-01-31 15:56:26 +00:00
Cosmin Cojocar 3326194422 Extract the application/json mime type into a const 2019-01-31 16:23:01 +01:00
Cosmin Cojocar c12db0ebf7 Returns HTTP unauthorized for ajax requests instead of redirecting to the sing-in page 2019-01-31 16:23:01 +01:00
Steve Arch 01c5f5ae3b Implemented flushing interval (#23)
* Implemented flushing interval

When proxying streaming responses, it would not flush the response writer buffer until some seemingly random point (maybe the number of bytes?). This makes it flush every 1 second by default, but with a configurable interval.

* flushing CHANGELOG

* gofmt and goimports
2019-01-31 14:02:15 +00:00
Joel Speed 787d3da9d2
Merge pull request #33 from adamdecaf/watcher-break
watcher: properly break out in nested blocks
2019-01-31 09:54:17 +00:00
Adam Shannon 6a775b97c9 watcher: properly break out in nested blocks
Found via staticcheck:

watcher.go:48:5: ineffective break statement. Did you mean to break out of the outer loop? (SA4011)
2019-01-30 18:54:27 -06:00
Joel Speed 987b25fae7
Add whitelist domain to changelog 2019-01-30 17:31:30 +00:00
Joel Speed 52b50a49ed
Add env option 2019-01-30 17:30:50 +00:00
Joel Speed 9007d66559
Test explicit subdomain whitelisting 2019-01-30 17:30:49 +00:00
Joel Speed 81f77a55de
Add note on subdomain behaviour 2019-01-30 17:30:48 +00:00
Joel Speed bc4d5941fc
Remove duplicated logic 2019-01-30 17:30:48 +00:00
Joel Speed fd875fc663
Make option name singular 2019-01-30 17:30:47 +00:00
Joel Speed 768a6ce989
Test IsValidRedirect method 2019-01-30 17:30:46 +00:00
Joel Speed 2a1691a994
Add whitelist domains flag 2019-01-30 17:30:40 +00:00
Steve Arch 090ff11923 redirect to original path after login (#24)
* redirect to original path after login

* tests for new redirect behaviour

* fixed comment

* added redirect fix to changelog
2019-01-29 12:13:02 +00:00
Joel Speed 440d2f32bf
Merge pull request #14 from pusher/oidc
OIDC ID Token, Authorization Headers, Refreshing and Verification
2019-01-22 15:56:37 +00:00
Joel Speed 0925b88d17
Update documentation and changelog 2019-01-22 11:36:52 +00:00
Joel Speed cac2c9728d
Validate OIDC Session State 2019-01-22 11:34:57 +00:00
Joel Speed 1b638f32ac
Implement refreshing within OIDC provider 2019-01-22 11:34:56 +00:00
Joel Speed 714e2bdfba
Fix cookie split should account for cookie name 2019-01-22 11:34:55 +00:00
Joel Speed d4b588dbe9
Split large cookies 2019-01-22 11:34:54 +00:00
Joel Speed 6aa35a9ecf
Update sessions state 2019-01-22 11:34:53 +00:00
Joel Speed 68d4164897
Add Authorization header flags 2019-01-22 11:34:23 +00:00
Joel Speed c8ca0c8295
Merge pull request #22 from pusher/update-changelog-docker
Update changelog for Docker Improvements
2019-01-22 11:08:32 +00:00
Joel Speed 77766f0b2b
Update changelog for Docker Improvements 2019-01-22 10:11:40 +00:00
Joel Speed c922a09ee7
Merge pull request #21 from yaegashi/docker-improvement
Docker improvement
2019-01-21 18:08:51 +00:00
YAEGASHI Takeshi ccaa6e96cd Ignore Dockerfile.dev
Dockerfile.dev is ignored by both git and docker for faster development
cycle of docker build.
2019-01-22 02:54:17 +09:00
YAEGASHI Takeshi cb41a91a65 Docker build optimization
Update Dockefile to get a much smaller footprint with alpine image.

Optimize ordering of build steps to avoid needless downloads.

Include CA certificates needed for practical use.
2019-01-22 02:55:39 +09:00
YAEGASHI Takeshi 2943da00e2 Build a static binary
Update Makefile to build a static binary by default.
2019-01-22 02:54:17 +09:00
Joel Speed 473112216f
Merge pull request #17 from syscll/feature/go-1.11
build: use go 1.11
2019-01-16 12:28:20 +00:00
Dan Bond f35efd1e9c build: use go 1.11 2019-01-15 15:57:53 +00:00
Joel Speed 78872725eb
Merge pull request #13 from pusher/release-3.0.0
Release 3.0.0
2019-01-14 11:32:14 +00:00
Joel Speed 9e9b1f97f2
Fix changelog PR link 2019-01-14 10:47:01 +00:00
Joel Speed d08594436f
Update release target 2019-01-14 10:39:21 +00:00
Joel Speed d472cf1645
Release v3.0.0 2019-01-14 10:07:22 +00:00
Joel Speed e1f45dd941
Merge pull request #7 from pusher/migration
Migration from Bitly to Pusher
2019-01-14 09:54:05 +00:00
Joel Speed f80ce246f3
Fix repo link 2019-01-07 16:43:27 +00:00
Joel Speed 2eb2754cb1
Remove .env file 2019-01-07 16:42:58 +00:00
Joel Speed 85d76be6b1
Disable make parallelism 2019-01-07 16:41:11 +00:00
Joel Speed 1dddd818c4
Move dep to GoPath in CI setup 2019-01-04 11:12:47 +00:00
Joel Speed eded761cc1
Fix CI after make introduction 2019-01-04 11:07:45 +00:00
Joel Speed 372ecd0cf8
Introduce Makefile 2019-01-04 10:58:30 +00:00
Joel Speed 9096c70e96
Remove Go v1.8.x from Travis CI 2019-01-03 10:56:10 +00:00
Joel Speed 381e878574
Add CODEOWNERS file 2019-01-02 10:22:18 +00:00
Joel Speed 39d11b486f
Fix Quay link 2018-12-20 14:30:37 +00:00
Joel Speed 52f27f76dd
Add docker image note to README 2018-12-20 14:28:13 +00:00
Joel Speed 3253bef854
Add CONTRIBUTING guide 2018-12-20 14:14:04 +00:00
Joel Speed 8564ab6e86
Add Issue and Pull Request templates 2018-12-20 12:02:35 +00:00
Joel Speed 7fa913e51c
Add Dockerfile 2018-12-20 11:06:26 +00:00
Joel Speed d37cc2889e
Fix err declaration shadowing 2018-12-20 10:46:19 +00:00
Joel Speed e200bd5c20
Add comments to exported methods for providers package 2018-12-20 10:37:59 +00:00
Joel Speed a65ceb2c41
Add comments to exported methods for api package 2018-12-20 09:37:02 +00:00
Joel Speed ee913fb788
Add comments to exported methods for root package 2018-12-20 09:30:42 +00:00
Joel Speed 8ee802d4e5
Lint for non-comment linter errors 2018-11-29 14:26:41 +00:00
Joel Speed 990873eb42
Exit on first failure for travis 2018-11-27 12:17:59 +00:00
Joel Speed fa21208005
Fix fsnotify import 2018-11-27 12:08:22 +00:00
Joel Speed d41089d315
Update README to reflect new repo ownership 2018-11-27 12:08:21 +00:00
Joel Speed bc93198aa7
Update CI to separate linting and testing 2018-11-27 12:08:20 +00:00
Joel Speed 847cf25228
Move imports from bitly to pusher 2018-11-27 11:45:05 +00:00
Joel Speed bfdccf681a
Add Fork notice 2018-11-27 11:23:37 +00:00
Jehiah Czebotar a94b0a8b25
Merge pull request #549 from brennie/dev/bcrypt-htpasswd
Support bcrypt passwords in htpasswd
2018-03-24 23:48:45 -04:00
Jehiah Czebotar 1c1db881c3
Merge pull request #561 from danopia/patch-1
Strip JWT base64 padding before parsing. #560
2018-03-24 23:45:15 -04:00
Jehiah Czebotar ae78840614
Merge pull request #555 from MiniJerome/master
typo(README): Terminiation » Termination
2018-03-24 23:44:16 -04:00
Daniel Lamando 542ef54093
Strip JWT base64 padding before parsing. #560 2018-03-08 16:44:11 -08:00
Jérôme Lecorvaisier 2db0443e04
typo(README): Terminiation » Termination 2018-03-01 12:10:02 -05:00
Barret Rennie 008ffae3bb Support bcrypt passwords in htpasswd 2018-02-16 02:14:41 -06:00
Jehiah Czebotar ae49c7d23c
Merge pull request #529 from fsegouin/fix/templates-css-typo
Fix typo in css for the sign in page template
2018-01-23 10:08:09 -05:00
Florent Segouin a6e247825c
Fix typo in css for the sign in page template 2018-01-23 15:04:41 +00:00
Tanvir Alam 1209c63b58
Merge pull request #510 from ploxiln/clear_invalid_session
more robust ClearSessionCookie()
2018-01-16 10:57:53 -05:00
Tanvir Alam 1a82180376
Merge pull request #514 from ploxiln/readme_auth_request_body
README: fix nginx auth_request example for requests with body
2018-01-16 10:47:41 -05:00
Pierce Lopez 74d0fbc868 more robust ClearSessionCookie()
default domain changed from request Host to blank, recently
try to clear cookies for both
2017-12-18 21:16:51 -05:00
Pierce Lopez 20e87edde8 README: fix nginx auth_request example for requests with body
Nginx never sends the body with the auth_request sub-request, but
keeps the original Content-Length header by default. Without some
config tweaks, this results in the request to /oauth2/auth hanging.
2017-12-18 20:55:37 -05:00
Heather Hendy d75f626cdd
Merge pull request #414 from relaxdiego/multi-page-org
Iterate through pages returned by List Your Organizations endpoint
2017-12-04 15:12:25 -07:00
Mark Maglana 882fcf0a01 providers: iterate across all pages from /user/orgs github endpoint.
For some GHE instances where a user can have more than 100
organizations, traversing the other pages is important otherwise
oauth2_proxy will consider the user unauthorized. This change traverses
the list returned by the API to avoid that.

Update github provider tests to include this case.
2017-12-04 15:51:48 -05:00
Tanvir Alam faff555c55
Merge pull request #423 from Jimdo/configure_accesslog_format
Make Request Logging Format Configurable
2017-12-04 12:56:54 -05:00
Paul Seiffert 1cefc96311 Test request logging 2017-12-04 12:52:47 -05:00
Paul Seiffert 69550cbb23 Document request-logging-format option 2017-12-04 12:52:47 -05:00
Paul Seiffert 9341dcbf79 Make request logging format configurable 2017-12-04 12:52:47 -05:00
Jehiah Czebotar 085c6cf79b
Merge pull request #503 from talam/add_checksum_for_binary_releases
distribution: create sha256sum.txt file when creating version releases
2017-12-04 10:39:33 -05:00
Tanvir Alam 842a45b1db distribution: remove gpm references and update to use dep 2017-12-04 09:54:31 -05:00
Tanvir Alam dc65ff800f distribution: create sha256sum.txt file when creating binaries to allow validation of checksums.
* update README.md to include instructions on how to verify prebuilt binaries for new releases.
2017-11-21 15:00:30 -05:00
Heather Hendy b0c1c85177
Merge pull request #466 from clobrano/github-use-login-as-user
GitHub use login as user
2017-11-20 12:48:14 -07:00
Carlo Lobrano 731fa9f8e0 Github provider: use login as user
- Save both user and email in session state:
    Encoding/decoding methods save both email and user
    field in session state, for use cases when User is not derived from
    email's local-parth, like for GitHub provider.

    For retrocompatibility, if no user is obtained by the provider,
    (e.g. User is an empty string) the encoding/decoding methods fall back
    to the previous behavior and use the email's local-part

    Updated also related tests and added two more tests to show behavior
    when session contains a non-empty user value.

- Added first basic GitHub provider tests

- Added GetUserName method to Provider interface
    The new GetUserName method is intended to return the User
    value when this is not the email's local-part.

    Added also the default implementation to provider_default.go

- Added call to GetUserName in redeemCode

    the new GetUserName method is used in redeemCode
    to get SessionState User value.

    For backward compatibility, if GetUserName error is
    "not implemented", the error is ignored.

- Added GetUserName method and tests to github provider.
2017-11-20 20:02:27 +01:00
Heather Hendy 6ddbb2c572
Merge pull request #502 from talam/update_options_parsing
options: update options parsing for better handling of incorrect values
2017-11-20 11:00:48 -07:00
Dave Nicponski e955d2be0e options: update options parsing for better handling of incorrect values
* don't add in failed compiled regexes for skip auth regex option
* improve test coverage for skip auth regex option to handle partial
success case
* add tests for incorrect upstream options parsing errors
2017-11-20 11:37:53 -05:00
Tanvir Alam a7c5d9c478
Merge pull request #421 from arnottcr/raw-url-encode
raw url encoding
2017-11-20 10:50:56 -05:00
Tanvir Alam 781bd0851e
Merge pull request #491 from jehiah/dep_491
Switch from gpm -> dep for dependency management
2017-11-17 15:55:15 -05:00
Jehiah Czebotar c4905f2347 Switch from gpm -> dep for dependency management 2017-11-16 20:58:11 -05:00
Tanvir Alam 363a0dda16
Merge pull request #448 from mbland/hmacauth
Switch from 18F/hmacauth to mbland/hmacauth
2017-11-07 09:46:06 -05:00
Mike Bland e241fe86d3
Switch from 18F/hmacauth to mbland/hmacauth
Since I'm no longer with 18F, I've re-released hmacauth under the ISC
license as opposed to the previous CC0 license. There have been no
changes to the hmacauth code itself, and all tests still pass.
2017-11-07 07:55:24 -05:00
Jehiah Czebotar 28e217dc8f
Merge pull request #496 from talam/update_gitlab_api_endpoint
providers: update gitlab api endpoint to use latest version, v4
2017-11-06 13:15:45 -05:00
Tanvir Alam f2a995b8d9 providers: update gitlab api endpoint to use latest version, v4 2017-11-06 12:05:58 -05:00
Jehiah Czebotar bfda078caa Merge pull request #376 from reedloden/make-cookie-domain-optional
Don't set the cookie domain to the host by default, as it breaks Cookie Prefixes
2017-10-23 14:14:45 -04:00
Jehiah Czebotar bc1b839f7f Merge pull request #484 from talam/update_assert_package
Swap out bmizerany/assert package in favor of stretchr/testify/assert
2017-10-23 13:56:35 -04:00
Tanvir Alam 8a77cfcac3 Swap out bmizerany/assert package that is deprecated in favor of stretchr/testify/assert 2017-10-23 12:24:17 -04:00
Jehiah Czebotar fd3925d204 Merge pull request #444 from Starefossen/patch-1
Clarify that GitHub team option in README
2017-10-23 11:52:21 -04:00
Jehiah Czebotar b7f9438b8a Merge pull request #473 from jmcarp/oidc-name
Add OpenID Connect provider name.
2017-10-13 09:10:44 -04:00
Jehiah Czebotar f6828631cf Merge pull request #472 from jmcarp/drop-myusa
Drop deprecated MyUSA provider.
2017-10-08 13:05:15 -04:00
Joshua Carp d118cb7bbb Drop deprecated MyUSA provider.
[Resolves #390]
2017-10-08 01:01:15 -04:00
Joshua Carp 34d96f8d84 Add OpenID Connect provider name. 2017-10-08 00:40:36 -04:00
Jehiah Czebotar 7b26256df6 Merge pull request #447 from Miouge1/master
Use read_user as default scope for GitLab
2017-09-13 10:27:36 -04:00
Miouge1 a32ff08d68 Update test for default GitLab scope 2017-09-12 23:43:49 +02:00
Miouge1 982439a8d8 Reduce the default GitLab scope 2017-09-12 23:42:07 +02:00
Jehiah Czebotar e87c3eee13 Merge pull request #389 from ericchiang/oidc-provider
*: add an OpenID Connect provider
2017-09-09 20:44:59 -04:00
Eric Chiang cb48577ede *: add an OpenID Connect provider
See the README for usage with Dex or any other OIDC provider.

To test run a backend:

    python3 -m http.server

Run dex and modify the example config with the proxy callback:

    go get github.com/coreos/dex/cmd/dex
    cd $GOPATH/src/github.com/coreos/dex
    sed -i.bak \
      's|http://127.0.0.1:5555/callback|http://127.0.0.1:5555/oauth2/callback|g' \
       examples/config-dev.yaml
    make
    ./bin/dex serve examples/config-dev.yaml

Then run the oauth2_proxy

    oauth2_proxy \
      --oidc-issuer-url http://127.0.0.1:5556/dex \
      --upstream http://localhost:8000 \
      --client-id example-app \
      --client-secret ZXhhbXBsZS1hcHAtc2VjcmV0 \
      --cookie-secret foo \
      --email-domain '*' \
      --http-address http://127.0.0.1:5555 \
      --redirect-url http://127.0.0.1:5555/oauth2/callback \
      --cookie-secure=false

Login with the username/password "admin@example.com:password"
2017-09-08 09:32:51 -07:00
Hans Kristian Flaatten 94574df274 Clarify that GitHub team slug name should be used for the `-github-team` option 2017-09-05 22:58:53 +02:00
Jehiah Czebotar b1e29c329b Merge pull request #407 from segmentio/sign-in-redirect
nginx auth_request: fix -skip-provider-button
2017-08-28 20:57:09 -04:00
Jehiah Czebotar 678290035c Merge pull request #410 from sobolevn/patch-1
Updates README.md with svg badge
2017-08-28 20:50:07 -04:00
Jehiah Czebotar 01ef8162a8 Merge pull request #422 from arnottcr/strip-all-tokens
strip all tokens
2017-08-28 20:48:43 -04:00
Jehiah Czebotar 23cef89236 Merge pull request #431 from ploxiln/nil_upstream_url
gracefully report un-parsed upstream URL
2017-08-28 20:46:30 -04:00
Jehiah Czebotar 11bdcc96c5 Merge pull request #426 from bluecmd/patch-4
Remove check for >0 upstreams
2017-08-28 20:45:26 -04:00
Jehiah Czebotar 79fff53531 Merge pull request #425 from bluecmd/patch-3
Update cookie generation to match base64 encoding
2017-08-28 20:44:49 -04:00
Pierce Lopez 3d8b59ef71 options: wrap missing-email-validation error message 2017-08-05 12:55:42 -04:00
Pierce Lopez e9bbecface options: gracefully report un-parsed upstream URL
upstreamURL is a nil pointer if there is an error parsing --upstream
2017-08-05 12:55:15 -04:00
Christian Svensson 0b117133b9 Remove check for >0 upstreams
When used solely for auth_request there is no upstream.
Instead of forcing users to set a dummy upstream, remove
the check.
2017-07-20 21:54:31 +02:00
Christian Svensson f4321c4b45 Update cookie generation to match base64 encoding
Current code is using URLEncoding but example was using the
standard RFC 4648 encoding. Switch to using the URL
encoding in the example as well.
2017-07-20 13:28:41 +02:00
Colin Arnott ba67e5c847
strip all log statements with the endpoint var 2017-07-13 18:33:48 +00:00
Colin Arnott 8d6e16bf22
use base64.RawURLEncoding.DecodeString() in place of a bespoke function 2017-07-13 18:29:58 +00:00
Nikita Sobolev e6e60c4b60 Updates README.md with svg badge 2017-06-29 09:36:31 +03:00
Alan Braithwaite b640a69d63 oauthproxy: fix #284 -skip-provider-button for /sign_in route 2017-06-21 15:05:36 -07:00
Jehiah Czebotar 3c51c914ac Merge pull request #405 from bspaans/patch-1
Update Google Auth Provider instructions
2017-06-21 09:24:24 -04:00
Bart Spaans 7fea71a4ce Update Google Auth Provider instructions 2017-06-21 11:03:24 +01:00
Jehiah Czebotar cddd2fcd7c Merge pull request #402 from shividhar/master
Fix spelling mistake in docs
2017-06-09 12:23:50 -04:00
Shivansh Dhar c8c6b66465 Fix spelling mistake in docs 2017-06-09 12:17:24 -04:00
Jehiah Czebotar 6d6cb7e1f8 Merge pull request #392 from arnottcr/master
[github provider] use Authorization header, not access_token query parameter
2017-05-26 08:42:07 -04:00
Colin Arnott 17b1fa31dd
use Authorization header, not access_token query parameter 2017-05-18 03:45:34 +00:00
Jehiah Czebotar f4c356637f Merge pull request #382 from ploxiln/auth_request_readme
README: nginx auth_request example updates
2017-05-15 20:50:28 -04:00
Pierce Lopez 6d295f8446 README: nginx auth_request example refresh cookie handling
how to pass back the refreshed oauth2_proxy cookie from an nginx auth_request
2017-04-24 17:59:21 -04:00
Pierce Lopez 7f5672b433 README: simplify nginx auth_request example
/oauth2/auth is not more sensitive than other /oauth2/ paths,
does not need "internal" protection

"spdy" protocol is obsolete, http2 is the thing to enable now.
But it's orthogonal anyway.

No need for two separate content/upstream location blocks in
this example, reduce to just one, with a comment that it could
be serving files instead of proxying.
2017-04-24 17:56:15 -04:00
Jehiah Czebotar ea2540bc89 Merge pull request #381 from ploxiln/dist_strip
dist.sh: use go build option to strip binaries
2017-04-24 16:34:22 -04:00
Pierce Lopez 68e3178812 dist.sh: use go build option to strip binaries
30% release binary size reduction
2017-04-24 16:04:36 -04:00
Pierce Lopez d7e327d712 bump to version 2.2.1-alpha for development 2017-04-24 16:04:06 -04:00
Reed Loden b6bd878f27 Don't set the cookie domain to the host by default, as it breaks Cookie Prefixes
The Cookie Prefixes spec disallows the use of the `domain` attribute in cookies
if the `__Host-` prefix is used
(https://tools.ietf.org/html/draft-ietf-httpbis-cookie-prefixes-00#section-3.2).

There's no need to set it to the host by default, so make it optional. If it is
set to a non-empty value, still output a warning if it is not a suffix of the
host, as that's likely not wanted.

Fixes #352.
2017-04-24 13:03:40 -07:00
Jehiah Czebotar b90a23473f Merge pull request #380 from jehiah/release_380
Release v2.2
2017-04-24 12:22:11 -04:00
Jehiah Czebotar f457a9042a Readme: update --help usage 2017-04-24 12:16:16 -04:00
Jehiah Czebotar 3fa5635d6c
Release 2.2.0 2017-04-24 12:11:23 -04:00
Jehiah Czebotar f511cac6a6 Merge pull request #365 from travisofthenorth/fix/default-http-address
Fix url parse error
2017-04-20 14:57:39 -04:00
Jehiah Czebotar 120a47a526 Merge pull request #370 from idntfy/master
#369: Optionally allow skipping authentication for preflight requests
2017-04-07 09:20:33 -04:00
idntfy 1e7d2a08a3 #369: Optionally allow skipping authentication for preflight requests 2017-04-07 15:01:47 +03:00
Travis Hunter f983933d88
Parse http address without url 2017-04-02 16:23:27 -04:00
Jehiah Czebotar af7be2d622 Merge pull request #319 from advarisk/auth-request
various fixes for getting Nginx auth_request mode working
2017-03-29 12:14:24 -04:00
Ashish Kulkarni fe44b89f57 update documentation for Nginx auth_request mode 2017-03-29 21:28:55 +05:30
Sjoerd Mulder 90a22b2f39 Use X-Auth-Request-Redirect request header in sign-in page
This is useful in Nginx auth_request mode, if a 401 handler is
configured to redirect to the sign-in page. As the request URL
does not reflect the actual URL, the value is taken from the
header "X-Auth-Request-Redirect" instead. Based on #247
2017-03-29 21:28:55 +05:30
Lukasz Siudut 829b442302 add --set-xauthrequest flag for use in Nginx auth_request mode
This is enhancement of #173 to use "Auth Request" consistently in
the command-line option, configuration file and response headers.
It always sets the X-Auth-Request-User response header and if the
email is available, sets X-Auth-Request-Email as well.
2017-03-29 21:28:55 +05:30
Jehiah Czebotar 93852a24cb Merge pull request #362 from jehiah/ssl_insecure_skip_verify_362
Option to skip SSL verification
2017-03-29 11:02:26 -04:00
Jehiah Czebotar dcf62d06df option for skipping OAuth provider SSL verification 2017-03-29 10:57:07 -04:00
Jehiah Czebotar bb9b607440 Merge pull request #361 from jehiah/gofmt_361
travis: run gofmt and go vet
2017-03-29 09:53:19 -04:00
Jehiah Czebotar c5fc7baa86 gofmt 2017-03-29 09:36:38 -04:00
Jehiah Czebotar c1116ea506 travis: run gofmt and go vet 2017-03-29 09:36:23 -04:00
Jehiah Czebotar 4464655276 Merge pull request #360 from jehiah/csrf_validation_360
CSRF protection for OAuth flow.
2017-03-29 09:36:04 -04:00
Colin Arnott 55085d9697 csrf protection; always set state 2017-03-29 09:31:10 -04:00
Jehiah Czebotar 6c690b699b Merge pull request #339 from omazhary/issue-205
Allow to pass user headers only
2017-03-28 21:42:29 -04:00
Jehiah Czebotar 107b4811b4 Merge pull request #346 from bdwyertech/patch-1
Oversize Cookie Alert
2017-03-28 21:40:11 -04:00
Jehiah Czebotar cd0d13e3fb Merge pull request #357 from wrapp/skip-group-lookup-404
Skip 404 errors when looking up Google groups
2017-03-28 21:38:55 -04:00
Jehiah Czebotar 86d083266b Merge pull request #359 from jehiah/redirect_check_359
Improve redirect checks
2017-03-28 21:34:23 -04:00
Colin Arnott 289a6ccf46 add check for //.* to prevent open redirect during oauth 2017-03-28 21:12:33 -04:00
Eskil Andreen 652f43ed38 Skip 404 errors when looking up Google groups
When checking user membership against Google groups the groups are checked one
at a time and in the order that they were supplied. If one of the groups does
not exist then the checking is halted with the following error.

google.go:201: googleapi: Error 404: Resource Not Found: groupKey, notFound

None of the groups following the missing group are checked either. This means
that something as trivial as a typo in the first group will make it impossible
for anybody to login.

This change catches the 404, logs a message, and then carries on as usual. In
this way a typo will cause a particular group to stop working but will not
affect any other groups.
2017-03-28 16:06:15 +02:00
Jehiah Czebotar 712739f777 Merge pull request #356 from jehiah/bump_dependencies_356
Update vendored dependencies.
2017-03-27 21:07:08 -04:00
Jehiah Czebotar 2ebab604eb bump golang.org/x/... and google.golang.org dependencies 2017-03-27 20:56:15 -04:00
Jehiah Czebotar b884b36f26 bump easy pkg upgrades; drop Go 1.6 (no httptest.NewRequest)
This fixes a test w request signing due to a content-length:0 header from Go 1.8
2017-03-27 20:36:35 -04:00
Jehiah Czebotar 951b5f325b Merge pull request #355 from ploxiln/dist_updates
dist.sh and Godeps updates
2017-03-27 20:16:44 -04:00
Pierce Lopez 9167c8ace8 travis: update go versions, gpm version 2017-03-27 19:40:12 -04:00
Pierce Lopez a2eeec2b7a Godeps: remove redundant dep, add missing
golang.org/x/oauth2/google is same repo as golang.org/x/oauth2
  - this sometimes confused gpm/git

cloud.google.com/go/compute/metadata is a missing dependency
of golang.org/x/oauth2
2017-03-27 19:17:42 -04:00
Pierce Lopez 2024dc34ac dist.sh: run gpm with GOPATH=$DIR/.godeps
so gpm is not affected if module exists in user's GOPATH already
2017-03-27 19:13:05 -04:00
Pierce Lopez 86c9638572 dist.sh: already uses set "-e", remove "|| exit 1" 2017-03-27 18:16:39 -04:00
Jehiah Czebotar 7d920c98a6 Merge pull request #354 from ploxiln/dist_win_exe
dist.sh: add .exe for windows build
2017-03-27 14:49:40 -04:00
Pierce Lopez bc3fe00be4 dist.sh: add .exe for windows build 2017-03-27 14:35:28 -04:00
Jehiah Czebotar 87847316d4 Merge pull request #349 from braincube-io/signout
[signout] Implement logout endpoint
2017-03-22 23:08:47 -04:00
Guillaume Bienkowski 562cc2e466 [signout] Implement logout endpoint 2017-03-21 17:40:47 +01:00
Brian Dwyer 3379e05fec Oversize Cookie Alert
Cookies cannot be larger than 4kb
2017-02-23 18:48:34 -05:00
Omar Elazhary 24f91a0b60 Allow to pass user headers only (issue #205)
* This fixes https://github.com/bitly/oauth2_proxy/issues/205
* Add new boolean option -pass-user-headers
  to control whether X-Forwarded-User and X-Forwarded-Email
  headers will be set (as opposed to HTTP BASIC auth)
* This is required e.g. for grafana [1] where
  X-Forwarded-User is needed but HTTP BASIC auth fails
  (password is not known and must not be known in this scenario)
* Keep behaviour of PassBasicAuth unchanged for compatibility

[1] http://docs.grafana.org/installation/configuration/#authproxy
2017-01-24 11:11:58 +01:00
Jehiah Czebotar 89ba1d813a Merge pull request #322 from ReadmeCritic/master
Correct the spelling of GitHub in README
2016-11-18 13:00:22 -05:00
ReadmeCritic 4203c26d7c Correct the spelling of GitHub in README 2016-11-18 09:31:22 -08:00
Jehiah Czebotar a9c55bd6d1 Merge pull request #299 from tamsky/fix-travis-vs-upstream-golang-dependency
repo golang.org/x/oauth2/google has moved, fixes travis build
2016-08-24 22:01:54 -04:00
Marc Tamsky e0a1831452 upstream vendor import paths have changed.
this fixes the travis build, which is broken
2016-08-24 16:58:38 -07:00
Jehiah Czebotar a0e4a36821 Merge pull request #292 from nickmiller-wf/redact-access-token
Strip sensitive URL parameters from provider log output
2016-08-02 23:19:22 -04:00
nickmiller-wf c566648127 add stripParam and stripToken methods to obfuscate log output 2016-08-02 21:01:44 -06:00
Jehiah Czebotar 78f2fe1306 Merge pull request #290 from MarkHerhold/patch-2
Adding skip-provider-button docs
2016-07-30 23:16:30 -04:00
Mark Herhold 116b84906e Adding skip-provider-button docs 2016-07-30 22:34:28 -04:00
Jehiah Czebotar 2f0f95b523 Merge pull request #279 from tanuck/bump-travis-version
Bump travis version
2016-07-19 16:41:44 -04:00
James Tancock 6cbc339442
Bump travis version 2016-07-19 21:29:19 +01:00
tanuck c015075996 Validate cookie name (#278)
Validate cookie name passes go's isCookieNameValid check
2016-07-19 15:51:25 -04:00
Nick Semenkovich 17f412e407 docs: working nginx auth_request example (#273) 2016-07-05 09:38:34 -04:00
Jehiah Czebotar da0bb7656a Merge pull request #274 from ElDiabloComputatore/Azure_provider_mail_fix
Getting mail for Azure provider fix + tests
2016-07-03 21:50:51 -04:00
Jehiah Czebotar 9babca599b bump version to 2.2.0-alpha 2016-07-03 21:50:38 -04:00
Tomas Pramuka 5acf96b75d Getting mail for Azure provider fix + tests 2016-06-29 09:00:08 +02:00
Jehiah Czebotar f9e649456b Merge pull request #272 from semenko/master
Fix documentation for auth_request directive
2016-06-27 21:19:00 -04:00
Nick Semenkovich 56bf3f8add Fix documentation for auth_request directive
The correct endpoint is /oauth2/auth
2016-06-27 20:10:22 -05:00
Jehiah Czebotar a66f7c50ea Merge pull request #193 from jehiah/release_193
A new tag
2016-06-23 10:11:59 -04:00
Jehiah Czebotar 671f00e60e
cookie secret: give helper command for generating a secret 2016-06-23 09:42:32 -04:00
Jehiah Czebotar 3bba24ab31
Bump verison to 2.1 2016-06-23 09:35:33 -04:00
Jehiah Czebotar 27cc412d79
bump go-options dependency 2016-06-23 09:34:53 -04:00
Jehiah Czebotar 4c6b579480 Merge pull request #270 from jehiah/fb_provider_270
Facebook auth Provider
2016-06-23 08:48:25 -04:00
Jehiah Czebotar a0763477c5
Facebook Authentication Provider
* will not re-prompt if the email permission is denied, or if you previously authorized the same FB app without the email scope.
2016-06-23 08:43:21 -04:00
Jehiah Czebotar 3a79827af2 Merge pull request #199 from hundt/master
Add URL fragment to sign-in form
2016-06-20 08:42:36 -04:00
Jehiah Czebotar f6778c79f8 Merge pull request #251 from bluecmd/patch-2
Remove superfluous quotes from config path
2016-06-20 08:20:13 -04:00
Jehiah Czebotar 9b68e8be8d Merge pull request #269 from jehiah/github_enterprise_269
github enterprise provider
2016-06-20 08:17:20 -04:00
Jehiah Czebotar bcb8064831
github: fix github enterprise support 2016-06-20 08:15:07 -04:00
Jehiah Czebotar 2fa0a35c7f Merge pull request #227 from jehiah/base64_cookie_encoding_227
Cookie secret encoding?
2016-06-20 07:48:38 -04:00
Jehiah Czebotar cdebfd6436
base64 cookie support 2016-06-20 07:45:43 -04:00
Jehiah Czebotar 57f82ed71e
Custom footer text (optional)
Closes #256 and #166
2016-06-18 23:54:32 -04:00
Jehiah Czebotar 168cff9d4b Merge pull request #161 from rahdjoudj/master
adding option to skip provider button sign_in page
2016-06-18 23:31:39 -04:00
Jehiah Czebotar fe143ca9e8 Merge pull request #257 from jhoblitt/bugfix/mktemp
fix dist.sh compatibility with GNU coreutils mktemp
2016-06-18 23:24:04 -04:00
Joshua Hoblitt 0a7a90b7a8 fix dist.sh compatibility with GNU coreutils mktemp
Resolves this error:

    mktemp: too few X's in template ‘oauth2_proxy’
2016-05-26 11:00:50 -07:00
Jehiah Czebotar a631197138 Merge pull request #249 from rremer/update-golang
fix master build by upgrading with supported golang versions
2016-05-26 12:49:14 -04:00
Christian Svensson d579db4a2d Remove superfluous quotes from config path
Using -config="path" will make the application try to open paths with the quotes included which is not what is expected.
2016-05-15 23:22:39 +02:00
Royce Remer 0b2e8991db fix master build by upgrading with supported golang versions 2016-05-12 18:17:54 -07:00
Jehiah Czebotar 62c80df1a5 Merge pull request #235 from gust1n/patch-1
Fix typo
2016-04-12 04:20:07 -07:00
Joakim Gustin 60a59ce7b1 Fix typo 2016-04-12 07:26:13 +02:00
Jehiah Czebotar 42f1651ba5 Merge pull request #219 from 18F/signature-key-env-var
OAUTH2_PROXY_SIGNATURE_KEY env var, README update
2016-02-25 09:57:23 -05:00
Mike Bland 87d80d6d22 OAUTH2_PROXY_SIGNATURE_KEY env var, README update 2016-02-24 08:23:31 -05:00
Jehiah Czebotar 293d674e14 Merge pull request #214 from raphink/github_multiple_teams
github provider: allow multiple teams
2016-02-17 17:24:50 -05:00
Raphaël Pinson 338e99773a github provider: allow multiple teams 2016-02-17 23:17:08 +01:00
Jehiah Czebotar bfb8dc13bf Merge pull request #211 from pmosbach/gitlab-provider
Add GitLab provider
2016-02-17 09:04:07 -05:00
pmosbach 034612bf8b Add GitLab provider 2016-02-17 06:19:52 -06:00
Jehiah Czebotar 54efb1a2e1 Merge pull request #208 from sgnn7/add_service_example
Added SystemD example service file
2016-02-17 04:45:18 -05:00
Jehiah Czebotar 97ec9995aa Merge pull request #213 from rhencke/patch-1
Fix small typo in README.md.
2016-02-17 04:42:58 -05:00
Robert Hencke 51dbc9fb9b Fix small typo in README.md. 2016-02-16 17:07:26 -05:00
Jehiah Czebotar b1ccb058d3 Merge pull request #210 from funkymrrogers/master
fixed formatting
2016-02-13 08:43:01 -05:00
Alex c0a18a5cb3 fixed formatting 2016-02-13 01:41:10 -06:00
Srdjan Grubor b14be4974f Added SystemD example service file
Since most people want to run this as a service, having some sort of an
example file is very useful to have.
2016-02-12 13:22:33 -06:00
Jehiah Czebotar 36128e971f Merge pull request #197 from ruta-goomba/enterprise-github
use Github provider with GitHub enterprise
2016-02-06 13:24:48 -06:00
Chris Hundt f74ad56599 Add URL fragment to sign-in form
This allows a seamless transition for applications that encode
state in the fragment.
2016-01-25 13:43:55 -05:00
Ruta Sakalauskaite 79b548dae6 modifying README to add information about use with enterprise github 2016-01-21 21:54:29 +00:00
Ruta Sakalauskaite a9cf8b3313 adding enterprise github provider
print the error stack trace

point to my fork in oauthproxy.go

addint pointers to ruta-goomba fork in mulitple files

change api endpoint

replace hard-coded github api endpoint with variables

resetting fall through github urls to point to github.com

fix malformed url

changes to enable use with enterprise github
2016-01-21 21:22:18 +00:00
Eelco Cramer 10f47e325b Add Azure Provider 2016-01-20 03:57:17 -05:00
Jehiah Czebotar d5a332c3f2 Merge pull request #194 from r4um/validate-state
Validate state param while redirecting.
2016-01-19 10:21:32 -05:00
Pranay Kanwar f957a1e435 Validate state param while redirecting 2016-01-19 13:14:16 +05:30
Jehiah Czebotar 613a342115 Merge pull request #184 from stanhu/trim-trailing-spaces
Ignore spaces in authorized emails list
2015-12-23 07:43:36 -05:00
Stan Hu dd4642813b Ignore spaces in authorized emails list 2015-12-23 00:08:51 -08:00
Jehiah Czebotar beebf4dff9 Merge pull request #182 from funkymrrogers/master
Google UI changes
2015-12-16 20:20:48 -05:00
funkymrrogers 0fad1da1df Google UI changes
Google changed to developer console UI, updated walkthrough to match new UI.
2015-12-16 19:10:38 -06:00
Mike Bland e4626c1360 Sign Upstream requests with HMAC. closes #147 2015-11-15 22:09:30 -05:00
Reda Ahdjoudj 35547a40cb adding option to skip provider button sign_in page 2015-11-11 11:42:35 +11:00
Jehiah Czebotar 7c241ec1fe Merge pull request #153 from 18F/auth-only-endpoint
Add /auth endpoint to support Nginx's auth_request
2015-11-09 11:12:16 -05:00
Mike Bland d247274b06 Add nginx auth_request config to README 2015-11-09 11:00:18 -05:00
Mike Bland 462f6d03d2 Extract Authenticate for Proxy, AuthenticateOnly 2015-11-09 10:32:16 -05:00
Mike Bland e61fc9e7a6 Add /auth endpoint to support Nginx's auth_request
Closes #152.
2015-11-09 10:31:41 -05:00
Jehiah Czebotar e6e2dbe459 Merge pull request #164 from philips/go-code-style
Go code style
2015-11-09 09:37:11 -05:00
Brandon Philips 6db18804f3 *: rename Oauth to OAuth
Be consistent with Go capitalization styling and use a single way of
spelling this across the tree.
2015-11-09 00:57:01 +01:00
Brandon Philips 1ff2fce25b oauthproxy: rename Uri to URI
Be consistent with Go coding style for acroynyms.
2015-11-09 00:50:42 +01:00
Brandon Philips 51a2e4e48c *: rename Url to URL everywhere
Go coding style says that acronyms should be all lower or all upper. Fix
Url to URL.
2015-11-09 00:47:44 +01:00
Jehiah Czebotar 1b0144ba75 Merge pull request #148 from johnboxall/patch-1
Pass `ProxyPrefix` into the error template.
2015-10-03 20:06:23 -04:00
John Boxall a653c3eeeb Pass `ProxyPrefix` into the error template.
The default `error.html` uses `ProxyPrefix` but it isn't supplied in the context, causing it to error.
2015-10-03 15:59:47 -07:00
Jehiah Czebotar 3ed828ef45 Merge pull request #142 from Tenzer/static-file-server
Add support for serving static files from a directory
2015-09-24 09:48:04 -04:00
Jeppe Toustrup ffeccfe552 Add support for serving static files from a directory
The path should be provided as a file:// url with the full operating system path.
An alias to where the directory is available as can be specified by appending
a fragment (ie. "#/static/") at the end of the URL.
2015-09-24 15:37:45 +02:00
Jehiah Czebotar 2a784ae0d0 Merge pull request #139 from jburnham/google_group_auth
[RDY] google: Support restricting access to a specific group(s)
2015-09-09 07:19:33 -04:00
Justin Burnham 3fd8f911c2 google: Support restricting access to a specific group(s) 2015-09-09 02:10:32 -07:00
Jehiah Czebotar d1c0208824 Merge pull request #131 from ebardsley/master
Allow passing the value of "approval_prompt" as a flag or option.
2015-08-27 07:33:07 -04:00
Jehiah Czebotar ba81a0d30a Merge pull request #137 from guotie/master
Update github.go
2015-08-25 12:22:40 -04:00
铁哥 8da7325683 Update github.go 2015-08-26 00:11:24 +08:00
Jehiah Czebotar 7ba51ba9f2 Merge pull request #133 from sricola/master
Google auth configuration screen flow has changed
2015-08-09 15:22:02 -04:00
Srivatsa Ray 85fcd66be6 Google auth configuration screen flow has changed 2015-08-09 12:08:21 -07:00
Ed Bardsley 33045a792b Add a flag to set the value of "approval_prompt".
By setting this to "force", certain providers, like Google,
will interject an additional prompt on every new session. With other values,
like "auto", this prompt is not forced upon the user.
2015-07-31 00:43:47 -07:00
Jehiah Czebotar 5ff8aa3581 Merge pull request #128 from jehiah/github_debug_128
provider github not work with scope read:org
2015-07-28 07:58:54 -04:00
Jehiah Czebotar 221c99b1ec Merge pull request #130 from mrwacky42/patch-1
Fix spelling
2015-07-24 17:35:26 -04:00
Sharif Nassar f3353c0eea Fix spelling
*snicker*
*titter*
*giggle*
2015-07-24 14:31:25 -07:00
Jehiah Czebotar 0692c3763f More robust handling for missing email 2015-07-24 16:26:40 -04:00
Jehiah Czebotar c1bf1ad167 github: better debug output for org/team validation 2015-07-24 16:10:10 -04:00
Jehiah Czebotar 1e48d89e00 clarify required email validation settings 2015-07-24 16:09:33 -04:00
Jehiah Czebotar c086bddcbe Merge pull request #129 from jburnham/basic_auth_password
Add support for setting the basic auth password.
2015-07-24 11:06:32 -04:00
Justin Burnham 7dd5d299e1 Add support for setting the basic auth password.
For tools that don't like empty passwords, this change allows
one to set a shared secret password for all users.
2015-07-24 09:17:43 +00:00
Jehiah Czebotar 58d2b88406 Merge pull request #126 from mattk42/master
Check email validity on all requests rather than only on login.
2015-07-14 12:04:44 -04:00
mattk42 6cd3e72e09 Check email validity on all requests rather than only on login/refresh 2015-07-14 08:40:59 -06:00
Jehiah Czebotar 3a792555f1 tag v2.0.1 2015-07-02 23:29:25 -04:00
Jehiah Czebotar 51852c045a Doc updates clarifying external Load Balancer config 2015-07-02 23:21:59 -04:00
Jehiah Czebotar 01c9d04feb Merge pull request #117 from jehiah/always_refresh_117
Google - continually use refresh token
2015-07-02 23:14:01 -04:00
Jehiah Czebotar d49c3e167f SessionState refactoring; improve token renewal and cookie refresh
* New SessionState to consolidate email, access token and refresh token
* split ServeHttp into individual methods
* log on session renewal
* log on access token refresh
* refactor cookie encription/decription and session state serialization
2015-07-02 23:09:11 -04:00
Jehiah Czebotar b9ae5dc8d7 Merge pull request #116 from jehiah/google_refresh_token_116
Google - use offline access token
2015-06-23 14:01:35 -04:00
Jehiah Czebotar aa0a725a3a Readme: doc updates 2015-06-23 14:01:05 -04:00
Jehiah Czebotar 8d50b372e4 immediately redeem refresh token for provider==Google 2015-06-23 13:56:14 -04:00
Jehiah Czebotar ae2a1e55ab Merge pull request #115 from jehiah/cookie_renew_115
Cookie Refresh Improvements
2015-06-23 07:57:07 -04:00
Jehiah Czebotar e9b5631eed cookie refresh: validation fixes, interval changes
* refresh now calculated as duration from cookie set
2015-06-23 07:51:00 -04:00
Jehiah Czebotar 66a0484721 Merge pull request #111 from jehiah/version_two_111
Release Version Two
2015-06-12 13:12:20 -04:00
Jehiah Czebotar d78aa13464 v2.0 & cleanup changes
* bump version to 2.0
* remove --cookie-https-only option
* add windows build to dist.sh
* rename --cookie-key to --cookie-name
2015-06-12 13:07:26 -04:00
Jehiah Czebotar 1946739e98 Merge pull request #99 from jehiah/ssl_99
Native SSL support
2015-06-07 23:36:02 -04:00
Jehiah Czebotar f5b2b20f67 support TLS directly 2015-06-07 23:14:48 -04:00
Jehiah Czebotar 5a5d6dff7e Merge pull request #108 from jehiah/unmarshal_error_108
Page defaults to Google sign in
2015-06-07 21:06:50 -04:00
Jehiah Czebotar f5db2e1ff7 More complete HTTP error logging 2015-06-07 21:03:53 -04:00
Jehiah Czebotar 13e82923f0 Merge pull request #109 from jehiah/github_org_109
Github provider "Invalid Account"
2015-06-06 14:54:01 -04:00
Jehiah Czebotar a6694ad3c7 github: handle users part of an Org not on a team 2015-06-06 14:44:42 -04:00
Jehiah Czebotar b313e99352 Merge pull request #91 from jehiah/email_domain_91
disable email validation
2015-06-06 14:43:48 -04:00
Jehiah Czebotar 56d19b1c84 disable email validation; rename email-domain argument
This adds a "*" option to --email-domain to disable email validation, and this renames `--google-apps-domain` to `--email-domain` for clarity across providers
2015-06-06 14:37:54 -04:00
tonymeng c5ccd43767 Enable specific oauth2proxy path; change cookie name to _oauth2proxy 2015-06-06 14:21:42 -04:00
Jehiah Czebotar 71b79baf33 Merge pull request #107 from 18F/fix-validator-test
Fix validator_test hang on Solaris, Plan 9
2015-05-31 00:06:45 -04:00
Mike Bland c3590b5c4c Fix validator_test hang on Solaris, Plan 9
On these platforms, the `done <- true` statement in during TearDown() was
hanging, since the `watcher_unsupported.go` version was never draining the
channel. Also took the opportunity to update the WatchForUpdates() signature
to not return bool anymore.
2015-05-30 22:11:02 -04:00
Jehiah Czebotar 577a3f7f09 Merge pull request #106 from 18F/fix-watcher-build-tags
Fix unsupported WatchForUpdates and build tags
2015-05-30 20:05:40 -04:00
Mike Bland 21f2655280 Fix unsupported WatchForUpdates and build tags
Closes #105.

The `go1.1` constraint has been updated to `!go1.3` per
https://golang.org/pkg/go/build/#hdr-Build_Constraints and
https://github.com/go-fsnotify/fsnotify. Also, the existing call signature for
`WatchForUpdates()` in `watcher_unsupported.go` was stale.
2015-05-30 13:44:18 -04:00
Jehiah Czebotar c6946893e0 example config updates 2015-05-26 09:18:03 -04:00
Jehiah Czebotar 442be96039 Merge pull request #102 from pidah/fix/oauth2_example_filename
rename example file which is referenced in the README
2015-05-26 07:23:41 -04:00
Peter Idah 68618a9107 rename example file which is referenced in the README 2015-05-26 12:00:27 +01:00
Jehiah Czebotar a80aad04f7 Readme Updates 2015-05-21 09:54:21 -04:00
Jehiah Czebotar 4d3b1c4e29 Merge pull request #85 from jehiah/oauth2_proxy_85
Naming Is Hard - project name change
2015-05-21 02:57:51 -04:00
Jehiah Czebotar b96a078839 Project Rename -> oauth2_proxy 2015-05-21 02:55:04 -04:00
Jehiah Czebotar 4de133a016 Merge pull request #98 from jehiah/github_provider_98
Add Github Provider
2015-05-21 02:36:11 -04:00
Jehiah Czebotar 37b38dd2f4 Github provider 2015-05-21 02:21:19 -04:00
Mike Bland 8471f972e1 Move ValidateToken() to Provider 2015-05-21 02:06:23 -04:00
Jehiah Czebotar aca1fe81f4 Merge pull request #93 from 18F/watcher-done
Provide graceful shutdown of file watcher in tests
2015-05-18 17:16:57 -04:00
Mike Bland 020a35e85f Remove file watch upon interruption
TestValidatorOverwriteEmailListViaRenameAndReplace was deadlocking on
Windows because, on Windows, fsnotify.Watcher will continue to watch a
renamed file using its new name. On other systems, it appears the watch on
a file is removed after a rename.

The fix is to explicitly remove the watch to ensure the watch is resumed
under the original name.
2015-05-14 07:57:30 -04:00
Mike Bland 5f2df7167a Ensure watcher tests don't block during shutdown
These test failures from #93 inspired this change:
https://travis-ci.org/bitly/google_auth_proxy/jobs/62474406
https://travis-ci.org/bitly/google_auth_proxy/jobs/62474407

Both tests exhibited this pattern:
2015/05/13 22:10:54 validating: is xyzzy@example.com valid? false
2015/05/13 22:10:54 watching interrupted on event: "/tmp/test_auth_emails_300880185": CHMOD
2015/05/13 22:10:54 watching resumed for /tmp/test_auth_emails_300880185
2015/05/13 22:10:54 reloading after event: "/tmp/test_auth_emails_300880185": CHMOD
panic: test timed out after 1m0s

[snip]

goroutine 175 [chan send]:
github.com/bitly/google_auth_proxy.(*ValidatorTest).TearDown(0xc2080bc330)
        /home/travis/gopath/src/github.com/bitly/google_auth_proxy/validator_test.go:27 +0x43
github.com/bitly/google_auth_proxy.TestValidatorOverwriteEmailListViaRenameAndReplace(0xc2080f2480)
        /home/travis/gopath/src/github.com/bitly/google_auth_proxy/validator_watcher_test.go:103 +0x3b9

[snip]

goroutine 177 [chan send]:
github.com/bitly/google_auth_proxy.func·017()
        /home/travis/gopath/src/github.com/bitly/google_auth_proxy/validator_test.go:34 +0x41

I realized that the spurious CHMOD events were causing calls to
`func() { updated <- true }` (from validator_test.go:34), which caused
the goroutine running the watcher to block. At the same time,
ValidatorTest.TearDown was blocked by trying to send into the `done` channel.
The solution was to create a flag that ensured only one value was ever sent
into the update channel.
2015-05-13 18:48:39 -04:00
Mike Bland 6a0f119fc2 Provide graceful shutdown of file watcher in tests
This test failure from #92 inspired this change:
https://travis-ci.org/bitly/google_auth_proxy/jobs/62425336

2015/05/13 16:27:33 using authenticated emails file /tmp/test_auth_emails_952353477
2015/05/13 16:27:33 watching /tmp/test_auth_emails_952353477 for updates
2015/05/13 16:27:33 validating: is xyzzy@example.com valid? true
2015/05/13 16:27:33 watching interrupted on event: "/tmp/test_auth_emails_952353477": CHMOD
2015/05/13 16:27:33 watching resumed for /tmp/test_auth_emails_952353477
2015/05/13 16:27:33 reloading after event: "/tmp/test_auth_emails_952353477": CHMOD
2015/05/13 16:27:33 watching interrupted on event: "/tmp/test_auth_emails_952353477": REMOVE
2015/05/13 16:27:33 validating: is xyzzy@example.com valid? false
2015/05/13 16:27:33 watching resumed for /tmp/test_auth_emails_952353477
2015/05/13 16:27:33 reloading after event: "/tmp/test_auth_emails_952353477": REMOVE
2015/05/13 16:27:33 failed opening authenticated-emails-file="/tmp/test_auth_emails_952353477", open /tmp/test_auth_emails_952353477: no such file or directory

I believe that what happened was that the call to reload the file after the
second "reloading after event" lost the race when the test shut down and the
file was removed. This change introduces a `done` channel that ensures
outstanding actions complete and the watcher exits before the test removes the
file.
2015-05-13 18:02:22 -04:00
Jehiah Czebotar 254b26d4a0 Merge pull request #89 from 18F/watch-email-file
Reload authenticated-emails-file upon update
2015-05-12 11:08:38 -04:00
Mike Bland ca91b5eddd Reload authenticated-emails-file upon update
This change extracts the UserMap class from NewValidator() so that its
LoadAuthenticatedEmailsFile() method can be called concurrently. This method
is called by a goroutine containing a fsnotify.Watcher watching the
authenticated emails file.

Watching isn't forever aborted when the authenticated emails file disappears.
The goroutine will call os.Stat() up to twenty times a second if the file is
persistently missing, but that's the pathological case, not the common one.

The common case is that some editors (including Vim) will perform a
rename-and-replace when updating a file, triggering fsnotify.Rename events,
and the file will temporarily disappear. This watcher goroutine handles that
case.

Also, on some platforms (notably Arch Linux), a remove will be preceded by a
fsnotify.Chmod, causing a race between the upcoming fsnotify.Remove and the
call to UserMap.LoadAuthenticatedEmailsFile(). Hence, we treat fsnotify.Chmod
the same as fsnotify.Remove and fsnotify.Rename. There's no significant
penalty to re-adding a file to the watcher.

Also contains the following small changes from the summary of commits below:

- Minor optimization of email domain search
- Fixed api_test.go on Windows
- Add deferred File.Close() calls where needed
- Log error and return if emails file doesn't parse

These are the original commits from #89 squashed into this one:

0c6f2b6 Refactor validator_test to prepare for more tests
e0c792b Add more test cases to validator_test
a9a9d93 Minor optimization of email domain search
b763ea5 Extract LoadAuthenticatedEmailsFile()
8cdaf7f Introduce synchronized UserMap type
1b84eef Add UserMap methods, locking
af15dcf Reload authenticated-emails-file upon update
6d95548 Make UserMap operations lock-free
        Per:
        - http://stackoverflow.com/questions/21447463/is-assigning-a-pointer-atomic-in-golang
        - https://groups.google.com/forum/#!msg/golang-nuts/ueSvaEKgyLY/ZW_74IC4PekJ
75755d5 Fix tests on Windows
d0eab2e Ignore email file watcher Chmod events
0b9798b Fix watcher on Ubuntu 12.04
3a8251a WaitForReplacement() to retry emails file watch
a57fd29 Add deferred File.Close() calls where needed
        Because correctness: Don't leak file handles anywhere, and prepare for
        future panics and early returns.
52ed3fd Log error and return if emails file doesn't parse
40100d4 Add gopkg.in/fsnotify.v1 dependency to Godeps file
17dfbbc Avoid a race when Remove is preceded by Chmod
2015-05-12 10:39:18 -04:00
Jehiah Czebotar 9047920e90 Merge pull request #88 from 18F/auto-refresh
Auto refresh auth token
2015-05-11 22:24:50 -04:00
Mike Bland 2808ba7beb Update cookie-refresh doc string 2015-05-11 09:55:07 -04:00
Jehiah Czebotar 5c03fe3840 Merge pull request #90 from 18F/robots-txt
Provide a robots.txt that denies all crawlers
2015-05-10 16:07:36 -04:00
Mike Bland 5b07d9fcef Provide a robots.txt that denies all crawlers 2015-05-10 15:15:52 -04:00
Mike Bland 37f287bef4 Calculate cookie expiration from encoded timestamp
Found out the hard way that _incoming_ cookies do _not_ have their expiration
timestamps encoded. To perform auto-refresh based on expiration time, we have
to recalculate it from the time encoded in the cookie value.
2015-05-10 00:11:26 -04:00
Mike Bland 41b21dd0b1 Enforce that cookie_refresh < cookie_expire 2015-05-09 17:37:33 -04:00
Mike Bland 8ec967ac32 Check cookie_secret size when cookie_refresh set 2015-05-09 17:37:33 -04:00
Mike Bland 082b7c0ec8 Set cookie-refresh flag = 0; update README, config 2015-05-09 17:36:17 -04:00
Mike Bland 84190ab19a Validate user during cookie refresh 2015-05-09 16:54:27 -04:00
Mike Bland 610341a068 Make ProcessCookie() fail when cookie parse fails 2015-05-09 16:54:27 -04:00
Mike Bland bd4eae8fec Store access token when cookie-refresh is set
cookie-refresh now no longer requires pass-access-token in order to work.
2015-05-09 16:54:27 -04:00
Mike Bland b6e07d51b2 Validate access_token when auto-refreshing cookie 2015-05-09 15:09:31 -04:00
Mike Bland 25372567ac ValidateToken() to check access_token validity 2015-05-09 13:17:37 -04:00
Mike Bland 72857018ee Introduce `validate-url` flag/config 2015-05-08 17:13:35 -04:00
Mike Bland 8e2d83600c Implement cookie auto-refresh
The intention is to refresh the cookie whenever the user accesses an
authenticated service with less than `cookie-refresh` time to go before the
cookie expires.
2015-05-08 14:05:09 -04:00
Mike Bland 5cbdb74518 Add ProcessCookie() test 2015-05-08 14:05:09 -04:00
Mike Bland f554f99abd Ensure all errors are logged in ProcessCookie() 2015-05-08 14:05:09 -04:00
Mike Bland beed9fb9a2 Extract MakeCookie() 2015-05-08 14:05:09 -04:00
Mike Bland 1bd90cefe7 Extract ProcessCookie() from ServeHTTP() 2015-05-08 12:41:22 -04:00
Jehiah Czebotar 26170c56af Merge pull request #84 from balshor/master
Add LinkedIn provider
2015-04-17 23:40:23 -04:00
Darren Lee 5bc77b0ee8 LinkedIn OAuth support. 2015-04-17 17:35:40 -07:00
Jehiah Czebotar 78e080ec46 Merge pull request #83 from 18F/case-insensitive-comparisons
Make address/domain comparisons case-insensitive
2015-04-17 20:01:47 -04:00
Mike Bland 781f34e817 Make address/domain comparisons case-insensitive 2015-04-07 17:25:46 -04:00
Jehiah Czebotar 9534808a0d Merge pull request #81 from 18F/access-token-refactor
Refactor pass_access_token changes from #80
2015-04-07 16:48:07 -04:00
Mike Bland 83ad43a571 Make proper PassAccessTokenTest methods 2015-04-07 10:11:35 -04:00
Mike Bland 9887ac3be5 Refactor cookie building and parsing
Extracts buildCookieValue() and parseCookieValue() from OauthProxy.ServeHTTP()
and adds tests for both.
2015-04-07 05:53:41 -04:00
Mike Bland cf79fd9e4c Refactor pass_access_token+cookie_secret check
Moves the check from NewOauthProxy() to Options.Validate() and adds a test.
2015-04-07 05:53:40 -04:00
Mike Bland ca32394c6f Add vim .swp files to gitignore 2015-04-07 05:53:40 -04:00
Jehiah Czebotar b0f0409f2b Merge pull request #82 from 18F/sign-in-redirect
Redirect to / when /oauth2/sign_in accessed
2015-04-06 23:20:26 -04:00
Mike Bland 5f747bb768 Redirect to / when /oauth2/sign_in accessed
Without this change, clicking the sign-in button on /oauth2/sign_in will
always redirect back to /oauth2/sign_in, essentially creating an infinite
loop.
2015-04-06 22:10:03 -04:00
Jehiah Czebotar 864d4787e9 Merge pull request #80 from 18F/pass-access-token
Pass the access token to the upstream server
2015-04-03 15:45:22 -04:00
Mike Bland ad3c9a886f Pass the access token to the upstream client
This is accomplished by encoding the access_token in the auth cookie and
unpacking it as the X-Forwarded-Access-Token header for upstream requests.
2015-04-03 15:32:01 -04:00
Mike Bland a9837f90aa Ensure TestNewReverseProxy() passes when offline
This reflects the apparent intent of TestNewReverseProxy(). Without this
change, the test will fail when run without an Internet connection.
2015-04-02 21:38:48 -04:00
Jehiah Czebotar 66d4d72d2e Merge pull request #79 from 18F/add-myusa-provider
Add myusa provider
2015-03-31 15:59:11 -04:00
Mike Bland 291a0b76b9 Add alternate provider information to README 2015-03-31 15:31:22 -04:00
Mike Bland 59c3ba40f6 Add MyUSA provider 2015-03-31 15:17:17 -04:00
Jehiah Czebotar 243dbb77fb Merge pull request #78 from 18F/generalize-templates
Add ProviderName field; use in sign_in template
2015-03-31 13:21:03 -04:00
Mike Bland 666e6ad436 Add ProviderName field; use in sign_in template 2015-03-31 12:59:07 -04:00
Jehiah Czebotar 0136ab01fd Merge pull request #77 from 18F/extract-providers-package
Extract providers package
2015-03-31 10:22:52 -04:00
Mike Bland d9a945ebc3 Integrate Provider into Options and OauthProxy 2015-03-31 09:34:50 -04:00
Mike Bland e2931da853 Create providers package with Google default 2015-03-31 09:34:50 -04:00
Jehiah Czebotar 41044ecac0 Merge pull request #76 from 18F/extract-api-package
Extract api package
2015-03-30 22:47:16 -04:00
Mike Bland 45286af4a4 s/18F/bitly/ in import path 2015-03-30 11:42:37 -04:00
Mike Bland 9d8f932797 Extract api package
This is the first step towards genericizing the google_auth_proxy to support
OAuth2 providers other than Google as discussed in #65. The `api` package will
enable multiple providers to use the same `api.Request()` implementation.
2015-03-30 10:23:30 -04:00
Jehiah Czebotar fd74eae9c3 tag 1.1.1 2015-03-23 09:19:24 -04:00
Jehiah Czebotar e1f4941522 Merge pull request #74 from jehiah/request_path_74
request path contains full URL
2015-03-22 07:56:05 -04:00
Jehiah Czebotar 16f2c981f3 fix upstream request path 2015-03-21 15:29:07 -04:00
670 changed files with 88663 additions and 1522 deletions

14
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,14 @@
FROM mcr.microsoft.com/vscode/devcontainers/go:1-1.23
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
pre-commit \
vim \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /go/pkg \
&& chmod -R a+w /go/pkg
WORKDIR /workspace

View File

@ -0,0 +1,45 @@
{
"name": "oauth2-proxy Dev",
"context": "..",
"dockerFile": "./Dockerfile",
"postCreateCommand": "pre-commit install && go mod download",
"containerEnv": { "DEVCONTAINER": "1" },
"appPort": ["4180:4180"],
"runArgs": ["-e", "GIT_EDITOR=code --wait"],
"customizations": {
"vscode": {
"extensions": [
"golang.go",
"ms-vscode.makefile-tools",
"visualstudioexptteam.vscodeintellicode",
"redhat.vscode-yaml",
"esbenp.prettier-vscode",
"GitHub.vscode-pull-request-github"
],
"settings": {
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true,
"yaml.customTags": [
"!input scalar",
"!secret scalar",
"!include_dir_named scalar",
"!include_dir_list scalar",
"!include_dir_merge_list scalar",
"!include_dir_merge_named scalar"
]
}
}
},
"features": {
"ghcr.io/devcontainers/features/docker-in-docker": {},
"ghcr.io/devcontainers/features/common-utils": {
"configureZshAsDefaultShell": true,
"username": "vscode",
"userUid": 1000,
"userGid": 1000
},
"ghcr.io/devcontainers/features/kubectl-helm-minikube": {}
}
}

6
.dockerignore Normal file
View File

@ -0,0 +1,6 @@
Dockerfile.dev
Dockerfile
docs
vendor
.git
oauth2-proxy

23
.github/CODEOWNERS vendored Normal file
View File

@ -0,0 +1,23 @@
# Default owner should be a core org reviewers unless overridden by later rules in this file
* @oauth2-proxy/reviewers
# login.gov provider
# Note: If @timothy-spencer terms out of his appointment, your best bet
# for finding somebody who can test the oauth2-proxy would be to ask somebody
# in the login.gov team (https://login.gov/developers/), the cloud.gov team
# (https://cloud.gov/docs/help/), or the 18F org (https://18f.gsa.gov/contact/
# or the public devops channel at https://chat.18f.gov/).
providers/logingov.go @timothy-spencer
providers/logingov_test.go @timothy-spencer
# Bitbucket provider
providers/bitbucket.go @aledeganopix4d
providers/bitbucket_test.go @aledeganopix4d
# Nextcloud provider
providers/nextcloud.go @Ramblurr
providers/nextcloud_test.go @Ramblurr
# DigitalOcean provider
providers/digitalocean.go @kamaln7
providers/digitalocean_test.go @kamaln7

15
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,15 @@
# These are supported funding model platforms
github: tuunit # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: oauth2-proxy # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
polar: # Replace with a single Polar username
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
thanks_dev: # Replace with a single thanks.dev username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

73
.github/ISSUE_TEMPLATE/bug-report.yml vendored Normal file
View File

@ -0,0 +1,73 @@
name: Bug report
description: Bug descriptions or unexpected behaviour
title: "[Bug]: <Short description>"
labels: ["bug","help wanted"]
body:
- type: input
attributes:
label: OAuth2-Proxy Version
description: Which version of oauth2-proxy are you using?
validations:
required: true
- type: dropdown
attributes:
label: Provider
description: Which identity provider are you using?
options:
- adfs
- azure
- bitbucket
- digitalocean
- entra-id
- facebook
- gitea
- github
- gitlab
- google
- keycloak
- keycloak-oidc
- linkedin
- logingov
- nextcloud
- oidc
validations:
required: false
- type: textarea
attributes:
label: Expected Behaviour
description: Tell us what you expect to happen.
validations:
required: true
- type: textarea
attributes:
label: Current Behaviour
description: Tell us what happens instead of the expected behavior.
validations:
required: true
- type: textarea
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behavior.
placeholder: |
1. In this environment...
1. With this config...
1. Run '...'
1. See error...
validations:
required: true
- type: textarea
attributes:
label: Possible Solutions
description: Not obligatory, but suggest a fix/reason for the bug.
validations:
required: false
- type: textarea
attributes:
label: Configuration details or additional information
description: |
Please share more details about your environment and how you configured oauth2-proxy.
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false

6
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1,6 @@
blank_issues_enabled: false
contact_links:
- name: OAuth2-Proxy Slack
url: https://gophers.slack.com/messages/CM2RSS25N
about: Feel free to ask any questions here.

View File

@ -0,0 +1,61 @@
name: Configuration support
description: Configuration problems and overall requests on how to properly use oauth2-proxy.
title: "[Support]: <Short description>"
labels: ["configuration", "help wanted"]
body:
- type: input
attributes:
label: OAuth2-Proxy Version
description: Which version of oauth2-proxy are you using?
validations:
required: true
- type: dropdown
attributes:
label: Provider
description: Which identity provider are you using?
options:
- adfs
- azure
- bitbucket
- digitalocean
- entra-id
- facebook
- gitea
- github
- gitlab
- google
- keycloak
- keycloak-oidc
- linkedin
- logingov
- nextcloud
- oidc
validations:
required: true
- type: textarea
attributes:
label: Current Behaviour of your Problem
description: Tell us what you expect to happen and what happens instead.
validations:
required: true
- type: textarea
attributes:
label: Configuration details or additional information
description: |
Please share more details about your environment and how you configured oauth2-proxy.
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: true
- type: textarea
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behavior.
placeholder: |
1. In this environment...
1. With this config...
1. Run '...'
1. See error...
validations:
required: false

View File

@ -0,0 +1,51 @@
name: Feature request
description: Feature requests or proposals related to the overall project or specific providers
title: "[Feature]: <Short description>"
labels: ["enhancement"]
body:
- type: textarea
attributes:
label: Motivation
description: Tell us the motivation behind your feature request or proposal.
validations:
required: true
- type: textarea
attributes:
label: Possible solution
description: |
If you already have a possible solution in mind. Write some more details about it or add some pseudo code.
Tip 1: You can attach images or log files by clicking this area to highlight it and then dragging files in.
Tip 2: You can add code snippets in triple backtiks like so:
\`\`\`golang
func hello() {
fmt.Println("world")
}
\`\`\`
validations:
required: false
- type: dropdown
attributes:
label: Provider
description: Is it a feature request for a specific provider. Not mandatory.
options:
- new provider
- adfs
- azure
- bitbucket
- digitalocean
- entra-id
- facebook
- gitea
- github
- gitlab
- google
- keycloak
- keycloak-oidc
- linkedin
- logingov
- nextcloud
- oidc
validations:
required: false

26
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,26 @@
<!--- Provide a general summary of your changes in the Title above -->
## Description
<!--- Describe your changes in detail -->
## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->
## How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->
## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [ ] My change requires a change to the documentation or CHANGELOG.
- [ ] I have updated the documentation/CHANGELOG accordingly.
- [ ] I have created a feature (non-master) branch for my PR.
- [ ] I have written tests for my code changes.

35
.github/labeler.yml vendored Normal file
View File

@ -0,0 +1,35 @@
go:
- changed-files:
- any-glob-to-any-file:
- '**/*.go'
docs:
- changed-files:
- any-glob-to-any-file:
- '**/*.md'
changelog:
- changed-files:
- any-glob-to-any-file:
- 'CHAGELOG.md'
tests:
- changed-files:
- any-glob-to-any-file:
- '**/*_test.go'
provider:
- changed-files:
- any-glob-to-any-file:
- 'providers/**/*'
dependencies:
- changed-files:
- any-glob-to-any-file:
- 'go.mod'
- 'go.sum'
docker:
- changed-files:
- any-glob-to-any-file:
- '**/Dockerfile'

58
.github/renovate.json5 vendored Normal file
View File

@ -0,0 +1,58 @@
{
$schema: "https://docs.renovatebot.com/renovate-schema.json",
semanticCommits: "enabled",
schedule: [
"after 8am on sunday"
],
prConcurrentLimit: 0,
prHourlyLimit: 0,
enabledManagers: [
"dockerfile",
"docker-compose",
"gomod",
"github-actions",
"helmv3",
"npm",
"regex",
],
packageRules: [
{
matchManagers: [
"dockerfile",
"docker-compose",
"gomod",
"helmv3",
"npm",
],
groupName: "{{{manager}}}",
},
{
matchDepNames: [
"docker.io/library/golang",
"mcr.microsoft.com/vscode/devcontainers/go",
],
groupName: "golang",
},
],
customManagers: [
{
customType: "regex",
fileMatch: [
"^Makefile",
],
matchStrings: [
"DOCKER_BUILD_RUNTIME_IMAGE_ALPINE\\s+?\\?= alpine:(?<currentValue>.*)\\s"
],
depNameTemplate: "alpine",
datasourceTemplate: "docker",
},
{
customType: "regex",
fileMatch: ["(^|/)\\.github/workflows/[^/]+\\.ya?ml$"],
matchStrings: [
"# renovate: datasource=(?<datasource>.*?) depName=(?<depName>.*?)( versioning=(?<versioning>.*?))?\\s+?[\\w\\s-]*?version: (?<currentValue>.*)\\s",
"# renovate: datasource=(?<datasource>.*?) depName=(?<depName>.*?)( versioning=(?<versioning>.*?))?\\s+?[\\w\\s]*?_VERSION: (?<currentValue>.*)\\s",
],
},
],
}

81
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,81 @@
name: Continuous Integration
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
jobs:
build:
runs-on: ubuntu-latest
env:
COVER: true
steps:
- name: Check out code
uses: actions/checkout@v5
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
id: go
- name: Get dependencies
env:
# renovate: datasource=github-tags depName=golangci/golangci-lint
GOLANGCI_LINT_VERSION: v2.5.0
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
- name: Verify Code Generation
run: |
make verify-generate
- name: Lint
run: |
make lint
- name: Build
if: (!startsWith(github.head_ref, 'release'))
run: |
make build
# For release testing
- name: Build All
if: github.base_ref == 'master' && startsWith(github.head_ref, 'release')
run: |
make release
- name: Test
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: |
./.github/workflows/test.sh
docker:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v5
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Docker Build
if: (!startsWith(github.head_ref, 'release'))
run: |
make build-docker
# For release testing
- name: Docker Build All
if: github.base_ref == 'master' && startsWith(github.head_ref, 'release')
run: |
make build-docker-all

60
.github/workflows/codeql.yml vendored Normal file
View File

@ -0,0 +1,60 @@
name: "Code scanning - action"
on:
push:
branches:
- master
paths-ignore:
- '.devcontainer/**'
- '.vscode/**'
- 'contrib/**'
- 'docs/**'
pull_request:
# The branches below must be a subset of the branches above
branches:
- master
paths-ignore:
- '.devcontainer/**'
- '.vscode/**'
- 'contrib/**'
- 'docs/**'
schedule:
- cron: '0 15 * * 2'
jobs:
CodeQL-Build:
strategy:
fail-fast: false
# CodeQL runs on ubuntu-latest and windows-latest
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: go
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3

119
.github/workflows/create-release.yml vendored Normal file
View File

@ -0,0 +1,119 @@
name: Create Release
run-name: Create release ${{ inputs.version }}
on:
workflow_dispatch:
inputs:
version:
description: 'Version for new release'
required: true
permissions:
contents: write
pull-requests: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v5
with:
ref: master
fetch-depth: 0
fetch-tags: true
- name: Validate version
id: validate
run: |
function ver { printf "%03d%03d%03d%03d" $(echo "$1" | tr '.' ' '); }
NEW_VERSION=${{ inputs.version }}
NEW_VERSION=${NEW_VERSION#v} # Remove v prefix
LATEST_VERSION=$(git describe --abbrev=0 --tags)
LATEST_VERSION=${LATEST_VERSION#v} # Remove v prefix
# check that new version can be parsed
if [ ! $(ver $NEW_VERSION ) -gt $(ver 0) ]; then
echo "::error::Entered version '${{ inputs.version }}' cannot be parsed"
exit 1
fi
# check version continuity
if [ ! $(ver $LATEST_VERSION) -lt $(ver $NEW_VERSION) ]; then
echo "::error::Entered version '${{ inputs.version }}' is smaller then latest version $LATEST_VERSION"
exit 1
fi
echo "version=${NEW_VERSION}" >> "$GITHUB_OUTPUT"
- name: Prepare Github Actions Bot
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Setup node
uses: actions/setup-node@v6
with:
node-version-file: docs/package.json
- name: Update documentation
run: |
cd docs
FULL_VERSION=${{ steps.validate.outputs.version }}
VERSION=${FULL_VERSION%.*}.x
if [ ! -d "versioned_docs/version-${VERSION}" ]; then
npm install
npm run docusaurus docs:version ${VERSION}
git add .
git commit -m "add new docs version ${VERSION}"
fi
sed -i "s/(current release is .*)/(current release is \`v${FULL_VERSION}\`)/g" docs/installation.md
sed -i "s/(current release is .*)/(current release is \`v${FULL_VERSION}\`)/g" versioned_docs/version-${VERSION}/installation.md
- name: Update Changelog
run: |
VERSION=${{ steps.validate.outputs.version }}
sed -i "s/#.*(Pre-release)/# V${VERSION}/g" CHANGELOG.md
cat << EOF > /tmp/CHANGELOG.prepend
# Vx.x.x (Pre-release)
## Release Highlights
## Important Notes
## Breaking Changes
## Changes since v${VERSION}
EOF
echo -e "$(cat /tmp/CHANGELOG.prepend)\n\n$(cat CHANGELOG.md)" > CHANGELOG.md
- name: Update development files
run: |
VERSION=${{ steps.validate.outputs.version }}
cd contrib
grep -rl "quay.io/oauth2-proxy/oauth2-proxy:" | \
xargs sed -i "s#quay.io/oauth2-proxy/oauth2-proxy:v[0-9]\+\.[0-9]\+\.[0-9]\+#quay.io/oauth2-proxy/oauth2-proxy:v${VERSION}#g"
- name: Commit and push
run: |
VERSION=${{ steps.validate.outputs.version }}
git checkout -b release/v${VERSION}
git commit -am "update to release version v${VERSION}"
git push -u origin release/v${VERSION}
- name: Create PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=v${{ steps.validate.outputs.version }}
gh pr create -B master -H release/${VERSION} --title "release ${VERSION}" --body "Release branch and changes created by GitHub Actions. This PR should include changes to the docs, CHANGELOG and local environment files."

68
.github/workflows/docs.yml vendored Normal file
View File

@ -0,0 +1,68 @@
name: documentation
on:
pull_request:
branches: [master]
paths: ['docs/**']
push:
branches: [master]
paths: ['docs/**']
workflow_dispatch:
jobs:
pull-request-check:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- uses: actions/setup-node@v6
with:
# renovate: datasource=node-version depName=node
node-version: 22
- name: Test Build
working-directory: ./docs
run: |
npm install
npm run build
build-docs:
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
# renovate: datasource=node-version depName=node
node-version: 22
- name: Build docusaurus
working-directory: ./docs
run: |
npm install
npm run build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./docs/build
deploy-docs:
needs: build-docs
runs-on: ubuntu-latest
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

14
.github/workflows/e2e.yml vendored Normal file
View File

@ -0,0 +1,14 @@
name: E2E
on:
issue_comment:
types: [created]
jobs:
e2e:
uses: oauth2-proxy/e2e-suite/.github/workflows/e2e.yml@main
permissions:
contents: read
statuses: write
issues: write
pull-requests: write

15
.github/workflows/labeler.yml vendored Normal file
View File

@ -0,0 +1,15 @@
name: "Pull Request Labeler"
on:
pull_request_target:
jobs:
triage:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v6
with:
sync-labels: true
dot: true

41
.github/workflows/nightly.yml vendored Normal file
View File

@ -0,0 +1,41 @@
name: Nightly builds
on:
schedule: # Run every day at 03:00 UTC
- cron: '0 3 * * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
# only run this build in the main repository, not in forks
if: github.repository == 'oauth2-proxy/oauth2-proxy'
steps:
- name: Check out code
uses: actions/checkout@v5
with:
ref: master
fetch-depth: 0
fetch-tags: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to quay.io
uses: docker/login-action@v3
with:
registry: quay.io/oauth2-proxy
username: ${{ secrets.REGISTRY_USERNAME_NIGHTLY }}
password: ${{ secrets.REGISTRY_PASSWORD_NIGHTLY }}
- name: Build images
run: |
make nightly-build
- name: Push images
run: |
make nightly-push

129
.github/workflows/publish-release.yml vendored Normal file
View File

@ -0,0 +1,129 @@
name: Publish Release
run-name: ${{ github.event.pull_request.head.ref }}
on:
pull_request_target:
branches:
- master
types:
- closed
permissions:
contents: write
pull-requests: write
jobs:
publish:
if: github.event.pull_request.merged && startsWith(github.event.pull_request.head.ref, 'release/')
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.version }}
steps:
- name: Check out code
uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
fetch-depth: 0
fetch-tags: true
- name: Tag release
run: |
# Set up github-actions[bot] user
git config --local user.name "github-actions[bot]"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
# Get the version from the branch name
branch="${{ github.event.pull_request.head.ref }}"
version="${branch#release/}"
echo ${version}
# Tag and create release
git tag -a "${version}" -m "Release ${version}"
echo "version=${version}" >> $GITHUB_OUTPUT
id: tag
- name: Set up go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Get dependencies
env:
# renovate: datasource=github-tags depName=golangci/golangci-lint
GOLANGCI_LINT_VERSION: v2.5.0
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
# Install go dependencies
go mod download
- name: Build Artifacts
run: make release
# Upload artifacts in case of workflow failure
- name: Upload Artifacts
uses: actions/upload-artifact@v5
with:
name: oauth2-proxy-artifacts
path: |
release/*.tar.gz
release/*.txt
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
run: |
# Get version from tag
version=$(git describe --tags --abbrev=0)
# Extract CHANGELOG
numericVersion="${version#v}"
notes=$(sed -E "/^# (v|V)$numericVersion$/,/^# (v|V)/!d;//d" CHANGELOG.md)
# Publish release tag
git push origin "${version}"
# Create github release
gh release create "${version}" \
--title "${version}" \
--notes "${notes}" \
--prerelease
# Upload artifacts
gh release upload "${version}" release/*.tar.gz
gh release upload "${version}" release/*.txt
docker:
needs: publish
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v5
with:
ref: ${{ needs.publish.outputs.tag }}
fetch-depth: 0
fetch-tags: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to quay.io
uses: docker/login-action@v3
with:
registry: quay.io/oauth2-proxy
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build images
run: |
make build-docker-all
- name: Push images
run: |
make push-docker-all

21
.github/workflows/stale.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: Mark stale issues and pull requests
on:
schedule:
- cron: "0 0 * * *"
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v10
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-stale: 180
days-before-close: 14
stale-issue-message: 'This issue has been inactive for 180 days. If the issue is still relevant please comment to re-activate the issue. If no action is taken within 14 days, the issue will be marked closed.'
stale-pr-message: 'This pull request has been inactive for 180 days. If the pull request is still relevant please comment to re-activate the pull request. If no action is taken within 14 days, the pull request will be marked closed.'
exempt-issue-labels: bug,high-priority
exempt-pr-labels: bug,high-priority

26
.github/workflows/test.sh vendored Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
# manually exiting from script, because after-build needs to run always
set +e
if [ -z $CC_TEST_REPORTER_ID ]; then
echo "1. CC_TEST_REPORTER_ID is unset, skipping"
else
echo "1. Running before-build"
./cc-test-reporter before-build
fi
echo "2. Running test"
make test
TEST_STATUS=$?
if [ -z $CC_TEST_REPORTER_ID ]; then
echo "3. CC_TEST_REPORTER_ID is unset, skipping"
else
echo "3. Running after-build"
./cc-test-reporter after-build --exit-code $TEST_STATUS --prefix $(go list -m)
fi
if [ "$TEST_STATUS" -ne 0 ]; then
echo "Test failed, status code: $TEST_STATUS"
exit $TEST_STATUS
fi

27
.gitignore vendored
View File

@ -1,4 +1,13 @@
google_auth_proxy
oauth2-proxy
vendor
dist
release
.godeps
*.exe
.env
.bundle
c.out
# Go.gitignore
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
@ -8,6 +17,10 @@ google_auth_proxy
# Folders
_obj
_test
.DS_Store
.idea/
.vscode/*
!/.vscode/tasks.json
# Architecture specific extensions/prefixes
*.[568vq]
@ -21,6 +34,12 @@ _cgo_export.*
_testmain.go
*.exe
dist
.godeps
# Editor swap/temp files
.*.swp
# Dockerfile.dev is ignored by both git and docker
# for faster development cycle of docker build
# cp Dockerfile Dockerfile.dev
# vi Dockerfile.dev
# docker build -f Dockerfile.dev .
Dockerfile.dev

69
.golangci.yml Normal file
View File

@ -0,0 +1,69 @@
version: "2"
linters:
default: none
enable:
- bodyclose
- copyloopvar
- dogsled
- goconst
- gocritic
- goprintffuncname
- gosec
- govet
- ineffassign
- misspell
- prealloc
- revive
- staticcheck
- unconvert
- unused
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- bodyclose
- goconst
- gocritic
- gosec
- revive
- scopelint
- unconvert
path: _test\.go
- linters:
- revive
path: _test\.go
text: 'dot-imports:'
# # If we have tests in shared test folders, these can be less strictly linted
- linters:
- bodyclose
- revive
- staticcheck
path: tests/.*_tests\.go
# See https://github.com/oauth2-proxy/oauth2-proxy/issues/3060
# https://staticcheck.dev/docs/checks/#QF1008
- linters:
- staticcheck
text: QF1008
- linters:
- revive
path: util/.*\.go$
text: "var-naming: avoid meaningless package names"
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$

13
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,13 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.0
hooks:
- id: golangci-lint
- id: go-build

View File

@ -1,12 +0,0 @@
language: go
go:
- 1.3.3
- 1.4.2
script:
- curl -s https://raw.githubusercontent.com/pote/gpm/v1.3.1/bin/gpm > gpm
- chmod +x gpm
- ./gpm install
- ./test.sh
notifications:
email: false

36
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,36 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "OAuth2 Proxy for Dex",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}",
"args": [
"--config", "contrib/local-environment/oauth2-proxy.cfg"
]
},
{
"name": "OAuth2 Proxy for Keycloak",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}",
"args": [
"--config", "contrib/local-environment/oauth2-proxy-keycloak.cfg"
]
},
{
"name": "OAuth2 Proxy with Alpha Config",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}",
"args": [
"--config", "contrib/local-environment/oauth2-proxy-alpha-config.cfg",
"--alpha-config", "contrib/local-environment/oauth2-proxy-alpha-config.yaml"
]
}
]
}

76
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,76 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Run oauth2-proxy",
"type": "shell",
"command": "./oauth2-proxy --config contrib/local-environment/oauth2-proxy.cfg --alpha-config contrib/local-environment/oauth2-proxy-alpha0config.cfg",
"dependsOn": ["Build"],
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
},
{
"label": "Test",
"type": "shell",
"command": "make test",
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
},
{
"label": "Ruff",
"type": "shell",
"command": "pre-commit run ruff --all-files",
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
},
{
"label": "golint",
"type": "shell",
"command": "make lint",
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
},
{
"label": "Build",
"type": "shell",
"command": "make build",
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
}
]
}

28
ADOPTERS.md Normal file
View File

@ -0,0 +1,28 @@
# Adopters
This list showcases organizations that leverage OAuth2-Proxy within their
infrastructure. If your organization uses OAuth2-Proxy and isn't yet listed, we
encourage you to add it!
This list aims to be a comprehensive and trusted resource for the OAuth2-Proxy
community, demonstrating successful adoption across all kinds of industries.
Contributing to this list is a simple way to impact the project's growth,
maturity, and momentum. Thank you to all adopters and contributors of the
OAuth2-Proxy project!
## Updating this list
To add your organization to this list, you can just [open a PR](https://github.com/oauth2-proxy/oauth2-proxy/pulls)
to directly update this list.
Add your organization name, your github username and if you desire a short
description on how you utilize oauth2-proxy.
## OAuth2-Proxy Adopters
This list is sorted in the order that organizations were added to it.
| Organization | Contact | Description of Use |
| ------------ | ------- | ------------------ |
| | | |

1364
CHANGELOG.md Normal file

File diff suppressed because it is too large Load Diff

134
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1,134 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders 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, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
https://gophers.slack.com/messages/CM2RSS25N or directly contacting one of the
maintainers from the MAINTAINERS file.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series of
actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within the
community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].
[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations

23
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,23 @@
# Contributing
To develop on this project, please fork the repo and clone into your `$GOPATH`.
Dependencies are **not** checked in so please download those separately.
Download the dependencies using `go mod download`.
```bash
cd $GOPATH/src/github.com # Create this directory if it doesn't exist
git clone git@github.com:<YOUR_FORK>/oauth2-proxy oauth2-proxy/oauth2-proxy
cd oauth2-proxy/oauth2-proxy
go mod download
```
## Pull Requests and Issues
We track bugs and issues using Github.
If you find a bug, please open an Issue.
If you want to fix a bug, please fork, create a feature branch, fix the bug and
open a PR back to this repo.
Please mention the open bug issue number within your PR if applicable.

74
Dockerfile Normal file
View File

@ -0,0 +1,74 @@
# The image ARGs have to be at the top, otherwise the docker daemon cannot validate
# the FROM statements and overall Dockerfile
#
# Argument for setting the build image
ARG BUILD_IMAGE=placeholder
# Argument for setting the runtime image
ARG RUNTIME_IMAGE=placeholder
# Argument for setting the oauth2-proxy build version
ARG VERSION
# All builds should be done using the platform native to the build node to allow
# cache sharing of the go mod download step.
# Go cross compilation is also faster than emulation the go compilation across
# multiple platforms.
FROM --platform=${BUILDPLATFORM} ${BUILD_IMAGE} AS builder
# Copy sources
WORKDIR $GOPATH/src/github.com/oauth2-proxy/oauth2-proxy
# Fetch dependencies
COPY go.mod go.sum ./
RUN go mod download
# Now pull in our code
COPY . .
# Arguments go here so that the previous steps can be cached if no external sources
# have changed. These arguments are automatically set by the docker engine.
ARG TARGETPLATFORM
ARG BUILDPLATFORM
# Reload version argument
ARG VERSION
# Build binary and make sure there is at least an empty key file.
# This is useful for GCP App Engine custom runtime builds, because
# you cannot use multiline variables in their app.yaml, so you have to
# build the key into the container and then tell it where it is
# by setting OAUTH2_PROXY_JWT_KEY_FILE=/etc/ssl/private/jwt_signing_key.pem
# in app.yaml instead.
# Set the cross compilation arguments based on the TARGETPLATFORM which is
# automatically set by the docker engine.
RUN case ${TARGETPLATFORM} in \
"linux/amd64") GOARCH=amd64 ;; \
# arm64 and arm64v8 are equivalent in go and do not require a goarm
# https://github.com/golang/go/wiki/GoArm
"linux/arm64" | "linux/arm/v8") GOARCH=arm64 ;; \
"linux/ppc64le") GOARCH=ppc64le ;; \
"linux/s390x") GOARCH=s390x ;; \
"linux/arm/v6") GOARCH=arm GOARM=6 ;; \
"linux/arm/v7") GOARCH=arm GOARM=7 ;; \
esac && \
printf "Building OAuth2 Proxy for arch ${GOARCH}\n" && \
GOARCH=${GOARCH} VERSION=${VERSION} make build && touch jwt_signing_key.pem
# Reload runtime image
ARG RUNTIME_IMAGE
# Copy binary to runtime image
FROM ${RUNTIME_IMAGE}
# Reload version
ARG VERSION
COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/oauth2-proxy /bin/oauth2-proxy
COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/jwt_signing_key.pem /etc/ssl/private/jwt_signing_key.pem
LABEL org.opencontainers.image.licenses=MIT \
org.opencontainers.image.description="A reverse proxy that provides authentication with Google, Azure, OpenID Connect and many more identity providers." \
org.opencontainers.image.documentation=https://oauth2-proxy.github.io/oauth2-proxy/ \
org.opencontainers.image.source=https://github.com/oauth2-proxy/oauth2-proxy \
org.opencontainers.image.url=https://quay.io/oauth2-proxy/oauth2-proxy \
org.opencontainers.image.title=oauth2-proxy \
org.opencontainers.image.version=${VERSION}
ENTRYPOINT ["/bin/oauth2-proxy"]

4
Godeps
View File

@ -1,4 +0,0 @@
github.com/BurntSushi/toml 3883ac1ce943878302255f538fce319d23226223
github.com/bitly/go-simplejson 3378bdcb5cebedcbf8b5750edee28010f128fe24
github.com/mreiferson/go-options ee94b57f2fbf116075426f853e5abbcdfeca8b3d
github.com/bmizerany/assert e17e99893cb6509f428e1728281c2ad60a6b31e3

5
MAINTAINERS Normal file
View File

@ -0,0 +1,5 @@
Joel Speed <joel@oauth2-proxy.dev> (@JoelSpeed)
Nick Meves <nick@oauth2-proxy.dev> (@NickMeves)
Braunson <braunson@oauth2-proxy.dev> (@braunsonm)
Jan Larwig <jan@oauth2-proxy.dev> (@tuunit)
Koen van Zuijlen <koen@oauth2-proxy.dev> (@kvanzuijlen)

170
Makefile Normal file
View File

@ -0,0 +1,170 @@
#!/usr/bin/env bash
#
# Makefile with some common workflow for dev, build and test
#
##@ General
# The help target prints out all targets with their descriptions organized
# beneath their categories. The categories are represented by '##@' and the
# target descriptions by '##'. The awk command is responsible for reading the
# entire set of makefiles included in this invocation, looking for lines of the
# file as xyz: ## something, and then pretty-format the target and help. Then,
# if there's a line with ##@ something, that gets pretty-printed as a category.
# More info on the usage of ANSI control characters for terminal formatting:
# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
# More info on the awk command:
# http://linuxcommand.org/lc3_adv_awk.php
# The following help command is Licensed under the Apache License, Version 2.0 (the "License")
# Copyright 2023 The Kubernetes Authors.
.PHONY: help
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
GO ?= go
GOLANGCILINT ?= golangci-lint
BINARY := oauth2-proxy
VERSION ?= $(shell git describe --always --dirty --tags 2>/dev/null || echo "undefined")
# Allow to override image registry.
REGISTRY ?= quay.io/oauth2-proxy
REPOSITORY ?= oauth2-proxy
DATE := $(shell date +"%Y%m%d")
.NOTPARALLEL:
# The go version in go.mod used for the Docker build toolchain, without the patch
GO_MOD_VERSION_MINOR := $(shell $(GO) list -f '{{printf "%.4s" .Module.GoVersion}}' )
# From go1.21 go will transparently download the toolchain declared in go.mod. https://go.dev/doc/toolchain
# We don't need to keep this message updated: the important info is in go.mod.
GO_VERSION_VALIDATION_ERR_MSG = Golang version is not supported, please update to at least go1.21
ifeq ($(COVER),true)
TESTCOVER ?= -coverprofile c.out
endif
##@ Build
.PHONY: build
build: validate-go-version clean $(BINARY) ## Build and create oauth2-proxy binary from current source code
$(BINARY):
CGO_ENABLED=0 $(GO) build -a -installsuffix cgo -ldflags="-X github.com/oauth2-proxy/oauth2-proxy/v7/pkg/version.VERSION=${VERSION}" -o $@ github.com/oauth2-proxy/oauth2-proxy/v7
DOCKER_BUILDX_COMMON_ARGS ?= --build-arg BUILD_IMAGE=docker.io/library/golang:$(GO_MOD_VERSION_MINOR)-bookworm --build-arg VERSION=$(VERSION)
DOCKER_BUILD_PLATFORM ?= linux/amd64,linux/arm64,linux/ppc64le,linux/arm/v7,linux/s390x
DOCKER_BUILD_RUNTIME_IMAGE ?= gcr.io/distroless/static:nonroot
DOCKER_BUILDX_ARGS ?= --build-arg RUNTIME_IMAGE=${DOCKER_BUILD_RUNTIME_IMAGE} ${DOCKER_BUILDX_COMMON_ARGS}
DOCKER_BUILDX := docker buildx build ${DOCKER_BUILDX_ARGS} --pull
DOCKER_BUILDX_X_PLATFORM := $(DOCKER_BUILDX) --platform ${DOCKER_BUILD_PLATFORM}
DOCKER_BUILDX_PUSH := $(DOCKER_BUILDX) --push
DOCKER_BUILDX_PUSH_X_PLATFORM := $(DOCKER_BUILDX_PUSH) --platform ${DOCKER_BUILD_PLATFORM}
DOCKER_BUILD_PLATFORM_ALPINE ?= linux/amd64,linux/arm64,linux/ppc64le,linux/arm/v6,linux/arm/v7,linux/s390x
DOCKER_BUILD_RUNTIME_IMAGE_ALPINE ?= alpine:3.22.2
DOCKER_BUILDX_ARGS_ALPINE ?= --build-arg RUNTIME_IMAGE=${DOCKER_BUILD_RUNTIME_IMAGE_ALPINE} ${DOCKER_BUILDX_COMMON_ARGS}
DOCKER_BUILDX_X_PLATFORM_ALPINE := docker buildx build ${DOCKER_BUILDX_ARGS_ALPINE} --platform ${DOCKER_BUILD_PLATFORM_ALPINE}
DOCKER_BUILDX_PUSH_X_PLATFORM_ALPINE := $(DOCKER_BUILDX_X_PLATFORM_ALPINE) --push
.PHONY: build-docker
build-docker: build-distroless build-alpine ## Build multi architecture docker images in both flavours (distroless / alpine)
.PHONY: build-distroless
build-distroless: ## Build multi architecture distroless based docker image
$(DOCKER_BUILDX_X_PLATFORM) -t $(REGISTRY)/$(REPOSITORY):latest -t $(REGISTRY)/$(REPOSITORY):${VERSION} .
.PHONY: build-alpine
build-alpine: ## Build multi architecture alpine based docker image
$(DOCKER_BUILDX_X_PLATFORM_ALPINE) -t $(REGISTRY)/$(REPOSITORY):latest-alpine -t $(REGISTRY)/$(REPOSITORY):${VERSION}-alpine .
.PHONY: build-docker-all
build-docker-all: build-docker ## Build docker images for all supported architectures in both flavours (distroless / alpine)
$(DOCKER_BUILDX) --platform linux/amd64 -t $(REGISTRY)/$(REPOSITORY):latest-amd64 -t $(REGISTRY)/$(REPOSITORY):${VERSION}-amd64 .
$(DOCKER_BUILDX) --platform linux/arm64 -t $(REGISTRY)/$(REPOSITORY):latest-arm64 -t $(REGISTRY)/$(REPOSITORY):${VERSION}-arm64 .
$(DOCKER_BUILDX) --platform linux/ppc64le -t $(REGISTRY)/$(REPOSITORY):latest-ppc64le -t $(REGISTRY)/$(REPOSITORY):${VERSION}-ppc64le .
$(DOCKER_BUILDX) --platform linux/arm/v7 -t $(REGISTRY)/$(REPOSITORY):latest-armv7 -t $(REGISTRY)/$(REPOSITORY):${VERSION}-armv7 .
$(DOCKER_BUILDX) --platform linux/s390x -t $(REGISTRY)/$(REPOSITORY):latest-s390x -t $(REGISTRY)/$(REPOSITORY):${VERSION}-s390x .
##@ Publish
.PHONY: push-docker
push-docker: push-distroless push-alpine ## Push multi architecture docker images for both flavours (distroless / alpine)
.PHONY: push-distroless
push-distroless: ## Push multi architecture distroless based docker image
$(DOCKER_BUILDX_PUSH_X_PLATFORM) -t $(REGISTRY)/$(REPOSITORY):latest -t $(REGISTRY)/$(REPOSITORY):${VERSION} .
.PHONY: push-alpine
push-alpine: ## Push multi architecture alpine based docker image
$(DOCKER_BUILDX_PUSH_X_PLATFORM_ALPINE) -t $(REGISTRY)/$(REPOSITORY):latest-alpine -t $(REGISTRY)/$(REPOSITORY):${VERSION}-alpine .
.PHONY: push-docker-all
push-docker-all: push-docker ## Push docker images for all supported architectures for both flavours (distroless / alpine)
$(DOCKER_BUILDX_PUSH) --platform linux/amd64 -t $(REGISTRY)/$(REPOSITORY):latest-amd64 -t $(REGISTRY)/$(REPOSITORY):${VERSION}-amd64 .
$(DOCKER_BUILDX_PUSH) --platform linux/arm64 -t $(REGISTRY)/$(REPOSITORY):latest-arm64 -t $(REGISTRY)/$(REPOSITORY):${VERSION}-arm64 .
$(DOCKER_BUILDX_PUSH) --platform linux/ppc64le -t $(REGISTRY)/$(REPOSITORY):latest-ppc64le -t $(REGISTRY)/$(REPOSITORY):${VERSION}-ppc64le .
$(DOCKER_BUILDX_PUSH) --platform linux/arm/v7 -t $(REGISTRY)/$(REPOSITORY):latest-armv7 -t $(REGISTRY)/$(REPOSITORY):${VERSION}-armv7 .
$(DOCKER_BUILDX_PUSH) --platform linux/s390x -t $(REGISTRY)/$(REPOSITORY):latest-s390x -t $(REGISTRY)/$(REPOSITORY):${VERSION}-s390x .
##@ Nightly scheduling
.PHONY: nightly-build
nightly-build: ## Nightly build command for docker images in both flavours (distroless / alpine)
$(DOCKER_BUILDX_X_PLATFORM) -t $(REGISTRY)/$(REPOSITORY)-nightly:latest -t $(REGISTRY)/$(REPOSITORY)-nightly:${DATE} .
$(DOCKER_BUILDX_X_PLATFORM_ALPINE) -t ${REGISTRY}/$(REPOSITORY)-nightly:latest-alpine -t $(REGISTRY)/$(REPOSITORY)-nightly:${DATE}-alpine .
.PHONY: nightly-push
nightly-push: ## Nightly push command for docker images in both flavours (distroless / alpine)
$(DOCKER_BUILDX_PUSH_X_PLATFORM) -t $(REGISTRY)/$(REPOSITORY)-nightly:latest -t $(REGISTRY)/$(REPOSITORY)-nightly:${DATE} .
$(DOCKER_BUILDX_PUSH_X_PLATFORM_ALPINE) -t ${REGISTRY}/$(REPOSITORY)-nightly:latest-alpine -t $(REGISTRY)/$(REPOSITORY)-nightly:${DATE}-alpine .
##@ Docs
.PHONY: generate
generate: ## Generate alpha config docs from golang structs
go generate ./pkg/...
.PHONY: verify-generate
verify-generate: generate ## Verify command to check if alpha config docs are in line with golang struct changes
git diff --exit-code
##@ Miscellaneous
.PHONY: test
test: lint ## Run all Go tests
GO111MODULE=on $(GO) test $(TESTCOVER) -v -race ./...
.PHONY: release
release: validate-go-version lint test ## Create a full release for all architectures (binaries and checksums)
BINARY=${BINARY} VERSION=${VERSION} ./dist.sh
.PHONY: clean
clean: ## Cleanup release and build files
-rm -rf release
-rm -f $(BINARY)
.PHONY: lint
lint: validate-go-version ## Lint all files using golangci-lint
GO111MODULE=on $(GOLANGCILINT) run
.PHONY: validate-go-version
validate-go-version: ## Validate Go environment requirements
@$(GO) list . >/dev/null || { echo '$(GO_VERSION_VALIDATION_ERR_MSG)'; exit 1; }
# local-env can be used to interact with the local development environment
# eg:
# make local-env-up # Bring up a basic test environment
# make local-env-down # Tear down the basic test environment
# make local-env-nginx-up # Bring up an nginx based test environment
# make local-env-nginx-down # Tead down the nginx based test environment
.PHONY: local-env-%
local-env-%:
make -C contrib/local-environment $*

161
README.md
View File

@ -1,145 +1,86 @@
google_auth_proxy
=================
[![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)
[![Go Report Card](https://goreportcard.com/badge/github.com/oauth2-proxy/oauth2-proxy)](https://goreportcard.com/report/github.com/oauth2-proxy/oauth2-proxy)
[![GoDoc](https://godoc.org/github.com/oauth2-proxy/oauth2-proxy?status.svg)](https://godoc.org/github.com/oauth2-proxy/oauth2-proxy)
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
[![Maintainability](https://api.codeclimate.com/v1/badges/a58ff79407212e2beacb/maintainability)](https://codeclimate.com/github/oauth2-proxy/oauth2-proxy/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/a58ff79407212e2beacb/test_coverage)](https://codeclimate.com/github/oauth2-proxy/oauth2-proxy/test_coverage)
![OAuth2 Proxy](docs/static/img/logos/OAuth2_Proxy_horizontal.svg)
A reverse proxy that provides authentication using Google OAuth2 to validate
individual accounts, or a whole google apps domain.
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.
[![Build Status](https://secure.travis-ci.org/bitly/google_auth_proxy.png?branch=master)](http://travis-ci.org/bitly/google_auth_proxy)
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.
![Simplified Architecture](docs/static/img/simplified-architecture.svg)
![sign_in_page](https://cloud.githubusercontent.com/assets/45028/4970624/7feb7dd8-6886-11e4-93e0-c9904af44ea8.png)
## Get Started
## Architecture
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).
```
_______ ___________________ __________
|Nginx| ----> |google_auth_proxy| ----> |upstream|
------- ------------------- ----------
||
\/
[google oauth2 api]
```
## Releases
### Binaries
We publish oauth2-proxy as compiled binaries on GitHub for all major architectures as well as more exotic ones like `ppc64le` as well as `s390x`.
## Installation
Check out the [latest release](https://github.com/oauth2-proxy/oauth2-proxy/releases/latest).
1. Download [Prebuilt Binary](https://github.com/bitly/google_auth_proxy/releases) or build from `master` with `$ go get github.com/bitly/google_auth_proxy` which should put the binary in `$GOROOT/bin`
2. Register an OAuth Application with Google
3. Configure Google Auth Proxy using config file, command line options, or environment variables
4. Deploy behind a SSL endpoint (example provided for Nginx)
### Images
## OAuth Configuration
From `v7.6.0` and up the base image has been changed from Alpine to [GoogleContainerTools/distroless](https://github.com/GoogleContainerTools/distroless).
This image comes with even fewer installed dependencies and thus should improve security. The image therefore is also slightly smaller than Alpine.
For debugging purposes (and those who really need it. e.g. `armv6`) we still provide images based on Alpine. The tags of these images are suffixed with `-alpine`.
You will need to register an OAuth application with google, and configure it with Redirect URI(s) for the domain you
intend to run `google_auth_proxy` on.
Since 2023-11-18 we build nightly images directly from the `master` branch and provide them at `quay.io/oauth2-proxy/oauth2-proxy-nightly`.
These images are considered unstable and therefore should **NOT** be used for production purposes unless you know what you're doing.
1. Create a new project: https://console.developers.google.com/project
2. Under "APIs & Auth", choose "Credentials"
3. Now, choose "Create new Client ID"
* The Application Type should be **Web application**
* Enter your domain in the Authorized Javascript Origins `https://internal.yourcompany.com`
* Enter the correct Authorized Redirect URL `https://internal.yourcompany.com/oauth2/callback`
* NOTE: `google_auth_proxy` will _only_ callback on the path `/oauth2/callback`
4. Under "APIs & Auth" choose "Consent Screen"
* Fill in the necessary fields and Save (this is _required_)
5. Take note of the **Client ID** and **Client Secret**
## Sponsors
![Microsoft](https://upload.wikimedia.org/wikipedia/commons/9/96/Microsoft_logo_%282012%29.svg)
Microsoft Azure credits for open source projects
## Configuration
Would you like to sponsor the project then please contact us at [sponsors@oauth2-proxy.dev](mailto:sponsors@oauth2-proxy.dev)
`google_auth_proxy` can be configured via [config file](#config-file), [command line options](#command-line-options) or [environment variables](#environment-variables).
## Getting Involved
[![Slack](https://img.shields.io/badge/slack-Gopher_%23oauth2--proxy-red?logo=slack)](https://gophers.slack.com/archives/CM2RSS25N)
### Config File
Join the #oauth2-proxy [Slack channel](https://gophers.slack.com/archives/CM2RSS25N) to chat with other users of oauth2-proxy or reach out to the maintainers directly. Use the [public invite link](https://invite.slack.golangbridge.org/) to get an invite for the Gopher Slack space.
An example [google_auth_proxy.cfg](contrib/google_auth_proxy.cfg.example) config file is in the contrib directory. It can be used by specifying `-config=/etc/google_auth_proxy.cfg`
OAuth2-Proxy is a community-driven project. We rely on the contributions 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.
### Command Line Options
If you want to contribute to the project. Please see our [Contributing](https://oauth2-proxy.github.io/oauth2-proxy/community/contribution) guide.
```
Usage of google_auth_proxy:
-authenticated-emails-file="": authenticate against emails via file (one per line)
-client-id="": the Google OAuth Client ID: ie: "123456.apps.googleusercontent.com"
-client-secret="": the OAuth Client Secret
-config="": path to config file
-cookie-domain="": an optional cookie domain to force cookies to (ie: .yourcompany.com)*
-cookie-expire=168h0m0s: expire timeframe for cookie
-cookie-httponly=true: set HttpOnly cookie flag
-cookie-https-only=true: set secure (HTTPS) cookies (deprecated. use --cookie-secure setting)
-cookie-secret="": the seed string for secure cookies
-cookie-secure=true: set secure (HTTPS) cookie flag
-custom-templates-dir="": path to custom html templates
-display-htpasswd-form=true: display username / password login form if an htpasswd file is provided
-google-apps-domain=: authenticate against the given Google apps domain (may be given multiple times)
-htpasswd-file="": additionally authenticate against a htpasswd file. Entries must be created with "htpasswd -s" for SHA encryption
-http-address="127.0.0.1:4180": [http://]<addr>:<port> or unix://<path> to listen on for HTTP clients
-pass-basic-auth=true: pass HTTP Basic Auth, X-Forwarded-User and X-Forwarded-Email information to upstream
-pass-host-header=true: pass the request Host Header to upstream
-redirect-url="": the OAuth Redirect URL. ie: "https://internalapp.yourcompany.com/oauth2/callback"
-skip-auth-regex=: bypass authentication for requests path's that match (may be given multiple times)
-upstream=: the http url(s) of the upstream endpoint. If multiple, routing is based on path
-version=false: print version string
```
Who uses OAuth2-Proxy? Have a look at our new [ADOPTERS](ADOPTERS.md) file and
feel free to open a PR to add your organisation.
### Environment variables
Thanks to all the people who already contributed ❤
The environment variables `GOOGLE_AUTH_PROXY_CLIENT_ID`, `GOOGLE_AUTH_PROXY_CLIENT_SECRET`, `GOOGLE_AUTH_PROXY_COOKIE_SECRET`, `GOOGLE_AUTH_PROXY_COOKIE_DOMAIN` and `GOOGLE_AUTH_PROXY_COOKIE_EXPIRE` can be used in place of the corresponding command-line arguments.
<a href="https://github.com/oauth2-proxy/oauth2-proxy/graphs/contributors">
<img src="https://contrib.rocks/image?repo=oauth2-proxy/oauth2-proxy&columns=15&max=75" />
<img src="https://img.shields.io/github/contributors/oauth2-proxy/oauth2-proxy" />
</a>
### Example Nginx Configuration
Made with [contrib.rocks](https://contrib.rocks).
This example has a [Nginx](http://nginx.org/) SSL endpoint proxying to `google_auth_proxy` on port `4180`.
`google_auth_proxy` then authenticates requests for an upstream application running on port `8080`. The external
endpoint for this example would be `https://internal.yourcompany.com/`.
## Security
An example Nginx config follows. Note the use of `Strict-Transport-Security` header to pin requests to SSL
via [HSTS](http://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security):
If 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.
```
server {
listen 443 default ssl;
server_name internal.yourcompany.com;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/cert.key;
add_header Strict-Transport-Security max-age=1209600;
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.
location / {
proxy_pass http://127.0.0.1:4180;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_connect_timeout 1;
proxy_send_timeout 30;
proxy_read_timeout 30;
}
}
```
For more details read our full [Security Docs](https://oauth2-proxy.github.io/oauth2-proxy/community/security#security-disclosures)
The command line to run `google_auth_proxy` would look like this:
### Security Notice for v6.0.0 and older
```bash
./google_auth_proxy \
--google-apps-domain="yourcompany.com" \
--upstream=http://127.0.0.1:8080/ \
--cookie-secret=... \
--cookie-secure=true \
--client-id=... \
--client-secret=...
```
If you are running a version older than v6.0.0 we **strongly recommend** to the current version.
See [open redirect vulnerability](https://github.com/oauth2-proxy/oauth2-proxy/security/advisories/GHSA-5m6c-jp6f-2vcv) for details.
## Endpoint Documentation
## Repository History
Google Auth Proxy responds directly to the following endpoints. All other endpoints will be proxied upstream when authenticated.
**2018-11-27:** This repository was forked from [bitly/OAuth2_Proxy](https://github.com/bitly/oauth2_proxy). Versions v3.0.0 and up are from this fork and will have diverged from any changes in the original fork. A list of changes can be seen in the [CHANGELOG](CHANGELOG.md).
* /ping - returns an 200 OK response
* /oauth2/sign_in - the login page, which also doubles as a sign out page (it clears cookies)
* /oauth2/start - a URL that will redirect to start the OAuth cycle
* /oauth2/callback - the URL used at the end of the OAuth cycle. The oauth app will be configured with this ass the callback url.
**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`.
## Logging Format
## License
Google Auth Proxy logs requests to stdout in a format similar to Apache Combined Log.
```
<REMOTE_ADDRESS> - <user@domain.com> [19/Mar/2015:17:20:19 -0400] <HOST_HEADER> GET <UPSTREAM_HOST> "/path/" HTTP/1.1 "<USER_AGENT>" <RESPONSE_CODE> <RESPONSE_BYTES> <REQUEST_DURATION>
````
OAuth2-Proxy is distributed under [The MIT License](LICENSE).

49
RELEASE.md Normal file
View File

@ -0,0 +1,49 @@
# Release
The is a legacy document to explain the manual process of creating and publishing a new release of oauth2-proxy. As of now the release process has been automated with GitHub Actions workflows. For more information have a look at the workflows `create-release.yml` and `publish-release.yml`.
Here's how OAuth2 Proxy releases are created.
## Schedule
Our aim is to release once a quarter, but bug fixes will be prioritised and might be released earlier.
## The Process
Note this uses `v4.1.0` as an example release number.
1. Create a draft Github release
* Use format `v4.1.0` for both the tag and title
2. Update [CHANGELOG.md](CHANGELOG.md)
* Write the release highlights
* Copy in headings ready for the next release
3. Create release commit
```
git checkout -b release-v4.1.0
```
4. Create pull request getting other maintainers to review
5. Copy the release notes in to the draft Github release, adding a link to [CHANGELOG.md](CHANGELOG.md)
6. Update you local master branch
```
git checkout master
git pull
```
7. Create & push the tag
```
git tag v4.1.0
git push --tags
```
8. Make the release artefacts
```
make release
```
9. Upload all the files (not the folders) from the `/release` folder to Github release as binary artefacts. There should be both the tarballs (`tar.gz`) and the checksum files (`sha256sum.txt`).
10. Publish release in Github
11. Make and push docker images to Quay
```
make build-docker-all
make push-docker-all
```
Note: Ensure the docker tags don't include `-dirty`. This means you have uncommitted changes.
12. Verify everything looks good at [quay](https://quay.io/repository/oauth2-proxy/oauth2-proxy?tag=latest&tab=tags) and [github](https://github.com/oauth2-proxy/oauth2-proxy/releases)

3
SECURITY.md Normal file
View File

@ -0,0 +1,3 @@
# Security Disclosures
Please see [our community docs](https://oauth2-proxy.github.io/oauth2-proxy/community/security) for our security policy.

View File

@ -1,57 +0,0 @@
## Google Auth Proxy Config File
## https://github.com/bitly/google_auth_proxy
## <addr>:<port> to listen on for HTTP clients
# http_address = "127.0.0.1:4180"
## the OAuth Redirect URL.
# defaults to the "https://" + requested host header + "/oauth2/callback"
# redirect_url = "https://internalapp.yourcompany.com/oauth2/callback"
## the http url(s) of the upstream endpoint. If multiple, routing is based on path
# upstreams = [
# "http://127.0.0.1:8080/"
# ]
## Log requests to stdout
# request_logging = true
## pass HTTP Basic Auth, X-Forwarded-User and X-Forwarded-Email information to upstream
# pass_basic_auth = true
## pass the request Host Header to upstream
## when disabled the upstream Host is used as the Host Header
# pass_host_header = true
## Google Apps Domains to allow authentication for
# google_apps_domains = [
# "yourcompany.com"
# ]
## The Google OAuth Client ID, Secret
# client_id = "123456.apps.googleusercontent.com"
# client_secret = ""
## Authenticated Email Addresses File (one email per line)
# authenticated_emails_file = ""
## Htpasswd File (optional)
## Additionally authenticate against a htpasswd file. Entries must be created with "htpasswd -s" for SHA encryption
## enabling exposes a username/login signin form
# htpasswd_file = ""
## Templates
## optional directory with custom sign_in.html and error.html
# custom_templates_dir = ""
## Cookie Settings
## Secret - the seed string for secure cookies
## Domain - optional cookie domain to force cookies to (ie: .yourcompany.com)
## Expire - expire timeframe for cookie
# cookie_secret = ""
# cookie_domain = ""
# cookie_expire = "168h"
# cookie_secure = true
# cookie_httponly = true

View File

@ -0,0 +1,56 @@
.PHONY: up
up:
docker compose up -d
.PHONY: %
%:
docker compose $*
.PHONY: alpha-config-up
alpha-config-up:
docker compose -f docker-compose.yaml -f docker-compose-alpha-config.yaml up -d
.PHONY: alpha-config-%
alpha-config-%:
docker compose -f docker-compose.yaml -f docker-compose-alpha-config.yaml $*
.PHONY: nginx-up
nginx-up:
docker compose -f docker-compose.yaml -f docker-compose-nginx.yaml up -d
.PHONY: nginx-%
nginx-%:
docker compose -f docker-compose.yaml -f docker-compose-nginx.yaml $*
.PHONY: keycloak-up
keycloak-up:
docker compose -f docker-compose-keycloak.yaml up -d
.PHONY: keycloak-%
keycloak-%:
docker compose -f docker-compose-keycloak.yaml $*
.PHONY: gitea-up
gitea-up:
docker compose -f docker-compose-gitea.yaml up -d
.PHONY: gitea-%
gitea-%:
docker compose -f docker-compose-gitea.yaml $*
.PHONY: kubernetes-up
kubernetes-up:
make -C kubernetes create-cluster
make -C kubernetes deploy
.PHONY: kubernetes-down
kubernetes-down:
make -C kubernetes delete-cluster
.PHONY: traefik-up
traefik-up:
docker compose -f docker-compose.yaml -f docker-compose-traefik.yaml up -d
.PHONY: traefik-%
traefik-%:
docker compose -f docker-compose.yaml -f docker-compose-traefik.yaml $*

View File

@ -0,0 +1,3 @@
# oauth2-proxy: local-environment
Run `make up` to deploy local dex, etcd and oauth2-proxy instances in Docker containers. Review the [`Makefile`](Makefile) for additional deployment options.

View File

@ -0,0 +1,32 @@
# This configuration is intended to be used with the docker-compose testing
# environment.
# This should configure Dex to run on port 5556 and provides a static login
issuer: http://dex.localtest.me:5556/dex
storage:
type: etcd
config:
endpoints:
- http://etcd:2379
namespace: dex/
web:
http: 0.0.0.0:5556
oauth2:
skipApprovalScreen: true
expiry:
signingKeys: "4h"
idTokens: "1h"
staticClients:
- id: oauth2-proxy
redirectURIs:
# These redirect URIs point to the `--redirect-url` for OAuth2 proxy.
- 'http://oauth2-proxy.localtest.me:4180/oauth2/callback' # For basic proxy example.
- 'http://oauth2-proxy.oauth2-proxy.localhost/oauth2/callback' # For nginx and traefik example.
name: 'OAuth2 Proxy'
secret: b2F1dGgyLXByb3h5LWNsaWVudC1zZWNyZXQK
enablePasswordDB: true
staticPasswords:
- email: "admin@example.com"
# bcrypt hash of the string "password"
hash: "$2a$10$2b2cU8CPhOTaGrs1HRQuAueS7JTT5ZHsHSzYiFPm1leZck7Mc8T4W"
username: "admin"
userID: "08a8684b-db88-4b73-90a9-3cd1661f5466"

View File

@ -0,0 +1,20 @@
# This docker-compose file can be used to bring up an example instance of oauth2-proxy
# for manual testing and exploration of features.
# Alongside OAuth2-Proxy, this file also starts Dex to act as the identity provider,
# etcd for storage for Dex and HTTPBin as an example upstream.
# This file also uses alpha configuration when configuring OAuth2 Proxy.
#
# This file is an extension of the main compose file and must be used with it
# docker-compose -f docker-compose.yaml -f docker-compose-alpha-config.yaml <command>
# Alternatively:
# make alpha-config-<command> (eg make nginx-up, make nginx-down)
#
# Access http://localhost:4180 to initiate a login cycle
version: '3.0'
services:
oauth2-proxy:
image: quay.io/oauth2-proxy/oauth2-proxy:v7.12.0
command: --config /oauth2-proxy.cfg --alpha-config /oauth2-proxy-alpha-config.yaml
volumes:
- "./oauth2-proxy-alpha-config.cfg:/oauth2-proxy.cfg"
- "./oauth2-proxy-alpha-config.yaml:/oauth2-proxy-alpha-config.yaml"

View File

@ -0,0 +1,62 @@
# This docker-compose file can be used to bring up an example instance of oauth2-proxy
# for manual testing and exploration of features.
# Alongside OAuth2-Proxy, this file also starts Gitea to act as the identity provider,
# HTTPBin as an example upstream.
#
# This can either be created using docker-compose
# docker-compose -f docker-compose-gitea.yaml <command>
# Or:
# make gitea-<command> (eg. make gitea-up, make gitea-down)
#
# Access http://oauth2-proxy.localtest.me:4180 to initiate a login cycle using user=admin@example.com, password=password
# Access http://gitea.localtest.me:3000 with the same credentials to check out the settings
version: '3.0'
services:
oauth2-proxy:
container_name: oauth2-proxy
image: quay.io/oauth2-proxy/oauth2-proxy:v7.12.0
command: --config /oauth2-proxy.cfg
hostname: oauth2-proxy
volumes:
- "./oauth2-proxy-gitea.cfg:/oauth2-proxy.cfg"
restart: unless-stopped
networks:
gitea: {}
httpbin: {}
oauth2-proxy: {}
depends_on:
- httpbin
- gitea
ports:
- 4180:4180/tcp
httpbin:
container_name: httpbin
image: kennethreitz/httpbin:latest
hostname: httpbin
ports: []
networks:
httpbin: {}
gitea:
image: gitea/gitea:1.24.7
container_name: gitea
environment:
- USER_UID=1000
- USER_GID=1000
restart: always
networks:
gitea:
aliases:
- gitea.localtest.me
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "222:22"
networks:
httpbin: {}
gitea: {}
oauth2-proxy: {}

View File

@ -0,0 +1,65 @@
# This docker-compose file can be used to bring up an example instance of oauth2-proxy
# for manual testing and exploration of features.
# Alongside OAuth2-Proxy, this file also starts Keycloak to act as the identity provider,
# HTTPBin as an example upstream.
#
# This can either be created using docker-compose
# docker-compose -f docker-compose-keycloak.yaml <command>
# Or:
# make keycloak-<command> (eg. make keycloak-up, make keycloak-down)
#
# Access http://oauth2-proxy.localtest.me:4180 to initiate a login cycle using user=admin@example.com, password=password
# Access http://keycloak.localtest.me:9080 with the same credentials to check out the settings
version: '3.0'
services:
oauth2-proxy:
container_name: oauth2-proxy
image: quay.io/oauth2-proxy/oauth2-proxy:v7.12.0
command: --config /oauth2-proxy.cfg
hostname: oauth2-proxy
volumes:
- "./oauth2-proxy-keycloak.cfg:/oauth2-proxy.cfg"
restart: unless-stopped
ports:
- 4180:4180/tcp
networks:
keycloak: {}
httpbin: {}
oauth2-proxy: {}
depends_on:
- httpbin
- keycloak
httpbin:
container_name: httpbin
image: kennethreitz/httpbin:latest
hostname: httpbin
ports: []
networks:
httpbin: {}
keycloak:
container_name: keycloak
image: keycloak/keycloak:25.0
hostname: keycloak
command:
- 'start-dev'
- '--http-port=9080'
- '--import-realm'
volumes:
- ./keycloak:/opt/keycloak/data/import
environment:
KC_HTTP_PORT: 9080
KEYCLOAK_ADMIN: admin@example.com
KEYCLOAK_ADMIN_PASSWORD: password
ports:
- 9080:9080/tcp
networks:
keycloak:
aliases:
- keycloak.localtest.me
networks:
httpbin: {}
keycloak: {}
oauth2-proxy: {}

View File

@ -0,0 +1,92 @@
# This docker-compose file can be used to bring up an example instance of oauth2-proxy
# for manual testing and exploration of features.
# Alongside OAuth2-Proxy, this file also starts Dex to act as the identity provider,
# etcd for storage for Dex, nginx as a reverse proxy and other http services for upstreams
#
# This file is an extension of the main compose file and must be used with it
# docker-compose -f docker-compose.yaml -f docker-compose-nginx.yaml <command>
# Alternatively:
# make nginx-<command> (eg make nginx-up, make nginx-down)
#
# Access one of the following URLs to initiate a login flow:
# - http://oauth2-proxy.localhost
# - http://httpbin.oauth2-proxy.localhost
#
# The OAuth2 Proxy itself is hosted at http://oauth2-proxy.oauth2-proxy.localhost
#
# Note, the above URLs should work with Chrome, but you may need to add hosts
# entries for other browsers
# 127.0.0.1 oauth2-proxy.localhost
# 127.0.0.1 httpbin.oauth2-proxy.localhost
# 127.0.0.1 oauth2-proxy.oauth2-proxy.localhost
version: '3.0'
services:
oauth2-proxy:
image: quay.io/oauth2-proxy/oauth2-proxy:v7.12.0
ports: []
hostname: oauth2-proxy
container_name: oauth2-proxy
command: --config /oauth2-proxy.cfg
volumes:
- "./oauth2-proxy-nginx.cfg:/oauth2-proxy.cfg"
networks:
oauth2-proxy: {}
dex: {}
etcd: {}
httpbin: {}
depends_on:
- dex
- httpbin
nginx:
depends_on:
- oauth2-proxy
container_name: nginx
image: nginx:1.29
restart: unless-stopped
ports:
- 80:80/tcp
hostname: nginx
volumes:
- "./nginx.conf:/etc/nginx/conf.d/default.conf"
networks:
oauth2-proxy: {}
dex: {}
etcd: {}
httpbin: {}
dex:
container_name: dex
image: ghcr.io/dexidp/dex:v2.44.0
command: dex serve /dex.yaml
hostname: dex
volumes:
- "./dex.yaml:/dex.yaml"
restart: unless-stopped
ports:
- 5556:4181/tcp
networks:
dex:
aliases:
- dex.localtest.me
etcd: {}
depends_on:
- etcd
httpbin:
container_name: httpbin
image: kennethreitz/httpbin
ports: []
networks:
httpbin: {}
etcd:
container_name: etcd
image: gcr.io/etcd-development/etcd:v3.6.5
entrypoint: /usr/local/bin/etcd
command:
- --listen-client-urls=http://0.0.0.0:2379
- --advertise-client-urls=http://etcd:2379
networks:
etcd: {}
networks:
dex: {}
etcd: {}
httpbin: {}
oauth2-proxy: {}

View File

@ -0,0 +1,50 @@
# This docker-compose file can be used to bring up an example instance of oauth2-proxy
# for manual testing and exploration of features.
# Alongside OAuth2-Proxy, this file also starts Dex to act as the identity provider,
# HTTPBin as an example upstream.
#
# This can either be created using docker-compose
# docker-compose -f docker-compose-traefik.yaml <command>
# Or:
# make traefik-<command> (eg. make traefik-up, make traefik-down)
#
# Access one of the following URLs to initiate a login flow:
# - http://oauth2-proxy.localhost
# - http://httpbin.oauth2-proxy.localhost
#
# The OAuth2 Proxy itself is hosted at http://oauth2-proxy.oauth2-proxy.localhost
#
# Note, the above URLs should work with Chrome, but you may need to add hosts
# entries for other browsers
# 127.0.0.1 oauth2-proxy.localhost
# 127.0.0.1 httpbin.oauth2-proxy.localhost
# 127.0.0.1 oauth2-proxy.oauth2-proxy.localhost
version: '3.0'
services:
oauth2-proxy:
image: quay.io/oauth2-proxy/oauth2-proxy:v7.12.0
ports: []
hostname: oauth2-proxy
volumes:
- "./oauth2-proxy-traefik.cfg:/oauth2-proxy.cfg"
networks:
oauth2-proxy:
# Reverse proxy
gateway:
container_name: traefik
image: traefik:v2.11.29
volumes:
- "./traefik:/etc/traefik"
ports:
- "80:80"
- "9090:8080"
depends_on:
- oauth2-proxy
networks:
oauth2-proxy:
httpbin:
networks:
oauth2-proxy:

View File

@ -0,0 +1,65 @@
# This docker-compose file can be used to bring up an example instance of oauth2-proxy
# for manual testing and exploration of features.
# Alongside OAuth2-Proxy, this file also starts Dex to act as the identity provider,
# etcd for storage for Dex and HTTPBin as an example upstream.
#
# This can either be created using docker-compose
# docker-compose -f docker-compose.yaml <command>
# Or:
# make <command> (eg. make up, make down)
#
# Access http://oauth2-proxy.localtest.me:4180 to initiate a login cycle
version: '3.0'
services:
oauth2-proxy:
container_name: oauth2-proxy
image: quay.io/oauth2-proxy/oauth2-proxy:v7.12.0
command: --config /oauth2-proxy.cfg
hostname: oauth2-proxy
volumes:
- "./oauth2-proxy.cfg:/oauth2-proxy.cfg"
restart: unless-stopped
ports:
- 4180:4180/tcp
networks:
dex: {}
httpbin: {}
depends_on:
- dex
- httpbin
dex:
container_name: dex
image: ghcr.io/dexidp/dex:v2.44.0
command: dex serve /dex.yaml
hostname: dex
volumes:
- "./dex.yaml:/dex.yaml"
restart: unless-stopped
ports:
- 5556:5556/tcp
networks:
dex:
aliases:
- dex.localtest.me
etcd: {}
depends_on:
- etcd
httpbin:
container_name: httpbin
image: kennethreitz/httpbin
ports: []
networks:
httpbin: {}
etcd:
container_name: etcd
image: gcr.io/etcd-development/etcd:v3.6.5
entrypoint: /usr/local/bin/etcd
command:
- --listen-client-urls=http://0.0.0.0:2379
- --advertise-client-urls=http://etcd:2379
networks:
etcd: {}
networks:
dex: {}
etcd: {}
httpbin: {}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,38 @@
{
"realm": "oauth2-proxy",
"users": [
{
"id": "3356c0a0-d4d5-4436-9c5a-2299c71c08ec",
"createdTimestamp": 1591297959169,
"username": "admin@example.com",
"email": "admin@example.com",
"enabled": true,
"totp": false,
"emailVerified": true,
"credentials": [
{
"id": "a1a06ecd-fdc0-4e67-92cd-2da22d724e32",
"type": "password",
"createdDate": 1591297959315,
"secretData": "{\"value\":\"6rt5zuqHVHopvd0FTFE0CYadXTtzY0mDY2BrqnNQGS51/7DfMJeGgj0roNnGMGvDv30imErNmiSOYl+cL9jiIA==\",\"salt\":\"LI0kqr09JB7J9wvr2Hxzzg==\"}",
"credentialData": "{\"hashIterations\":27500,\"algorithm\":\"pbkdf2-sha256\"}"
}
],
"disableableCredentialTypes": [],
"requiredActions": [],
"realmRoles": [
"offline_access",
"admin",
"uma_authorization"
],
"clientRoles": {
"account": [
"view-profile",
"manage-account"
]
},
"notBefore": 0,
"groups": []
}
]
}

View File

@ -0,0 +1 @@
charts/

View File

@ -0,0 +1,15 @@
dependencies:
- name: dex
repository: https://charts.dexidp.io
version: 0.24.0
- name: oauth2-proxy
repository: https://oauth2-proxy.github.io/manifests
version: 7.18.0
- name: httpbin
repository: https://conservis.github.io/helm-charts
version: 1.1.0
- name: hello-world
repository: https://conservis.github.io/helm-charts
version: 1.1.0
digest: sha256:fee913531bfb67e5555e995d8fb040c330e6eb4b5a8c777ceb9841135ea9bb84
generated: "2025-10-28T06:46:35.38300324Z"

View File

@ -0,0 +1,18 @@
apiVersion: v2
description: K8S example based on https://kind.sigs.k8s.io
name: kubernetes
dependencies:
- name: dex
version: 0.24.0
repository: https://charts.dexidp.io
- name: oauth2-proxy
version: &chartVersion 7.18.0
repository: https://oauth2-proxy.github.io/manifests
# https://github.com/postmanlabs/httpbin/issues/549 is still in progress, for now using a non-official chart
- name: httpbin
version: 1.1.0
repository: https://conservis.github.io/helm-charts
- name: hello-world
version: 1.1.0
repository: https://conservis.github.io/helm-charts
version: *chartVersion

View File

@ -0,0 +1,59 @@
all:
@echo "Usage:"
@echo " make create-cluster"
@echo " make deploy"
# create kind cluster with nginx-ingress as the most popular ingress controller for K8S
.PHONY: deploy
create-cluster:
kind create cluster --name oauth2-proxy --config kind-cluster.yaml
make setup-dns
make setup-ingress
.PHONY: setup-ingress
setup-ingress:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/kind/deploy.yaml
kubectl --namespace ingress-nginx rollout status --timeout 5m deployment/ingress-nginx-controller
# default Pod CIDR is 10.244.0.0/16 https://github.com/kubernetes-sigs/kind/blob/a6e8108025bc7a9440beedb8ef7714aec84fe87e/pkg/apis/config/v1alpha4/default.go#L52
# what makes cluster host IP equal to 10.244.0.1
# thus we add dex.localtest.me and oauth2-proxy.localtest.me stub hosts pointing to this IP
# NOT NEEDED IN REAL LIFE!
.PHONY: setup-dns
setup-dns:
kubectl apply -f custom-dns.yaml
kubectl -n kube-system rollout restart deployment/coredns
kubectl -n kube-system rollout status --timeout 5m deployment/coredns
.PHONY: delete-cluster
delete-cluster:
kind delete cluster --name oauth2-proxy
.PHONY: deploy
deploy: helm-deploy
kubectl rollout status --timeout 5m deployment/oauth2-proxy-example-oauth2-proxy-sample
kubectl rollout status --timeout 1m deployment/oauth2-proxy-example-httpbin
kubectl rollout status --timeout 1m deployment/oauth2-proxy-example-hello-world
.PHONY: undeploy
undeploy: helm-undeploy
######################
###### HELM CMDs #####
######################
.PHONY: helm-init
helm-init:
helm dep update
# unpacking is useful to be able to explore underlying helm charts
.PHONY: helm-unpack
helm-unpack:
cd charts; for f in *.tgz; do tar -zxf "$$f"; done
.PHONY: helm-deploy
helm-deploy: helm-init
helm upgrade --wait --debug --install --render-subchart-notes oauth2-proxy-example .
.PHONY: helm-undeploy
helm-undeploy:
helm del oauth2-proxy-example

View File

@ -0,0 +1,23 @@
# Kubernetes example
Based on [kind](https://kind.sigs.k8s.io) as a local Kubernetes cluster.
## Quick start
Before you start:
_Required_
* install [kind](https://kind.sigs.k8s.io/docs/user/quick-start/#installation)
* install [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/)
* install [helm](https://helm.sh/docs/intro/quickstart/#install-helm).
Then:
* `make create-cluster`
* `make deploy`
Visit http://httpbin.localtest.me or http://hello-world.localtest.me/
Note: When accessing the service for the first time you will need to authenticate with Dex. It is configured using static credentials for testing. With username `admin@example.com` and password set to `password`.
## Uninstall
* `make delete-cluster`

View File

@ -0,0 +1,30 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: coredns
namespace: kube-system
data:
Corefile: |
.:53 {
errors
health {
lameduck 5s
}
ready
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
fallthrough in-addr.arpa ip6.arpa
ttl 30
}
prometheus :9153
forward . /etc/resolv.conf
cache 30
loop
reload
loadbalance
hosts {
10.244.0.1 dex.localtest.me
10.244.0.1 oauth2-proxy.localtest.me
fallthrough
}
}

View File

@ -0,0 +1,17 @@
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 80
hostPort: 80
protocol: TCP
- containerPort: 443
hostPort: 443
protocol: TCP

View File

@ -0,0 +1,97 @@
dex:
ingress:
enabled: true
hosts:
- host: dex.localtest.me
paths:
- path: /
pathType: ImplementationSpecific
grpc:
enabled: false
certs:
grpc:
create: false
web:
create: false
config:
issuer: http://dex.localtest.me
storage:
type: kubernetes
config:
inCluster: true
enablePasswordDB: true
expiry:
signingKeys: "4h"
idTokens: "1h"
staticClients:
- id: oauth2-proxy
redirectURIs:
# These redirect URI points to the `--redirect-url` for OAuth2 proxy.
- 'http://oauth2-proxy.localtest.me/oauth2/callback'
name: 'OAuth2 Proxy'
secret: "b2F1dGgyLXByb3h5LWNsaWVudC1zZWNyZXQK"
staticPasswords:
- email: "admin@example.com"
# bcrypt hash of the string "password"
hash: "$2a$10$2b2cU8CPhOTaGrs1HRQuAueS7JTT5ZHsHSzYiFPm1leZck7Mc8T4W"
username: "admin"
userID: "08a8684b-db88-4b73-90a9-3cd1661f5466"
oauth2-proxy:
nameOverride: oauth2-proxy-sample
ingress:
enabled: true
hosts:
- oauth2-proxy.localtest.me
# pick up client_id and client_secret from configFile as opposed to helm .Values.config.clientID and .Values.config.clientSecret
proxyVarsAsSecrets: false
config:
configFile: |-
cookie_secret="OQINaROshtE9TcZkNAm-5Zs2Pv3xaWytBmc5W7sPX7w="
cookie_domains=".localtest.me"
whitelist_domains=[".localtest.me"]
# only users with this domain will be let in
email_domains=["example.com"]
client_id="oauth2-proxy"
client_secret="b2F1dGgyLXByb3h5LWNsaWVudC1zZWNyZXQK"
cookie_secure="false"
redirect_url="http://oauth2-proxy.localtest.me/oauth2/callback"
# we don't want to proxy anything so pick a non-existent directory
upstreams = [ "file:///dev/null" ]
# return authenticated user to nginx
set_xauthrequest = true
# using http://dex.localtest.me/.well-known/openid-configuration oauth2-proxy will populate
# login_url, redeem_url, and oidc_jwks_url
provider="oidc"
oidc_issuer_url="http://dex.localtest.me"
httpbin:
ingress:
enabled: true
hosts:
- httpbin.localtest.me
annotations:
nginx.ingress.kubernetes.io/auth-signin: http://oauth2-proxy.localtest.me/oauth2/start
# That's what will be used in REAL LIFE
#nginx.ingress.kubernetes.io/auth-url: http://oauth2-proxy.localtest.me/oauth2/auth
# but because of https://github.com/kubernetes/ingress-nginx/issues/3665
nginx.ingress.kubernetes.io/auth-url: http://oauth2-proxy-example-oauth2-proxy-sample.default.svc.cluster.local/oauth2/auth
nginx.ingress.kubernetes.io/auth-response-headers: X-Auth-Request-User,X-Auth-Request-Email
hello-world:
ingress:
enabled: true
hosts:
- hello-world.localtest.me
annotations:
nginx.ingress.kubernetes.io/auth-signin: http://oauth2-proxy.localtest.me/oauth2/start
# That's what will be used in REAL LIFE
#nginx.ingress.kubernetes.io/auth-url: http://oauth2-proxy.localtest.me/oauth2/auth
# but because of https://github.com/kubernetes/ingress-nginx/issues/3665
nginx.ingress.kubernetes.io/auth-url: http://oauth2-proxy-example-oauth2-proxy-sample.default.svc.cluster.local/oauth2/auth
nginx.ingress.kubernetes.io/auth-response-headers: X-Auth-Request-User,X-Auth-Request-Email

View File

@ -0,0 +1,86 @@
# Reverse proxy to oauth2-proxy
server {
listen 80;
server_name oauth2-proxy.oauth2-proxy.localhost;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://oauth2-proxy:4180/;
}
}
# Reverse proxy to httpbin
server {
listen 80;
server_name httpbin.oauth2-proxy.localhost;
auth_request /internal-auth/oauth2/auth;
# If the auth_request denies the request (401), redirect to the sign_in page
# and include the final rd URL back to the user's original request.
error_page 401 =403 http://oauth2-proxy.oauth2-proxy.localhost/oauth2/sign_in?rd=$scheme://$host$request_uri;
# Alternatively send the request to `start` to skip the provider button
# error_page 401 = http://oauth2-proxy.oauth2-proxy.localhost/oauth2/start?rd=$scheme://$host$request_uri;
location / {
proxy_pass http://httpbin/;
}
# auth_request must be a URI so this allows an internal path to then proxy to
# the real auth_request path.
# The trailing /'s are required so that nginx strips the prefix before proxying.
location /internal-auth/ {
internal; # Ensure external users can't access this path
# Make sure the OAuth2 Proxy knows where the original request came from.
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Uri $request_uri;
proxy_pass http://oauth2-proxy:4180/;
}
}
# Statically serve the nginx welcome
server {
listen 80;
server_name oauth2-proxy.localhost;
location / {
auth_request /internal-auth/oauth2/auth;
# If the auth_request denies the request (401), redirect to the sign_in page
# and include the final rd URL back to the user's original request.
error_page 401 =403 http://oauth2-proxy.oauth2-proxy.localhost/oauth2/sign_in?rd=$scheme://$host$request_uri;
# Alternatively send the request to `start` to skip the provider button
# error_page 401 = http://oauth2-proxy.oauth2-proxy.localhost/oauth2/start?rd=$scheme://$host$request_uri;
root /usr/share/nginx/html;
index index.html index.htm;
}
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# auth_request must be a URI so this allows an internal path to then proxy to
# the real auth_request path.
# The trailing /'s are required so that nginx strips the prefix before proxying.
location /internal-auth/ {
internal; # Ensure external users can't access this path
# Make sure the OAuth2 Proxy knows where the original request came from.
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Uri $request_uri;
proxy_pass http://oauth2-proxy:4180/;
}
}

View File

@ -0,0 +1,5 @@
http_address="0.0.0.0:4180"
cookie_secret="OQINaROshtE9TcZkNAm-5Zs2Pv3xaWytBmc5W7sPX7w="
email_domains="example.com"
cookie_secure="false"
redirect_url="http://localhost:4180/oauth2/callback"

View File

@ -0,0 +1,23 @@
upstreams:
- id: httpbin
path: /
uri: http://httpbin
injectRequestHeaders:
- name: X-Forwarded-Groups
values:
- claim: groups
- name: X-Forwarded-User
values:
- claim: user
- name: X-Forwarded-Email
values:
- claim: email
- name: X-Forwarded-Preferred-Username
values:
- claim: preferred_username
providers:
- provider: oidc
clientSecret: b2F1dGgyLXByb3h5LWNsaWVudC1zZWNyZXQK
clientID: oauth2-proxy
oidcConfig:
issuerURL: http://dex.localhost:5556/dex

View File

@ -0,0 +1,19 @@
http_address="0.0.0.0:4180"
cookie_secret="OQINaROshtE9TcZkNAm-5Zs2Pv3xaWytBmc5W7sPX7w="
email_domains=["localhost"]
cookie_secure="false"
upstreams="http://httpbin"
cookie_domains=[".localtest.me"] # Required so cookie can be read on all subdomains.
whitelist_domains=[".localtest.me"] # Required to allow redirection back to original requested target.
client_id="ef0c2b91-2e38-4fa8-908d-067a35dbb71c"
client_secret="gto_qdppomn2p26su5x46tyixj7bcny5m5er2s67xhrponq2qtp66f3a"
redirect_url="http://oauth2-proxy.localtest.me:4180/oauth2/callback"
# gitea provider
provider="github"
provider_display_name="Gitea"
login_url="http://gitea.localtest.me:3000/login/oauth/authorize"
redeem_url="http://gitea.localtest.me:3000/login/oauth/access_token"
validate_url="http://gitea.localtest.me:3000/api/v1/user/emails"

View File

@ -0,0 +1,18 @@
http_address="0.0.0.0:4180"
cookie_secret="OQINaROshtE9TcZkNAm-5Zs2Pv3xaWytBmc5W7sPX7w="
email_domains="example.com"
cookie_secure="false"
upstreams="http://httpbin"
cookie_domains=["oauth2-proxy.localtest.me:4080", "keycloak.localtest.me:9080"] # Required so cookie can be read on all subdomains.
whitelist_domains=[".localtest.me"] # Required to allow redirection back to original requested target.
# keycloak provider
client_secret="72341b6d-7065-4518-a0e4-50ee15025608"
client_id="oauth2-proxy"
redirect_url="http://oauth2-proxy.localtest.me:4180/oauth2/callback"
# in this case oauth2-proxy is going to visit
# http://keycloak.localtest.me:9080/realms/oauth2-proxy/.well-known/openid-configuration for configuration
oidc_issuer_url="http://keycloak.localtest.me:9080/realms/oauth2-proxy"
provider="oidc"
provider_display_name="Keycloak"

View File

@ -0,0 +1,14 @@
http_address="0.0.0.0:4180"
cookie_secret="OQINaROshtE9TcZkNAm-5Zs2Pv3xaWytBmc5W7sPX7w="
provider="oidc"
email_domains="example.com"
oidc_issuer_url="http://dex.localtest.me:5556/dex"
client_secret="b2F1dGgyLXByb3h5LWNsaWVudC1zZWNyZXQK"
client_id="oauth2-proxy"
cookie_secure="false"
redirect_url="http://oauth2-proxy.oauth2-proxy.localhost/oauth2/callback"
cookie_domains=".oauth2-proxy.localhost" # Required so cookie can be read on all subdomains.
whitelist_domains=".oauth2-proxy.localhost" # Required to allow redirection back to original requested target.
# Enables the use of `X-Forwarded-*` headers to determine request correctly
reverse_proxy="true"

View File

@ -0,0 +1,22 @@
http_address="0.0.0.0:4180"
cookie_secret="OQINaROshtE9TcZkNAm-5Zs2Pv3xaWytBmc5W7sPX7w="
provider="oidc"
email_domains=["example.com"]
oidc_issuer_url="http://dex.localhost:5556/dex"
client_secret="b2F1dGgyLXByb3h5LWNsaWVudC1zZWNyZXQK"
client_id="oauth2-proxy"
cookie_secure="false"
redirect_url="http://oauth2-proxy.oauth2-proxy.localhost/oauth2/callback"
cookie_domains=".oauth2-proxy.localhost" # Required so cookie can be read on all subdomains.
whitelist_domains=".oauth2-proxy.localhost" # Required to allow redirection back to original requested target.
# Mandatory option when using oauth2-proxy with traefik
reverse_proxy="true"
# Required for traefik with ForwardAuth and static upstream configuration
upstreams="static://202"
# The following option skip the page requesting the user
# to click on a button to be redirected to the identity provider
# It can be activated only when traefik is not configure with
# the error redirection middleware as this example.
skip_provider_button="true"

View File

@ -0,0 +1,16 @@
http_address="0.0.0.0:4180"
cookie_secret="OQINaROshtE9TcZkNAm-5Zs2Pv3xaWytBmc5W7sPX7w="
email_domains="example.com"
cookie_secure="false"
upstreams="http://httpbin"
cookie_domains=[".localtest.me"] # Required so cookie can be read on all subdomains.
whitelist_domains=[".localtest.me"] # Required to allow redirection back to original requested target.
# dex provider
client_secret="b2F1dGgyLXByb3h5LWNsaWVudC1zZWNyZXQK"
client_id="oauth2-proxy"
redirect_url="http://oauth2-proxy.localtest.me:4180/oauth2/callback"
oidc_issuer_url="http://dex.localtest.me:5556/dex"
provider="oidc"
provider_display_name="Dex"

View File

@ -0,0 +1,57 @@
http:
routers:
oauth2-proxy-route:
rule: "Host(`oauth2-proxy.oauth2-proxy.localhost`)"
middlewares:
- auth-headers
service: oauth-backend
httpbin-route:
rule: "Host(`httpbin.oauth2-proxy.localhost`)"
service: httpbin-service
middlewares:
- oauth-auth-redirect # redirects all unauthenticated to oauth2 signin
httpbin-route-2:
rule: "Host(`httpbin.oauth2-proxy.localhost`) && PathPrefix(`/no-auto-redirect`)"
service: httpbin-service
middlewares:
- oauth-auth-wo-redirect # unauthenticated session will return a 401
services-oauth2-route:
rule: "Host(`httpbin.oauth2-proxy.localhost`) && PathPrefix(`/oauth2/`)"
middlewares:
- auth-headers
service: oauth-backend
services:
httpbin-service:
loadBalancer:
servers:
- url: http://httpbin
oauth-backend:
loadBalancer:
servers:
- url: http://oauth2-proxy:4180
middlewares:
auth-headers:
headers:
stsSeconds: 315360000
browserXssFilter: true
contentTypeNosniff: true
forceSTSHeader: true
stsIncludeSubdomains: true
stsPreload: true
frameDeny: true
oauth-auth-redirect:
forwardAuth:
address: http://oauth2-proxy:4180
trustForwardHeader: true
authResponseHeaders:
- X-Auth-Request-Access-Token
- Authorization
oauth-auth-wo-redirect:
forwardAuth:
address: http://oauth2-proxy:4180/oauth2/auth
trustForwardHeader: true
authResponseHeaders:
- X-Auth-Request-Access-Token
- Authorization

View File

@ -0,0 +1,7 @@
api:
insecure: true
log:
level: INFO
providers:
file:
filename: /etc/traefik/dynamic.yaml

View File

@ -0,0 +1,108 @@
## OAuth2 Proxy Config File
## https://github.com/oauth2-proxy/oauth2-proxy
## <addr>:<port> to listen on for HTTP/HTTPS clients
# http_address = "127.0.0.1:4180"
# https_address = ":443"
## Are we running behind a reverse proxy? Will not accept headers like X-Real-Ip unless this is set.
# reverse_proxy = true
## TLS Settings
# tls_cert_file = ""
# tls_key_file = ""
## the OAuth Redirect URL.
# defaults to the "https://" + requested host header + "/oauth2/callback"
# redirect_url = "https://internalapp.yourcompany.com/oauth2/callback"
## the http url(s) of the upstream endpoint. If multiple, routing is based on path
# upstreams = [
# "http://127.0.0.1:8080/"
# ]
## Logging configuration
#logging_filename = ""
#logging_max_size = 100
#logging_max_age = 7
#logging_local_time = true
#logging_compress = false
#standard_logging = true
#standard_logging_format = "[{{.Timestamp}}] [{{.File}}] {{.Message}}"
#request_logging = true
#request_logging_format = "{{.Client}} - {{.Username}} [{{.Timestamp}}] {{.Host}} {{.RequestMethod}} {{.Upstream}} {{.RequestURI}} {{.Protocol}} {{.UserAgent}} {{.StatusCode}} {{.ResponseSize}} {{.RequestDuration}}"
#auth_logging = true
#auth_logging_format = "{{.Client}} - {{.Username}} [{{.Timestamp}}] [{{.Status}}] {{.Message}}"
## pass HTTP Basic Auth, X-Forwarded-User and X-Forwarded-Email information to upstream
# pass_basic_auth = true
# pass_user_headers = true
## pass the request Host Header to upstream
## when disabled the upstream Host is used as the Host Header
# pass_host_header = true
## Email Domains to allow authentication for (this authorizes any email on this domain)
## for more granular authorization use `authenticated_emails_file`
## To authorize any email addresses use "*"
# email_domains = [
# "yourcompany.com"
# ]
## The OAuth Client ID, Secret
# client_id = "123456.apps.googleusercontent.com"
# client_secret = ""
## Scopes Added to the request
## It has the same behavior as the --scope flag
# scope = "openid email profile"
## Pass OAuth Access token to upstream via "X-Forwarded-Access-Token"
# pass_access_token = false
## Authenticated Email Addresses File (one email per line)
# authenticated_emails_file = ""
## Htpasswd File (optional)
## Additionally authenticate against a htpasswd file. Entries must be created with "htpasswd -B" for bcrypt encryption
## enabling exposes a username/login signin form
# htpasswd_file = ""
## bypass authentication for requests that match the method & path. Format: method=path_regex OR path_regex alone for all methods
# skip_auth_routes = [
# "GET=^/probe",
# "^/metrics"
# ]
## mark paths as API routes to get HTTP Status code 401 instead of redirect to login page
# api_routes = [
# "^/api"
# ]
## Templates
## optional directory with custom sign_in.html and error.html
# custom_templates_dir = ""
## skip SSL checking for HTTPS requests
# ssl_insecure_skip_verify = false
## Cookie Settings
## Name - the cookie name
## Secret - the seed string for secure cookies; should be 16, 24, or 32 bytes
## for use with an AES cipher when cookie_refresh or pass_access_token
## is set
## Domain - (optional) cookie domain to force cookies to (ie: .yourcompany.com)
## Expire - (duration) expire timeframe for cookie
## Refresh - (duration) refresh the cookie when duration has elapsed after cookie was initially set.
## Should be less than cookie_expire; set to 0 to disable.
## On refresh, OAuth token is re-validated.
## (ie: 1h means tokens are refreshed on request 1hr+ after it was set)
## Secure - secure cookies are only sent by the browser of a HTTPS connection (recommended)
## HttpOnly - httponly cookies are not readable by javascript (recommended)
# cookie_name = "_oauth2_proxy"
# cookie_secret = ""
# cookie_domains = ""
# cookie_expire = "168h"
# cookie_refresh = ""
# cookie_secure = true
# cookie_httponly = true

View File

@ -0,0 +1,33 @@
[Unit]
Description=oauth2-proxy daemon service
After=network.target network-online.target nss-lookup.target basic.target
Wants=network-online.target nss-lookup.target
StartLimitIntervalSec=30
StartLimitBurst=3
[Service]
User=oauth2-proxy
Group=oauth2-proxy
Restart=on-failure
RestartSec=30
WorkingDirectory=/etc/oauth2-proxy
ExecStart=/usr/bin/oauth2-proxy --config=/etc/oauth2-proxy/oauth2-proxy.cfg
ExecReload=/bin/kill -HUP $MAINPID
LimitNOFILE=65535
NoNewPrivileges=true
ProtectHome=true
ProtectSystem=full
ProtectHostname=true
ProtectControlGroups=true
ProtectKernelModules=true
ProtectKernelTunables=true
LockPersonality=true
RestrictRealtime=yes
RestrictNamespaces=yes
MemoryDenyWriteExecute=yes
PrivateDevices=yes
PrivateTmp=true
CapabilityBoundingSet=
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,34 @@
#
# Autocompletion for oauth2-proxy
#
# To install this, copy/move this file to /etc/bash.completion.d/
# or add a line to your ~/.bashrc | ~/.bash_profile that says ". /path/to/oauth2-proxy/contrib/oauth2-proxy_autocomplete.sh"
#
_oauth2_proxy() {
_oauth2_proxy_commands=$(oauth2-proxy -h 2>&1 | sed -n '/^\s*--/s/ \+/ /gp' | awk '{print $1}' | tr '\n' ' ')
local cur prev
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
case "$prev" in
--@(config|tls-cert-file|tls-key-file|authenticated-emails-file|htpasswd-file|custom-templates-dir|logging-filename|jwt-key-file))
_filedir
return 0
;;
--provider)
COMPREPLY=( $(compgen -W "google azure facebook github keycloak gitlab linkedin login.gov digitalocean" -- ${cur}) )
return 0
;;
--real-client-ip-header)
COMPREPLY=( $(compgen -W 'X-Real-IP X-Forwarded-For X-ProxyUser-IP' -- ${cur}) )
return 0
;;
--@(http-address|https-address|redirect-url|upstream|basic-auth-password|skip-auth-regex|flush-interval|extra-jwt-issuers|email-domain|whitelist-domain|trusted-ip|keycloak-group|azure-tenant|bitbucket-team|bitbucket-repository|github-org|github-team|github-repo|github-token|gitlab-group|github-user|google-group|google-admin-email|google-service-account-json|client-id|client_secret|banner|footer|proxy-prefix|ping-path|ready-path|cookie-name|cookie-secret|cookie-domain|cookie-path|cookie-expire|cookie-refresh|cookie-samesite|redist-sentinel-master-name|redist-sentinel-connection-urls|redist-cluster-connection-urls|logging-max-size|logging-max-age|logging-max-backups|standard-logging-format|request-logging-format|exclude-logging-paths|auth-logging-format|oidc-issuer-url|oidc-jwks-url|login-url|redeem-url|profile-url|resource|validate-url|scope|approval-prompt|signature-key|acr-values|jwt-key|pubjwk-url|force-json-errors))
return 0
;;
esac
COMPREPLY=( $(compgen -W "${_oauth2_proxy_commands}" -- ${cur}) )
return 0;
}
complete -F _oauth2_proxy oauth2-proxy

View File

@ -1,61 +0,0 @@
package main
import (
"crypto/hmac"
"crypto/sha1"
"encoding/base64"
"fmt"
"net/http"
"strconv"
"strings"
"time"
)
func validateCookie(cookie *http.Cookie, seed string) (string, bool) {
// value, timestamp, sig
parts := strings.Split(cookie.Value, "|")
if len(parts) != 3 {
return "", false
}
sig := cookieSignature(seed, cookie.Name, parts[0], parts[1])
if checkHmac(parts[2], sig) {
ts, err := strconv.Atoi(parts[1])
if err == nil && int64(ts) > time.Now().Add(time.Duration(24)*7*time.Hour*-1).Unix() {
// it's a valid cookie. now get the contents
rawValue, err := base64.URLEncoding.DecodeString(parts[0])
if err == nil {
return string(rawValue), true
}
}
}
return "", false
}
func signedCookieValue(seed string, key string, value string) string {
encodedValue := base64.URLEncoding.EncodeToString([]byte(value))
timeStr := fmt.Sprintf("%d", time.Now().Unix())
sig := cookieSignature(seed, key, encodedValue, timeStr)
cookieVal := fmt.Sprintf("%s|%s|%s", encodedValue, timeStr, sig)
return cookieVal
}
func cookieSignature(args ...string) string {
h := hmac.New(sha1.New, []byte(args[0]))
for _, arg := range args[1:] {
h.Write([]byte(arg))
}
var b []byte
b = h.Sum(b)
return base64.URLEncoding.EncodeToString(b)
}
func checkHmac(input, expected string) bool {
inputMAC, err1 := base64.URLEncoding.DecodeString(input)
if err1 == nil {
expectedMAC, err2 := base64.URLEncoding.DecodeString(expected)
if err2 == nil {
return hmac.Equal(inputMAC, expectedMAC)
}
}
return false
}

75
dist.sh
View File

@ -1,30 +1,57 @@
#!/bin/bash
#!/usr/bin/env bash
# build binary distributions for linux/amd64 and darwin/amd64
set -e
set -o errexit
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "working dir $DIR"
mkdir -p $DIR/dist
mkdir -p $DIR/.godeps
export GOPATH=$DIR/.godeps:$GOPATH
gpm install
if [[ -z ${BINARY} ]] || [[ -z ${VERSION} ]]; then
echo "Missing required env var: BINARY=X VERSION=X $(basename $0)"
exit 1
fi
os=$(go env GOOS)
arch=$(go env GOARCH)
version=$(cat $DIR/version.go | grep "const VERSION" | awk '{print $NF}' | sed 's/"//g')
goversion=$(go version | awk '{print $3}')
ARCHS=(
darwin-amd64
darwin-arm64
linux-amd64
linux-arm64
linux-armv5
linux-armv6
linux-armv7
linux-ppc64le
linux-s390x
freebsd-amd64
windows-amd64
)
echo "... running tests"
./test.sh || exit 1
mkdir -p release
for os in linux darwin; do
echo "... building v$version for $os/$arch"
BUILD=$(mktemp -d -t google_auth_proxy)
TARGET="google_auth_proxy-$version.$os-$arch.$goversion"
GOOS=$os GOARCH=$arch CGO_ENABLED=0 go build -o $BUILD/$TARGET/google_auth_proxy || exit 1
pushd $BUILD
tar czvf $TARGET.tar.gz $TARGET
mv $TARGET.tar.gz $DIR/dist
popd
# Create architecture specific release dirs
for ARCH in "${ARCHS[@]}"; do
mkdir -p release/${BINARY}-${VERSION}.${ARCH}
GO_OS=$(echo $ARCH | awk -F- '{print $1}')
GO_ARCH=$(echo $ARCH | awk -F- '{print $2}')
# Create architecture specific binaries
if [[ ${GO_ARCH} == armv* ]]; then
GO_ARM=$(echo $GO_ARCH | awk -Fv '{print $2}')
GO111MODULE=on GOOS=${GO_OS} GOARCH=arm GOARM=${GO_ARM} CGO_ENABLED=0 go build \
-ldflags="-X github.com/oauth2-proxy/oauth2-proxy/v7/pkg/version.VERSION=${VERSION}" \
-o release/${BINARY}-${VERSION}.${ARCH}/${BINARY} .
else
GO111MODULE=on GOOS=${GO_OS} GOARCH=${GO_ARCH} CGO_ENABLED=0 go build \
-ldflags="-X github.com/oauth2-proxy/oauth2-proxy/v7/pkg/version.VERSION=${VERSION}" \
-o release/${BINARY}-${VERSION}.${ARCH}/${BINARY} .
fi
cd release
# Create tar file for architecture specific binary
tar -czvf ${BINARY}-${VERSION}.${ARCH}.tar.gz ${BINARY}-${VERSION}.${ARCH}
# Create sha256sum for architecture-specific tar
sha256sum ${BINARY}-${VERSION}.${ARCH}.tar.gz > ${BINARY}-${VERSION}.${ARCH}.tar.gz-sha256sum.txt
# Create sha256sum for architecture specific binary
sha256sum ${BINARY}-${VERSION}.${ARCH}/${BINARY} > ${BINARY}-${VERSION}.${ARCH}-sha256sum.txt
cd ..
done

23
docs/.gitignore vendored Normal file
View File

@ -0,0 +1,23 @@
# Dependencies
/node_modules
package-lock.json
pnpm-lock.yaml
yarn.lock
# Production
/build
# Generated files
.docusaurus
.cache-loader
# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*

33
docs/README.md Normal file
View File

@ -0,0 +1,33 @@
# Website
This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.
## Installation
```console
npm install
```
## Local Development
```console
npm start
```
This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.
## Build
```console
npm run build
```
This command generates static content into the `build` directory and can be served using any static contents hosting service.
## Deployment
```console
GIT_USER=<Your GitHub username> USE_SSH=true npm deploy
```
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

3
docs/babel.config.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};

11
docs/docs/behaviour.md Normal file
View File

@ -0,0 +1,11 @@
---
id: behaviour
title: Behaviour
---
1. Any request passing through the proxy (and not matched by `--skip-auth-regex`) is checked for the proxy's session cookie (`--cookie-name`) (or, if allowed, a JWT token - see `--skip-jwt-bearer-tokens`).
2. If authentication is required but missing then the user is asked to log in and redirected to the authentication provider (unless it is an Ajax request, i.e. one with `Accept: application/json`, in which case 401 Unauthorized is returned)
3. After returning from the authentication provider, the oauth tokens are stored in the configured session store (cookie, redis, ...) and a cookie is set
4. The request is forwarded to the upstream server with added user info and authentication headers (depending on the configuration)
Notice that the proxy also provides a number of useful [endpoints](features/endpoints.md).

View File

@ -0,0 +1,91 @@
---
id: contribution
title: Contribution Guide
---
We track bugs and issues using Github.
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.
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.
Please mention open bug issue number(s) within your PR if applicable.
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.
# Go version
See the `go.mod` file in the root of this repository for the version of Go used by this project.
You can follow [the installation guide for Go](https://go.dev/doc/install),
and you can find this specific Go version on [the Go downloads page](https://go.dev/dl/).
# Preparing your fork
Clone your fork, create a feature branch and update the depedencies to get started.
```bash
git clone git@github.com:<YOUR_FORK>/oauth2-proxy
cd oauth2-proxy
git branch feature/<BRANCH_NAME>
git push --set-upstream origin feature/<BRANCH_NAME>
go mod download
```
# Testing / Debugging
For starting oauth2-proxy locally open the debugging tab and create the `launch.json` and select `Go: Launch Package`.
![Debugging Tab](/img/debug-tab.png)
```json
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch OAuth2-Proxy with Dex",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}",
"args": [
"--config",
// The following configuration contains settings for a locally deployed
// upstream and dex as an idetity provider
"contrib/local-environment/oauth2-proxy.cfg"
]
},
{
"name": "Launch OAuth2-Proxy with Keycloak",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}",
"args": [
"--config",
// The following configuration contains settings for a locally deployed
// upstream and keycloak as an idetity provider
"contrib/local-environment/oauth2-proxy-keycloak.cfg"
]
}
]
}
```
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.
Inside the `contrib/local-environment` directory you can use the `Makefile` for
starting different example setups:
- Dex as your IdP: `make up` or `make down`
- Dex as your IdP using the alpha-config: `make alpha-config-up`
- Keycloak as your IdP: `make keycloak-up`
- Dex as your IdP & nginx reverse proxy: `make nginx-up`
- and many more...
Check out the `Makefile` to see what is available.
The username and password for all setups is usually `admin@example.com` and `password`.
The docker compose setups expose the services with a dynamic reverse DNS resolver: localtest.me
- OAuth2-Proxy: http://oauth2-proxy.localtest.me:4180
- Upstream: http://httpbin.localtest.me:8080
- Dex: http://dex.localtest.me:5556

View File

@ -0,0 +1,49 @@
---
id: security
title: Security
---
:::note
OAuth2 Proxy is a community project.
Maintainers do not work on this project full time, and as such,
while we endeavour to respond to disclosures as quickly as possible,
this may take longer than in projects with corporate sponsorship.
:::
## Security Disclosures
:::important
If 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.
:::
Security disclosures MUST be done in private.
If you have found an issue that you would like to bring to the attention of the
maintenance team for OAuth2 Proxy, please compose an email and send it to the
list of maintainers in our [MAINTAINERS](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/MAINTAINERS) file.
Please include as much detail as possible.
Ideally, your disclosure should include:
- A reproducible case that can be used to demonstrate the exploit
- How you discovered this vulnerability
- A potential fix for the issue (if you have thought of one)
- Versions affected (if not present in master)
- Your GitHub ID
### How will we respond to disclosures?
We use [GitHub Security Advisories](https://docs.github.com/en/github/managing-security-vulnerabilities/about-github-security-advisories)
to privately discuss fixes for disclosed vulnerabilities.
If you include a GitHub ID with your disclosure we will add you as a collaborator
for the advisory so that you can join the discussion and validate any fixes
we may propose.
For minor issues and previously disclosed vulnerabilities (typically for
dependencies), we may use regular PRs for fixes and forego the security advisory.
Once a fix has been agreed upon, we will merge the fix and create a new release.
If we have multiple security issues in flight simultaneously, we may delay
merging fixes until all patches are ready.
We may also backport the fix to previous releases,
but this will be at the discretion of the maintainers.

View File

@ -0,0 +1,565 @@
---
id: alpha-config
title: Alpha Configuration
---
:::warning
This page contains documentation for alpha features.
We reserve the right to make breaking changes to the features detailed within this page with no notice.
Options described in this page may be changed, removed, renamed or moved without prior warning.
Please beware of this before you use alpha configuration options.
:::
This page details a set of **alpha** configuration options in a new format.
Going forward we are intending to add structured configuration in YAML format to
replace the existing TOML based configuration file and flags.
Below is a reference for the structure of the configuration, with
[AlphaOptions](#alphaoptions) as the root of the configuration.
When using alpha configuration, your config file will look something like below:
```yaml
upstreams:
- id: ...
...: ...
injectRequestHeaders:
- name: ...
...: ...
injectResponseHeaders:
- name: ...
...: ...
```
Please browse the [reference](#configuration-reference) below for the structure
of the new configuration format.
## Using Alpha Configuration
To use the new **alpha** configuration, generate a YAML file based on the format
described in the [reference](#configuration-reference) below.
Provide the path to this file using the `--alpha-config` flag.
:::note
When using the `--alpha-config` flag, some options are no longer available.
See [removed options](#removed-options) below for more information.
:::
### Converting configuration to the new structure
Before adding the new `--alpha-config` option, start OAuth2 Proxy using the
`convert-config-to-alpha` flag to convert existing configuration to the new format.
```bash
oauth2-proxy --convert-config-to-alpha --config ./path/to/existing/config.cfg
```
This will convert any options supported by the new format to YAML and print the
new configuration to `STDOUT`.
Copy this to a new file, remove any options from your existing configuration
noted in [removed options](#removed-options) and then start OAuth2 Proxy using
the new config.
```bash
oauth2-proxy --alpha-config ./path/to/new/config.yaml --config ./path/to/existing/config.cfg
```
## Using ENV variables in the alpha configuration
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.
When using environment variables, your yaml will look like this:
```yaml
providers:
- provider: azure
clientSecret: ${CLIENT_SECRET}
...
```
Where CLIENT_SECRET is an environment variable.
More information and available patterns can be found [here](https://github.com/a8m/envsubst#docs)
## Removed options
The following flags/options and their respective environment variables are no
longer available when using alpha configuration:
<!-- Legacy Upstream FlagSet -->
- `flush-interval`/`flush_interval`
- `pass-host-header`/`pass_host_header`
- `proxy-websockets`/`proxy_websockets`
- `ssl-upstream-insecure-skip-verify`/`ssl_upstream_insecure_skip_verify`
- `upstream`/`upstreams`
<!-- Legacy Headers FlagSet -->
- `pass-basic-auth`/`pass_basic_auth`
- `pass-access-token`/`pass_access_token`
- `pass-user-headers`/`pass_user_headers`
- `pass-authorization-header`/`pass_authorization_header`
- `set-basic-auth`/`set_basic_auth`
- `set-xauthrequest`/`set_xauthrequest`
- `set-authorization-header`/`set_authorization_header`
- `prefer-email-to-user`/`prefer_email_to_user`
- `basic-auth-password`/`basic_auth_password`
- `skip-auth-strip-headers`/`skip_auth_strip_headers`
<!-- Legacy provider FlagSet -->
- `client-id`/`client_id`
- `client-secret`/`client_secret`, and `client-secret-file`/`client_secret_file`
- `provider`
- `provider-display-name`/`provider_display_name`
- `provider-ca-file`/`provider_ca_files`
- `login-url`/`login_url`
- `redeem-url`/`redeem_url`
- `profile-url`/`profile_url`
- `resource`
- `validate-url`/`validate_url`
- `scope`
- `prompt`
- `approval-prompt`/`approval_prompt`
- `acr-values`/`acr_values`
- `user-id-claim`/`user_id_claim`
- `allowed-group`/`allowed_groups`
- `allowed-role`/`allowed_roles`
- `jwt-key`/`jwt_key`
- `jwt-key-file`/`jwt_key_file`
- `pubjwk-url`/`pubjwk_url`
and all provider-specific options, i.e. any option whose name includes `oidc`,
`azure`, `bitbucket`, `github`, `gitlab`, `google` or `keycloak`. Attempting to
use any of these options via flags or via config when `--alpha-config` is
set will result in an error.
:::important
You must remove these options before starting OAuth2 Proxy with `--alpha-config`
:::
## Configuration Reference
<!--- THIS FILE IS AUTOGENERATED!!! DO NOT EDIT!!! -->
### ADFSOptions
(**Appears on:** [Provider](#provider))
| Field | Type | Description |
| ----- | ---- | ----------- |
| `skipScope` | _bool_ | Skip adding the scope parameter in login request<br/>Default value is 'false' |
### AlphaOptions
AlphaOptions contains alpha structured configuration options.
Usage of these options allows users to access alpha features that are not
available as part of the primary configuration structure for OAuth2 Proxy.
:::warning
The options within this structure are considered alpha.
They may change between releases without notice.
:::
| Field | Type | Description |
| ----- | ---- | ----------- |
| `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. |
| `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. |
| `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. |
| `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. |
| `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. |
| `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) |
### AzureOptions
(**Appears on:** [Provider](#provider))
| Field | Type | Description |
| ----- | ---- | ----------- |
| `tenant` | _string_ | Tenant directs to a tenant-specific or common (tenant-independent) endpoint<br/>Default value is 'common' |
| `graphGroupField` | _string_ | GraphGroupField configures the group field to be used when building the groups list from Microsoft Graph<br/>Default value is 'id' |
### BitbucketOptions
(**Appears on:** [Provider](#provider))
| Field | Type | Description |
| ----- | ---- | ----------- |
| `team` | _string_ | Team sets restrict logins to members of this team |
| `repository` | _string_ | Repository sets restrict logins to user with access to this repository |
### ClaimSource
(**Appears on:** [HeaderValue](#headervalue))
ClaimSource allows loading a header value from a claim within the session
| Field | Type | Description |
| ----- | ---- | ----------- |
| `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`. |
| `prefix` | _string_ | Prefix is an optional prefix that will be prepended to the value of the<br/>claim if it is non-empty. |
| `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. |
### Duration
#### (`string` alias)
(**Appears on:** [Upstream](#upstream))
Duration is as string representation of a period of time.
A duration string is a is a possibly signed sequence of decimal numbers,
each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m".
Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
### GitHubOptions
(**Appears on:** [Provider](#provider))
| Field | Type | Description |
| ----- | ---- | ----------- |
| `org` | _string_ | Org sets restrict logins to members of this organisation |
| `team` | _string_ | Team sets restrict logins to members of this team |
| `repo` | _string_ | Repo sets restrict logins to collaborators of this repository |
| `token` | _string_ | Token is the token to use when verifying repository collaborators<br/>it must have push access to the repository |
| `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 |
### GitLabOptions
(**Appears on:** [Provider](#provider))
| Field | Type | Description |
| ----- | ---- | ----------- |
| `group` | _[]string_ | Group sets restrict logins to members of this group |
| `projects` | _[]string_ | Projects restricts logins to members of these projects |
### GoogleOptions
(**Appears on:** [Provider](#provider))
| Field | Type | Description |
| ----- | ---- | ----------- |
| `group` | _[]string_ | Groups sets restrict logins to members of this Google group |
| `adminEmail` | _string_ | AdminEmail is the Google admin to impersonate for api calls |
| `serviceAccountJson` | _string_ | ServiceAccountJSON is the path to the service account json credentials |
| `useApplicationDefaultCredentials` | _bool_ | UseApplicationDefaultCredentials is a boolean whether to use Application Default Credentials instead of a ServiceAccountJSON |
| `targetPrincipal` | _string_ | TargetPrincipal is the Google Service Account used for Application Default Credentials |
### Header
(**Appears on:** [AlphaOptions](#alphaoptions))
Header represents an individual header that will be added to a request or
response header.
| Field | Type | Description |
| ----- | ---- | ----------- |
| `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. |
| `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). |
| `values` | _[[]HeaderValue](#headervalue)_ | Values contains the desired values for this header |
### HeaderValue
(**Appears on:** [Header](#header))
HeaderValue represents a single header value and the sources that can
make up the header value
| Field | Type | Description |
| ----- | ---- | ----------- |
| `value` | _[]byte_ | Value expects a base64 encoded string value. |
| `fromEnv` | _string_ | FromEnv expects the name of an environment variable. |
| `fromFile` | _string_ | FromFile expects a path to a file containing the secret value. |
| `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`. |
| `prefix` | _string_ | Prefix is an optional prefix that will be prepended to the value of the<br/>claim if it is non-empty. |
| `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. |
### KeycloakOptions
(**Appears on:** [Provider](#provider))
| Field | Type | Description |
| ----- | ---- | ----------- |
| `groups` | _[]string_ | Group enables to restrict login to members of indicated group |
| `roles` | _[]string_ | Role enables to restrict login to users with role (only available when using the keycloak-oidc provider) |
### LoginGovOptions
(**Appears on:** [Provider](#provider))
| Field | Type | Description |
| ----- | ---- | ----------- |
| `jwtKey` | _string_ | JWTKey is a private key in PEM format used to sign JWT, |
| `jwtKeyFile` | _string_ | JWTKeyFile is a path to the private key file in PEM format used to sign the JWT |
| `pubjwkURL` | _string_ | PubJWKURL is the JWK pubkey access endpoint |
### LoginURLParameter
(**Appears on:** [Provider](#provider))
LoginURLParameter is the configuration for a single query parameter that
can be passed through from the `/oauth2/start` endpoint to the IdP login
URL. The "default" option specifies the default value or values (if any)
that will be passed to the IdP for this parameter, and "allow" is a list
of options for ways in which this parameter can be set or overridden via
the query string to `/oauth2/start`.
If _only_ a default is specified and no "allow" then the parameter is
effectively fixed - the default value will always be used and anything
passed to the start URL will be ignored. If _only_ "allow" is specified
but no default then the parameter will only be passed on to the IdP if
the caller provides it, and no value will be sent otherwise.
Examples:
# A parameter whose value is fixed
```
name: organization
default:
- myorg
```
A parameter that is not passed by default, but may be set to one of a
fixed set of values
```
name: prompt
allow:
- value: login
- value: consent
- value: select_account
```
A parameter that is passed by default but may be overridden by one of
a fixed set of values
```
name: prompt
default: ["login"]
allow:
- value: consent
- value: select_account
```
A parameter that may be overridden, but only by values that match a
regular expression. For example to restrict `login_hint` to email
addresses in your organization's domain:
```
name: login_hint
allow:
- pattern: '^[^@]*@example\.com$'
# this allows at most one "@" sign, and requires "example.com" domain.
```
Note that the YAML rules around exactly which characters are allowed
and/or require escaping in different types of string literals are
convoluted. For regular expressions the single quoted form is simplest
as backslash is not considered to be an escape character. Alternatively
use the "chomped block" format `|-`:
```
- pattern: |-
^[^@]*@example\.com$
```
The hyphen is important, a `|` block would have a trailing newline
character.
| Field | Type | Description |
| ----- | ---- | ----------- |
| `name` | _string_ | Name specifies the name of the query parameter. |
| `default` | _[]string_ | _(Optional)_ Default specifies a default value or values that will be<br/>passed to the IdP if not overridden. |
| `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. |
### MicrosoftEntraIDOptions
(**Appears on:** [Provider](#provider))
| Field | Type | Description |
| ----- | ---- | ----------- |
| `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). |
| `federatedTokenAuth` | _bool_ | FederatedTokenAuth enable oAuth2 client authentication with federated token projected<br/>by Entra Workload Identity plugin, instead of client secret. |
### OIDCOptions
(**Appears on:** [Provider](#provider))
| Field | Type | Description |
| ----- | ---- | ----------- |
| `issuerURL` | _string_ | IssuerURL is the OpenID Connect issuer URL<br/>eg: https://accounts.google.com |
| `insecureAllowUnverifiedEmail` | _bool_ | InsecureAllowUnverifiedEmail prevents failures if an email address in an id_token is not verified<br/>default set to 'false' |
| `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' |
| `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. |
| `skipDiscovery` | _bool_ | SkipDiscovery allows to skip OIDC discovery and use manually supplied Endpoints<br/>default set to 'false' |
| `jwksURL` | _string_ | JwksURL is the OpenID Connect JWKS URL<br/>eg: https://www.googleapis.com/oauth2/v3/certs |
| `publicKeyFiles` | _[]string_ | PublicKeyFiles is a list of paths pointing to public key files in PEM format to use<br/>for verifying JWT tokens |
| `emailClaim` | _string_ | EmailClaim indicates which claim contains the user email,<br/>default set to 'email' |
| `groupsClaim` | _string_ | GroupsClaim indicates which claim contains the user groups<br/>default set to 'groups' |
| `userIDClaim` | _string_ | UserIDClaim indicates which claim contains the user ID<br/>default set to 'email' |
| `audienceClaims` | _[]string_ | AudienceClaim allows to define any claim that is verified against the client id<br/>By default `aud` claim is used for verification. |
| `extraAudiences` | _[]string_ | ExtraAudiences is a list of additional audiences that are allowed<br/>to pass verification in addition to the client id. |
### Provider
(**Appears on:** [Providers](#providers))
Provider holds all configuration for a single provider
| Field | Type | Description |
| ----- | ---- | ----------- |
| `clientID` | _string_ | ClientID is the OAuth Client ID that is defined in the provider<br/>This value is required for all providers. |
| `clientSecret` | _string_ | ClientSecret is the OAuth Client Secret that is defined in the provider<br/>This value is required for all providers. |
| `clientSecretFile` | _string_ | ClientSecretFile is the name of the file<br/>containing the OAuth Client Secret, it will be used if ClientSecret is not set. |
| `keycloakConfig` | _[KeycloakOptions](#keycloakoptions)_ | KeycloakConfig holds all configurations for Keycloak provider. |
| `azureConfig` | _[AzureOptions](#azureoptions)_ | AzureConfig holds all configurations for Azure provider. |
| `microsoftEntraIDConfig` | _[MicrosoftEntraIDOptions](#microsoftentraidoptions)_ | MicrosoftEntraIDConfig holds all configurations for Entra ID provider. |
| `ADFSConfig` | _[ADFSOptions](#adfsoptions)_ | ADFSConfig holds all configurations for ADFS provider. |
| `bitbucketConfig` | _[BitbucketOptions](#bitbucketoptions)_ | BitbucketConfig holds all configurations for Bitbucket provider. |
| `githubConfig` | _[GitHubOptions](#githuboptions)_ | GitHubConfig holds all configurations for GitHubC provider. |
| `gitlabConfig` | _[GitLabOptions](#gitlaboptions)_ | GitLabConfig holds all configurations for GitLab provider. |
| `googleConfig` | _[GoogleOptions](#googleoptions)_ | GoogleConfig holds all configurations for Google provider. |
| `oidcConfig` | _[OIDCOptions](#oidcoptions)_ | OIDCConfig holds all configurations for OIDC provider<br/>or providers utilize OIDC configurations. |
| `loginGovConfig` | _[LoginGovOptions](#logingovoptions)_ | LoginGovConfig holds all configurations for LoginGov provider. |
| `id` | _string_ | ID should be a unique identifier for the provider.<br/>This value is required for all providers. |
| `provider` | _[ProviderType](#providertype)_ | Type is the OAuth provider<br/>must be set from the supported providers group,<br/>otherwise 'Google' is set as default |
| `name` | _string_ | Name is the providers display name<br/>if set, it will be shown to the users in the login page. |
| `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 |
| `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. |
| `loginURL` | _string_ | LoginURL is the authentication endpoint |
| `loginURLParameters` | _[[]LoginURLParameter](#loginurlparameter)_ | LoginURLParameters defines the parameters that can be passed from the start URL to the IdP login URL |
| `authRequestResponseMode` | _string_ | AuthRequestResponseMode defines the response mode to request during authorization request |
| `redeemURL` | _string_ | RedeemURL is the token redemption endpoint |
| `profileURL` | _string_ | ProfileURL is the profile access endpoint |
| `skipClaimsFromProfileURL` | _bool_ | SkipClaimsFromProfileURL allows to skip request to Profile URL for resolving claims not present in id_token<br/>default set to 'false' |
| `resource` | _string_ | ProtectedResource is the resource that is protected (Azure AD and ADFS only) |
| `validateURL` | _string_ | ValidateURL is the access token validation endpoint |
| `scope` | _string_ | Scope is the OAuth scope specification |
| `allowedGroups` | _[]string_ | AllowedGroups is a list of restrict logins to members of this group |
| `code_challenge_method` | _string_ | The code challenge method |
| `backendLogoutURL` | _string_ | URL to call to perform backend logout, `{id_token}` would be replaced by the actual `id_token` if available in the session |
### ProviderType
#### (`string` alias)
(**Appears on:** [Provider](#provider))
ProviderType is used to enumerate the different provider type options
Valid options are: adfs, azure, bitbucket, digitalocean facebook, github,
gitlab, google, keycloak, keycloak-oidc, linkedin, login.gov, nextcloud
and oidc.
### Providers
#### ([[]Provider](#provider) alias)
(**Appears on:** [AlphaOptions](#alphaoptions))
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).
### SecretSource
(**Appears on:** [ClaimSource](#claimsource), [HeaderValue](#headervalue), [TLS](#tls))
SecretSource references an individual secret value.
Only one source within the struct should be defined at any time.
| Field | Type | Description |
| ----- | ---- | ----------- |
| `value` | _[]byte_ | Value expects a base64 encoded string value. |
| `fromEnv` | _string_ | FromEnv expects the name of an environment variable. |
| `fromFile` | _string_ | FromFile expects a path to a file containing the secret value. |
### Server
(**Appears on:** [AlphaOptions](#alphaoptions))
Server represents the configuration for an HTTP(S) server
| Field | Type | Description |
| ----- | ---- | ----------- |
| `BindAddress` | _string_ | BindAddress is the address on which to serve traffic.<br/>Leave blank or set to "-" to disable. |
| `SecureBindAddress` | _string_ | SecureBindAddress is the address on which to serve secure traffic.<br/>Leave blank or set to "-" to disable. |
| `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. |
### TLS
(**Appears on:** [Server](#server))
TLS contains the information for loading a TLS certificate and key
as well as an optional minimal TLS version that is acceptable.
| Field | Type | Description |
| ----- | ---- | ----------- |
| `Key` | _[SecretSource](#secretsource)_ | Key is the TLS key data to use.<br/>Typically this will come from a file. |
| `Cert` | _[SecretSource](#secretsource)_ | Cert is the TLS certificate data to use.<br/>Typically this will come from a file. |
| `MinVersion` | _string_ | MinVersion is the minimal TLS version that is acceptable.<br/>E.g. Set to "TLS1.3" to select TLS version 1.3 |
| `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). |
### URLParameterRule
(**Appears on:** [LoginURLParameter](#loginurlparameter))
URLParameterRule represents a rule by which query parameters
passed to the `/oauth2/start` endpoint are checked to determine whether
they are valid overrides for the given parameter passed to the IdP's
login URL. Either Value or Pattern should be supplied, not both.
| Field | Type | Description |
| ----- | ---- | ----------- |
| `value` | _string_ | A Value rule matches just this specific value |
| `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 `$`. |
### Upstream
(**Appears on:** [UpstreamConfig](#upstreamconfig))
Upstream represents the configuration for an upstream server.
Requests will be proxied to this upstream if the path matches the request path.
| Field | Type | Description |
| ----- | ---- | ----------- |
| `id` | _string_ | ID should be a unique identifier for the upstream.<br/>This value is required for all upstreams. |
| `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 |
| `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`. |
| `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". |
| `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. |
| `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. |
| `staticCode` | _int_ | StaticCode determines the response code for the Static response.<br/>This option can only be used with Static enabled. |
| `flushInterval` | _[Duration](#duration)_ | FlushInterval is the period between flushing the response buffer when<br/>streaming response from the upstream.<br/>Defaults to 1 second. |
| `passHostHeader` | _bool_ | PassHostHeader determines whether the request host header should be proxied<br/>to the upstream server.<br/>Defaults to true. |
| `proxyWebSockets` | _bool_ | ProxyWebSockets enables proxying of websockets to upstream servers<br/>Defaults to true. |
| `timeout` | _[Duration](#duration)_ | Timeout is the maximum duration the server will wait for a response from the upstream server.<br/>Defaults to 30 seconds. |
| `disableKeepAlives` | _bool_ | DisableKeepAlives disables HTTP keep-alive connections to the upstream server.<br/>Defaults to false. |
### UpstreamConfig
(**Appears on:** [AlphaOptions](#alphaoptions))
UpstreamConfig is a collection of definitions for upstream servers.
| Field | Type | Description |
| ----- | ---- | ----------- |
| `proxyRawPath` | _bool_ | ProxyRawPath will pass the raw url path to upstream allowing for urls<br/>like: "/%2F/" which would otherwise be redirected to "/" |
| `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. |

View File

@ -0,0 +1,139 @@
---
id: alpha-config
title: Alpha Configuration
---
:::warning
This page contains documentation for alpha features.
We reserve the right to make breaking changes to the features detailed within this page with no notice.
Options described in this page may be changed, removed, renamed or moved without prior warning.
Please beware of this before you use alpha configuration options.
:::
This page details a set of **alpha** configuration options in a new format.
Going forward we are intending to add structured configuration in YAML format to
replace the existing TOML based configuration file and flags.
Below is a reference for the structure of the configuration, with
[AlphaOptions](#alphaoptions) as the root of the configuration.
When using alpha configuration, your config file will look something like below:
```yaml
upstreams:
- id: ...
...: ...
injectRequestHeaders:
- name: ...
...: ...
injectResponseHeaders:
- name: ...
...: ...
```
Please browse the [reference](#configuration-reference) below for the structure
of the new configuration format.
## Using Alpha Configuration
To use the new **alpha** configuration, generate a YAML file based on the format
described in the [reference](#configuration-reference) below.
Provide the path to this file using the `--alpha-config` flag.
:::note
When using the `--alpha-config` flag, some options are no longer available.
See [removed options](#removed-options) below for more information.
:::
### Converting configuration to the new structure
Before adding the new `--alpha-config` option, start OAuth2 Proxy using the
`convert-config-to-alpha` flag to convert existing configuration to the new format.
```bash
oauth2-proxy --convert-config-to-alpha --config ./path/to/existing/config.cfg
```
This will convert any options supported by the new format to YAML and print the
new configuration to `STDOUT`.
Copy this to a new file, remove any options from your existing configuration
noted in [removed options](#removed-options) and then start OAuth2 Proxy using
the new config.
```bash
oauth2-proxy --alpha-config ./path/to/new/config.yaml --config ./path/to/existing/config.cfg
```
## Using ENV variables in the alpha configuration
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.
When using environment variables, your yaml will look like this:
```yaml
providers:
- provider: azure
clientSecret: ${CLIENT_SECRET}
...
```
Where CLIENT_SECRET is an environment variable.
More information and available patterns can be found [here](https://github.com/a8m/envsubst#docs)
## Removed options
The following flags/options and their respective environment variables are no
longer available when using alpha configuration:
<!-- Legacy Upstream FlagSet -->
- `flush-interval`/`flush_interval`
- `pass-host-header`/`pass_host_header`
- `proxy-websockets`/`proxy_websockets`
- `ssl-upstream-insecure-skip-verify`/`ssl_upstream_insecure_skip_verify`
- `upstream`/`upstreams`
<!-- Legacy Headers FlagSet -->
- `pass-basic-auth`/`pass_basic_auth`
- `pass-access-token`/`pass_access_token`
- `pass-user-headers`/`pass_user_headers`
- `pass-authorization-header`/`pass_authorization_header`
- `set-basic-auth`/`set_basic_auth`
- `set-xauthrequest`/`set_xauthrequest`
- `set-authorization-header`/`set_authorization_header`
- `prefer-email-to-user`/`prefer_email_to_user`
- `basic-auth-password`/`basic_auth_password`
- `skip-auth-strip-headers`/`skip_auth_strip_headers`
<!-- Legacy provider FlagSet -->
- `client-id`/`client_id`
- `client-secret`/`client_secret`, and `client-secret-file`/`client_secret_file`
- `provider`
- `provider-display-name`/`provider_display_name`
- `provider-ca-file`/`provider_ca_files`
- `login-url`/`login_url`
- `redeem-url`/`redeem_url`
- `profile-url`/`profile_url`
- `resource`
- `validate-url`/`validate_url`
- `scope`
- `prompt`
- `approval-prompt`/`approval_prompt`
- `acr-values`/`acr_values`
- `user-id-claim`/`user_id_claim`
- `allowed-group`/`allowed_groups`
- `allowed-role`/`allowed_roles`
- `jwt-key`/`jwt_key`
- `jwt-key-file`/`jwt_key_file`
- `pubjwk-url`/`pubjwk_url`
and all provider-specific options, i.e. any option whose name includes `oidc`,
`azure`, `bitbucket`, `github`, `gitlab`, `google` or `keycloak`. Attempting to
use any of these options via flags or via config when `--alpha-config` is
set will result in an error.
:::important
You must remove these options before starting OAuth2 Proxy with `--alpha-config`
:::
## Configuration Reference

View File

@ -0,0 +1,310 @@
---
id: integration
title: Integration
---
## Configuring for use with the Nginx `auth_request` directive
**This option requires `--reverse-proxy` option to be set.**
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:
```nginx
server {
listen 443 ssl;
server_name ...;
include ssl/ssl.conf;
location /oauth2/ {
proxy_pass http://127.0.0.1:4180;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Auth-Request-Redirect $request_uri;
# or, if you are handling multiple domains:
# proxy_set_header X-Auth-Request-Redirect $scheme://$host$request_uri;
}
location = /oauth2/auth {
proxy_pass http://127.0.0.1:4180;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Uri $request_uri;
# nginx auth_request includes headers but not body
proxy_set_header Content-Length "";
proxy_pass_request_body off;
}
location / {
auth_request /oauth2/auth;
error_page 401 =403 /oauth2/sign_in;
# pass information via X-User and X-Email headers to backend,
# requires running with --set-xauthrequest flag
auth_request_set $user $upstream_http_x_auth_request_user;
auth_request_set $email $upstream_http_x_auth_request_email;
proxy_set_header X-User $user;
proxy_set_header X-Email $email;
# if you enabled --pass-access-token, this will pass the token to the backend
auth_request_set $token $upstream_http_x_auth_request_access_token;
proxy_set_header X-Access-Token $token;
# if you enabled --cookie-refresh, this is needed for it to work with auth_request
auth_request_set $auth_cookie $upstream_http_set_cookie;
add_header Set-Cookie $auth_cookie;
# When using the --set-authorization-header flag, some provider's cookies can exceed the 4kb
# limit and so the OAuth2 Proxy splits these into multiple parts.
# Nginx normally only copies the first `Set-Cookie` header from the auth_request to the response,
# so if your cookies are larger than 4kb, you will need to extract additional cookies manually.
auth_request_set $auth_cookie_name_upstream_1 $upstream_cookie_auth_cookie_name_1;
# Extract the Cookie attributes from the first Set-Cookie header and append them
# to the second part ($upstream_cookie_* variables only contain the raw cookie content)
if ($auth_cookie ~* "(; .*)") {
set $auth_cookie_name_0 $auth_cookie;
set $auth_cookie_name_1 "auth_cookie_name_1=$auth_cookie_name_upstream_1$1";
}
# Send both Set-Cookie headers now if there was a second part
if ($auth_cookie_name_upstream_1) {
add_header Set-Cookie $auth_cookie_name_0;
add_header Set-Cookie $auth_cookie_name_1;
}
proxy_pass http://backend/;
# or "root /path/to/site;" or "fastcgi_pass ..." etc
}
}
```
When you use ingress-nginx in Kubernetes, you can configure the same behavior with the following annotations on your Ingress resource:
```yaml
nginx.ingress.kubernetes.io/auth-url: "https://<oauth2-proxy-fqdn>/oauth2/auth"
nginx.ingress.kubernetes.io/auth-signin: "https://<oauth2-proxy-fqdn>/oauth2/start?rd=$escaped_request_uri"
```
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/.
It is recommended to use `--session-store-type=redis` when expecting large sessions/OIDC tokens (_e.g._ with MS Azure).
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=".
## Configuring for use with the Traefik (v2) `ForwardAuth` middleware
**This option requires `--reverse-proxy` option to be set.**
### ForwardAuth with 401 errors middleware
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:
```yaml
http:
routers:
a-service:
rule: "Host(`a-service.example.com`)"
service: a-service-backend
middlewares:
- oauth-errors
- oauth-auth
tls:
certResolver: default
domains:
- main: "example.com"
sans:
- "*.example.com"
oauth:
rule: "Host(`a-service.example.com`, `oauth.example.com`) && PathPrefix(`/oauth2/`)"
middlewares:
- auth-headers
service: oauth-backend
tls:
certResolver: default
domains:
- main: "example.com"
sans:
- "*.example.com"
services:
a-service-backend:
loadBalancer:
servers:
- url: http://172.16.0.2:7555
oauth-backend:
loadBalancer:
servers:
- url: http://172.16.0.1:4180
middlewares:
auth-headers:
headers:
sslRedirect: true
stsSeconds: 315360000
browserXssFilter: true
contentTypeNosniff: true
forceSTSHeader: true
sslHost: example.com
stsIncludeSubdomains: true
stsPreload: true
frameDeny: true
oauth-auth:
forwardAuth:
address: https://oauth.example.com/oauth2/auth
trustForwardHeader: true
oauth-errors:
errors:
status:
- "401-403"
service: oauth-backend
query: "/oauth2/sign_in?rd={url}"
```
### ForwardAuth with static upstreams configuration
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
**Following options need to be set on `oauth2-proxy`:**
- `--upstream=static://202`: Configures a static response for authenticated sessions
- `--reverse-proxy=true`: Enables the use of `X-Forwarded-*` headers to determine redirects correctly
```yaml
http:
routers:
a-service-route-1:
rule: "Host(`a-service.example.com`, `b-service.example.com`) && PathPrefix(`/`)"
service: a-service-backend
middlewares:
- oauth-auth-redirect # redirects all unauthenticated to oauth2 signin
tls:
certResolver: default
domains:
- main: "example.com"
sans:
- "*.example.com"
a-service-route-2:
rule: "Host(`a-service.example.com`) && PathPrefix(`/no-auto-redirect`)"
service: a-service-backend
middlewares:
- oauth-auth-wo-redirect # unauthenticated session will return a 401
tls:
certResolver: default
domains:
- main: "example.com"
sans:
- "*.example.com"
services-oauth2-route:
rule: "Host(`a-service.example.com`, `b-service.example.com`) && PathPrefix(`/oauth2/`)"
middlewares:
- auth-headers
service: oauth-backend
tls:
certResolver: default
domains:
- main: "example.com"
sans:
- "*.example.com"
oauth2-proxy-route:
rule: "Host(`oauth.example.com`) && PathPrefix(`/`)"
middlewares:
- auth-headers
service: oauth-backend
tls:
certResolver: default
domains:
- main: "example.com"
sans:
- "*.example.com"
services:
a-service-backend:
loadBalancer:
servers:
- url: http://172.16.0.2:7555
b-service-backend:
loadBalancer:
servers:
- url: http://172.16.0.3:7555
oauth-backend:
loadBalancer:
servers:
- url: http://172.16.0.1:4180
middlewares:
auth-headers:
headers:
sslRedirect: true
stsSeconds: 315360000
browserXssFilter: true
contentTypeNosniff: true
forceSTSHeader: true
sslHost: example.com
stsIncludeSubdomains: true
stsPreload: true
frameDeny: true
oauth-auth-redirect:
forwardAuth:
address: https://oauth.example.com/
trustForwardHeader: true
authResponseHeaders:
- X-Auth-Request-Access-Token
- Authorization
oauth-auth-wo-redirect:
forwardAuth:
address: https://oauth.example.com/oauth2/auth
trustForwardHeader: true
authResponseHeaders:
- X-Auth-Request-Access-Token
- Authorization
```
## Configuring for use with the Caddy (v2) `forward_auth` directive
The [Caddy `forward_auth` directive](https://caddyserver.com/docs/caddyfile/directives/forward_auth) allows Caddy to authenticate requests via the `oauth2-proxy`'s `/auth`.
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.
**Following options need to be set on `oauth2-proxy`:**
- `--reverse-proxy=true`: Enables the use of `X-Forwarded-*` headers to determine redirects correctly
```nginx title="Caddyfile"
example.com {
# Requests to /oauth2/* are proxied to oauth2-proxy without authentication.
# You can't use `reverse_proxy /oauth2/* oauth2-proxy.internal:4180` here because the reverse_proxy directive has lower precedence than the handle directive.
handle /oauth2/* {
reverse_proxy oauth2-proxy.internal:4180 {
# oauth2-proxy requires the X-Real-IP and X-Forwarded-{Proto,Host,Uri} headers.
# The reverse_proxy directive automatically sets X-Forwarded-{For,Proto,Host} headers.
header_up X-Real-IP {remote_host}
header_up X-Forwarded-Uri {uri}
}
}
# Requests to other paths are first processed by oauth2-proxy for authentication.
handle {
forward_auth oauth2-proxy.internal:4180 {
uri /oauth2/auth
# oauth2-proxy requires the X-Real-IP and X-Forwarded-{Proto,Host,Uri} headers.
# The forward_auth directive automatically sets the X-Forwarded-{For,Proto,Host,Method,Uri} headers.
header_up X-Real-IP {remote_host}
# If needed, you can copy headers from the oauth2-proxy response to the request sent to the upstream.
# Make sure to configure the --set-xauthrequest flag to enable this feature.
#copy_headers X-Auth-Request-User X-Auth-Request-Email
# If oauth2-proxy returns a 401 status, redirect the client to the sign-in page.
@error status 401
handle_response @error {
redir * /oauth2/sign_in?rd={scheme}://{host}{uri}
}
}
# If oauth2-proxy returns a 2xx status, the request is then proxied to the upstream.
reverse_proxy upstream.internal:3000
}
}
```
:::note
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.
:::

View File

@ -0,0 +1,406 @@
---
id: overview
title: Overview
---
`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).
## Generating a Cookie Secret
To generate a strong cookie secret use one of the below commands:
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
<Tabs defaultValue="python">
<TabItem value="python" label="Python">
```shell
python -c 'import os,base64; print(base64.urlsafe_b64encode(os.urandom(32)).decode())'
```
</TabItem>
<TabItem value="bash" label="Bash">
```shell
dd if=/dev/urandom bs=32 count=1 2>/dev/null | base64 | tr -d -- '\n' | tr -- '+/' '-_' ; echo
```
</TabItem>
<TabItem value="openssl" label="OpenSSL">
```shell
openssl rand -base64 32 | tr -- '+/' '-_'
```
</TabItem>
<TabItem value="powershell" label="PowerShell">
```powershell
# Add System.Web assembly to session, just in case
Add-Type -AssemblyName System.Web
[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes([System.Web.Security.Membership]::GeneratePassword(32,4))).Replace("+","-").Replace("/","_")
```
</TabItem>
<TabItem value="terraform" label="Terraform">
```hcl
# Valid 32 Byte Base64 URL encoding set that will decode to 24 []byte AES-192 secret
resource "random_password" "cookie_secret" {
length = 32
override_special = "-_"
}
```
</TabItem>
</Tabs>
## Config File
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).
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`
## Config Options
### Command Line Options
| Flag | Description |
| ----------- | -------------------- |
| `--config` | path to config file |
| `--version` | print version string |
### General Provider Options
Provider specific options can be found on their respective subpages.
| Flag / Config Field | Type | Description | Default |
| --------------------------------------------------------------------------------------------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
| flag: `--acr-values`<br/>toml: `acr_values` | string | optional, see [docs](https://openid.net/specs/openid-connect-eap-acr-values-1_0.html#acrValues) | `""` |
| 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. | |
| flag: `--approval-prompt`<br/>toml: `approval_prompt` | string | OAuth approval_prompt | `"force"` |
| 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 | |
| flag: `--client-id`<br/>toml: `client_id` | string | the OAuth Client ID, e.g. `"123456.apps.googleusercontent.com"` | |
| flag: `--client-secret-file`<br/>toml: `client_secret_file` | string | the file with OAuth Client Secret | |
| flag: `--client-secret`<br/>toml: `client_secret` | string | the OAuth Client Secret | |
| flag: `--code-challenge-method`<br/>toml: `code_challenge_method` | string | use PKCE code challenges with the specified method. Either 'plain' or 'S256' (recommended) | |
| 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 |
| 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 |
| flag: `--insecure-oidc-skip-nonce`<br/>toml: `insecure_oidc_skip_nonce` | bool | skip verifying the OIDC ID Token's nonce claim | true |
| 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 | |
| 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 | |
| flag: `--login-url`<br/>toml: `login_url` | string | Authentication endpoint | |
| flag: `--auth-request-response-mode`<br/>toml: `auth-request-response-mode` | string | Response mode to ask for during authentication request | |
| flag: `--oidc-audience-claim`<br/>toml: `oidc_audience_claims` | string | which OIDC claim contains the audience | `"aud"` |
| flag: `--oidc-email-claim`<br/>toml: `oidc_email_claim` | string | which OIDC claim contains the user's email | `"email"` |
| flag: `--oidc-extra-audience`<br/>toml: `oidc_extra_audiences` | string \| list | additional audiences which are allowed to pass verification | `"[]"` |
| flag: `--oidc-groups-claim`<br/>toml: `oidc_groups_claim` | string | which OIDC claim contains the user groups | `"groups"` |
| flag: `--oidc-issuer-url`<br/>toml: `oidc_issuer_url` | string | the OpenID Connect issuer URL, e.g. `"https://accounts.google.com"` | |
| 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 | |
| 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 |
| flag: `--profile-url`<br/>toml: `profile_url` | string | Profile access endpoint | |
| 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 | `""` |
| 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. |
| 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) |
| flag: `--provider`<br/>toml: `provider` | string | OAuth provider | google |
| flag: `--pubjwk-url`<br/>toml: `pubjwk_url` | string | JWK pubkey access endpoint: required by login.gov | |
| flag: `--redeem-url`<br/>toml: `redeem_url` | string | Token redemption endpoint | |
| 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. | |
| 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 |
| 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 |
| 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 |
| flag: `--validate-url`<br/>toml: `validate_url` | string | Access token validation endpoint | |
### Cookie Options
| Flag / Config Field | Type | Description | Default |
| --------------------------------------------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
| flag: `--cookie-csrf-expire`<br/>toml: `cookie_csrf_expire` | duration | expire timeframe for CSRF cookie | 15m |
| 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 |
| 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" |
| 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). | |
| 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 |
| flag: `--cookie-httponly`<br/>toml: `cookie_httponly` | bool | set HttpOnly cookie flag | true |
| 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"` |
| flag: `--cookie-path`<br/>toml: `cookie_path` | string | an optional cookie path to force cookies to (e.g. `/poc/`) | `"/"` |
| flag: `--cookie-refresh`<br/>toml: `cookie_refresh` | duration | refresh the cookie after this duration; `0` to disable; not supported by all providers&nbsp;[^1] | |
| flag: `--cookie-samesite`<br/>toml: `cookie_samesite` | string | set SameSite cookie attribute (`"lax"`, `"strict"`, `"none"`, or `""`). | `""` |
| flag: `--cookie-secret`<br/>toml: `cookie_secret` | string | the seed string for secure cookies (optionally base64 encoded) | |
| flag: `--cookie-secret-file`<br/>toml: `cookie_secret_file` | string | For defining a separate cookie secret file to read the encryption key from | |
| flag: `--cookie-secure`<br/>toml: `cookie_secure` | bool | set [secure (HTTPS only) cookie flag](https://owasp.org/www-community/controls/SecureFlag) | true |
[^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)
### Header Options
| Flag / Config Field | Type | Description | Default |
| ------------------------------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| flag: `--basic-auth-password`<br/>toml: `basic_auth_password` | string | the password to set when passing the HTTP Basic Auth header | |
| 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 |
| flag: `--set-authorization-header`<br/>toml: `set_authorization_header` | bool | set Authorization Bearer response header (useful in Nginx auth_request mode) | false |
| flag: `--set-basic-auth`<br/>toml: `set_basic_auth` | bool | set HTTP Basic Auth information in response (useful in Nginx auth_request mode) | false |
| 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 |
| 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 |
| flag: `--pass-authorization-header`<br/>toml: `pass_authorization_header` | bool | pass OIDC IDToken to upstream via Authorization Bearer header | false |
| 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 |
| 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 |
| 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 |
### Logging Options
| Flag / Config Field | Type | Description | Default |
| --------------------------------------------------------------------- | ------ | ---------------------------------------------------------------------------- | --------------------------------------------------- |
| flag: `--auth-logging-format`<br/>toml: `auth_logging_format` | string | Template for authentication log lines | see [Logging Configuration](#logging-configuration) |
| flag: `--auth-logging`<br/>toml: `auth_logging` | bool | Log authentication attempts | true |
| flag: `--errors-to-info-log`<br/>toml: `errors_to_info_log` | bool | redirects error-level logging to default log channel instead of stderr | false |
| 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) |
| flag: `--logging-compress`<br/>toml: `logging_compress` | bool | Should rotated log files be compressed using gzip | false |
| flag: `--logging-filename`<br/>toml: `logging_filename` | string | File to log requests to, empty for `stdout` | `""` (stdout) |
| 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) |
| flag: `--logging-max-age`<br/>toml: `logging_max_age` | int | Maximum number of days to retain old log files | 7 |
| flag: `--logging-max-backups`<br/>toml: `logging_max_backups` | int | Maximum number of old log files to retain; 0 to disable | 0 |
| flag: `--logging-max-size`<br/>toml: `logging_max_size` | int | Maximum size in megabytes of the log file before rotation | 100 |
| flag: `--request-id-header`<br/>toml: `request_id_header` | string | Request header to use as the request ID in logging | X-Request-Id |
| flag: `--request-logging-format`<br/>toml: `request_logging_format` | string | Template for request log lines | see [Logging Configuration](#logging-configuration) |
| flag: `--request-logging`<br/>toml: `request_logging` | bool | Log requests | true |
| flag: `--silence-ping-logging`<br/>toml: `silence_ping_logging` | bool | disable logging of requests to ping & ready endpoints | false |
| flag: `--standard-logging-format`<br/>toml: `standard_logging_format` | string | Template for standard log lines | see [Logging Configuration](#logging-configuration) |
| flag: `--standard-logging`<br/>toml: `standard_logging` | bool | Log standard runtime information | true |
### Page Template Options
| Flag / Config Field | Type | Description | Default |
| ----------------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------- | ------- |
| flag: `--banner`<br/>toml: `banner` | string | custom (html) banner string. Use `"-"` to disable default banner. | |
| 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. |
| flag: `--custom-templates-dir`<br/>toml: `custom_templates_dir` | string | path to custom html templates | |
| flag: `--display-htpasswd-form`<br/>toml: `display_htpasswd_form` | bool | display username / password login form if an htpasswd file is provided | true |
| flag: `--footer`<br/>toml: `footer` | string | custom (html) footer string. Use `"-"` to disable default footer. (Can be used to obfuscate the version) | |
| 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 |
### Probe Options
| Flag / Config Field | Type | Description | Default |
| ------------------------------------------------------- | ------ | ---------------------------------------------------------- | ----------------------------- |
| flag: `--ping-path`<br/>toml: `ping_path` | string | the ping endpoint that can be used for basic health checks | `"/ping"` |
| 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) |
| flag: `--ready-path`<br/>toml: `ready_path` | string | the ready endpoint that can be used for deep health checks | `"/ready"` |
| flag: `--gcp-healthchecks`<br/>toml: `gcp_healthchecks` | bool | Enable GCP/GKE healthcheck endpoints (deprecated) | false |
### Proxy Options
| Flag / Config Field | Type | Description | Default |
| ----------------------------------------------------------------------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| 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` |
| 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 | |
| flag: `--authenticated-emails-file`<br/>toml: `authenticated_emails_file` | string | authenticate against emails via file (one per line) | |
| 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 |
| 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 | |
| flag: `--encode-state`<br/>toml: `encode_state` | bool | encode the state parameter as UrlEncodedBase64 | false |
| 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`) | |
| flag: `--force-https`<br/>toml: `force_https` | bool | enforce https redirect | `false` |
| flag: `--force-json-errors`<br/>toml: `force_json_errors` | bool | force JSON errors instead of HTTP error pages or redirects | `false` |
| flag: `--htpasswd-file`<br/>toml: `htpasswd_file` | string | additionally authenticate against a htpasswd file. Entries must be created with `htpasswd -B` for bcrypt encryption | |
| flag: `--htpasswd-user-group`<br/>toml: `htpasswd_user_groups` | string \| list | the groups to be set on sessions for htpasswd users | |
| 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"` |
| 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 |
| flag: `--redirect-url`<br/>toml: `redirect_url` | string | the OAuth Redirect URL, e.g. `"https://internalapp.yourcompany.com/oauth2/callback"` | |
| flag: `--relative-redirect-url`<br/>toml: `relative_redirect_url` | bool | allow relative OAuth Redirect URL.` | false |
| 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 |
| flag: `--signature-key`<br/>toml: `signature_key` | string | GAP-Signature request signature key (algorithm:secretkey) | |
| flag: `--skip-auth-preflight`<br/>toml: `skip_auth_preflight` | bool | will skip authentication for OPTIONS requests | false |
| 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) | |
| 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 | |
| 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 |
| flag: `--skip-provider-button`<br/>toml: `skip_provider_button` | bool | will skip sign-in-page to directly reach the next step: oauth/start | false |
| flag: `--ssl-insecure-skip-verify`<br/>toml: `ssl_insecure_skip_verify` | bool | skip validation of certificates presented when using HTTPS providers | false |
| 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. | |
| 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] | |
[^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:*`.
### Server Options
| Flag / Config Field | Type | Description | Default |
| ------------------------------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| 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"` |
| 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"` |
| flag: `--metrics-address`<br/>toml: `metrics_address` | string | the address prometheus metrics will be scraped from | `""` |
| flag: `--metrics-secure-address`<br/>toml: `metrics_secure_address` | string | the address prometheus metrics will be scraped from if using HTTPS | `""` |
| flag: `--metrics-tls-cert-file`<br/>toml: `metrics_tls_cert_file` | string | path to certificate file for secure metrics server | `""` |
| flag: `--metrics-tls-key-file`<br/>toml: `metrics_tls_key_file` | string | path to private key file for secure metrics server | `""` |
| flag: `--tls-cert-file`<br/>toml: `tls_cert_file` | string | path to certificate file | |
| flag: `--tls-key-file`<br/>toml: `tls_key_file` | string | path to private key file | |
| 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). | |
| flag: `--tls-min-version`<br/>toml: `tls_min_version` | string | minimum TLS version that is acceptable, either `"TLS1.2"` or `"TLS1.3"` | `"TLS1.2"` |
### Session Options
| Flag / Config Field | Type | Description | Default |
| ----------------------------------------------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| 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 |
| flag: `--session-store-type`<br/>toml: `session_store_type` | string | [Session data storage backend](sessions.md); redis or cookie | cookie |
| 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` | |
| flag: `--redis-connection-url`<br/>toml: `redis_connection_url` | string | URL of redis server for redis session storage (e.g. `redis://HOST[:PORT]`) | |
| flag: `--redis-insecure-skip-tls-verify`<br/>toml: `redis_insecure_skip_tls_verify` | bool | skip TLS verification when connecting to Redis | false |
| flag: `--redis-password`<br/>toml: `redis_password` | string | Redis password. Applicable for all Redis configurations. Will override any password set in `--redis-connection-url` | |
| 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` | |
| flag: `--redis-sentinel-master-name`<br/>toml: `redis_sentinel_master_name` | string | Redis sentinel master name. Used in conjunction with `--redis-use-sentinel` | |
| 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` | |
| 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 |
| 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 |
| 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 |
### Upstream Options
| Flag / Config Field | Type | Description | Default |
| ----------------------------------------------------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------- |
| flag: `--flush-interval`<br/>toml: `flush_interval` | duration | period between flushing response buffers when streaming responses | `"1s"` |
| flag: `--pass-host-header`<br/>toml: `pass_host_header` | bool | pass the request Host Header to upstream | true |
| flag: `--proxy-websockets`<br/>toml: `proxy_websockets` | bool | enables WebSocket proxying | true |
| flag: `--ssl-upstream-insecure-skip-verify`<br/>toml: `ssl_upstream_insecure_skip_verify` | bool | skip validation of certificates presented when using HTTPS upstreams | false |
| flag: `--disable-keep-alives`<br/>toml: `disable_keep_alives` | bool | disable HTTP keep-alive connections to the upstream server | false |
| flag: `--upstream-timeout`<br/>toml: `upstream_timeout` | duration | maximum amount of time the server will wait for a response from the upstream | 30s |
| 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 | |
## Upstreams Configuration
`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.
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.
* 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`.
* 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`.
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.
**Unix socket upstreams** are configured as `unix:///path/to/unix.sock`.
**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/`.
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.
## Environment variables
Every command line argument can be specified as an environment variable by
prefixing it with `OAUTH2_PROXY_`, capitalising it, and replacing hyphens (`-`)
with underscores (`_`). If the argument can be specified multiple times, the
environment variable should be plural (trailing `S`).
This is particularly useful for storing secrets outside a configuration file
or the command line.
For example, the `--cookie-secret` flag becomes `OAUTH2_PROXY_COOKIE_SECRET`.
If a flag has the type `string | list` like the `--email-domain` flag it is
available as an environment variable in plural form e.g. `OAUTH2_PROXY_EMAIL_DOMAINS`
Values for type `string | list` usually have a plural environment variable name
and need to be seperated by `,` e.g.
`OAUTH2_PROXY_SKIP_AUTH_ROUTES="GET=^/api/status,POST=^/api/saved_objects/_import"`
Please check the type for each [config option](#config-options) first.
## Logging Configuration
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.
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`).
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`.
Each type of logging has its own configurable format and variables. By default, these formats are similar to the Apache Combined Log.
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.
## Auth Log Format
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:
```
<REMOTE_ADDRESS> - <REQUEST ID> - <user@domain.com> [2015/03/19 17:20:19] [<STATUS>] <MESSAGE>
```
The status block will contain one of the below strings:
- `AuthSuccess` If a user has authenticated successfully by any method
- `AuthFailure` If the user failed to authenticate explicitly
- `AuthError` If there was an unexpected error during authentication
If you require a different format than that, you can configure it with the `--auth-logging-format` flag.
The default format is configured as follows:
```
{{.Client}} - {{.RequestID}} - {{.Username}} [{{.Timestamp}}] [{{.Status}}] {{.Message}}
```
Available variables for auth logging:
| Variable | Example | Description |
| ------------- | ------------------------------------ | -------------------------------------------------------------------------------------------------------- |
| 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. |
| Host | domain.com | The value of the Host header. |
| Message | Authenticated via OAuth2 | The details of the auth attempt. |
| Protocol | HTTP/1.0 | The request protocol. |
| RequestID | 00010203-0405-4607-8809-0a0b0c0d0e0f | The request ID pulled from the `--request-id-header`. Random UUID if empty |
| RequestMethod | GET | The request method. |
| Timestamp | 2015/03/19 17:20:19 | The date and time of the logging event. |
| UserAgent | - | The full user agent as reported by the requesting client. |
| Username | username@email.com | The email or username of the auth request. |
| Status | AuthSuccess | The status of the auth request. See above for details. |
## Request Log Format
HTTP request logs will output by default in the below format:
```
<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>
```
If you require a different format than that, you can configure it with the `--request-logging-format` flag.
The default format is configured as follows:
```
{{.Client}} - {{.RequestID}} - {{.Username}} [{{.Timestamp}}] {{.Host}} {{.RequestMethod}} {{.Upstream}} {{.RequestURI}} {{.Protocol}} {{.UserAgent}} {{.StatusCode}} {{.ResponseSize}} {{.RequestDuration}}
```
Available variables for request logging:
| Variable | Example | Description |
| --------------- | ------------------------------------ | -------------------------------------------------------------------------------------------------------- |
| 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. |
| Host | domain.com | The value of the Host header. |
| Protocol | HTTP/1.0 | The request protocol. |
| RequestDuration | 0.001 | The time in seconds that a request took to process. |
| RequestID | 00010203-0405-4607-8809-0a0b0c0d0e0f | The request ID pulled from the `--request-id-header`. Random UUID if empty |
| RequestMethod | GET | The request method. |
| RequestURI | "/oauth2/auth" | The URI path of the request. |
| ResponseSize | 12 | The size in bytes of the response. |
| StatusCode | 200 | The HTTP status code of the response. |
| Timestamp | 2015/03/19 17:20:19 | The date and time of the logging event. |
| Upstream | - | The upstream data of the HTTP request. |
| UserAgent | - | The full user agent as reported by the requesting client. |
| Username | username@email.com | The email or username of the auth request. |
## Standard Log Format
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:
```
[2015/03/19 17:20:19] [main.go:40] <MESSAGE>
```
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:
```
[{{.Timestamp}}] [{{.File}}] {{.Message}}
```
Available variables for standard logging:
| Variable | Example | Description |
| --------- | --------------------------------- | -------------------------------------------------- |
| Timestamp | 2015/03/19 17:20:19 | The date and time of the logging event. |
| File | main.go:40 | The file and line number of the logging statement. |
| Message | HTTP: listening on 127.0.0.1:4180 | The details of the log statement. |

View File

@ -0,0 +1,19 @@
---
id: adfs
title: ADFS
---
1. Open the ADFS administration console on your Windows Server and add a new Application Group
2. Provide a name for the integration, select Server Application from the Standalone applications section and click Next
3. Follow the wizard to get the client-id, client-secret and configure the application credentials
4. Configure the proxy with
```
--provider=adfs
--client-id=<application ID from step 3>
--client-secret=<value from step 3>
```
Note: When using the ADFS Auth provider with nginx and the cookie session store you may find the cookie is too large and
doesn't get passed through correctly. Increasing the proxy_buffer_size in nginx or implementing the
[redis session storage](../sessions.md#redis-storage) should resolve this.

View File

@ -0,0 +1,25 @@
---
id: bitbucket
title: BitBucket
---
1. [Add a new OAuth consumer](https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html)
* In "Callback URL" use `https://<oauth2-proxy>/oauth2/callback`, substituting `<oauth2-proxy>` with the actual
hostname that oauth2-proxy is running on.
* In Permissions section select:
* Account -> Email
* Team membership -> Read
* Repositories -> Read
2. Note the Client ID and Client Secret.
To use the provider, pass the following options:
```
--provider=bitbucket
--client-id=<Client ID>
--client-secret=<Client Secret>
```
The default configuration allows everyone with Bitbucket account to authenticate. To restrict the access to the team
members use additional configuration option: `--bitbucket-team=<Team name>`. To restrict the access to only these users
who have access to one selected repository use `--bitbucket-repository=<Repository name>`.

View File

@ -0,0 +1,37 @@
---
id: cidaas
title: Cidaas
---
[Cidaas](https://www.cidaas.com/) is an Identity as a Service (IDaaS) solution that provides authentication and authorization services.
It supports various protocols including OpenID Connect, OAuth 2.0, and SAML.
However, Cidaas provides groups and their roles as hierarchical claims, which are not supported by oauth2-proxy yet.
The Cidaas provider transforms the hierarchical claims into a flat list of groups, which can be used by oauth2-proxy.
Example of groups and roles in Cidaas:
```json
{
"groups": [
{
"groupId": "group1",
"roles": ["role1", "role2"]
},
{
"groupId": "group2",
"roles": ["role3"]
}
]
}
```
This will be transformed into a flat list of groups:
```json
{
"groups": ["group1:role1", "group2:role2", "group2:role3"]
}
```
Apart from that the Cidaas provider inherits all the features of the [OpenID Connect provider](openid_connect.md).

View File

@ -0,0 +1,21 @@
---
id: digitalocean
title: DigitalOcean
---
1. [Create a new OAuth application](https://cloud.digitalocean.com/account/api/applications)
* You can fill in the name, homepage, and description however you wish.
* In the "Application callback URL" field, enter: `https://oauth-proxy/oauth2/callback`, substituting `oauth2-proxy`
with the actual hostname that oauth2-proxy is running on. The URL must match oauth2-proxy's configured redirect URL.
2. Note the Client ID and Client Secret.
To use the provider, pass the following options:
```
--provider=digitalocean
--client-id=<Client ID>
--client-secret=<Client Secret>
```
Alternatively, set the equivalent options in the config file. The redirect URL defaults to
`https://<requested host header>/oauth2/callback`. If you need to change it, you can use the `--redirect-url` command-line option.

View File

@ -0,0 +1,7 @@
---
id: facebook
title: Facebook
---
1. Create a new FB App from https://developers.facebook.com/
2. Under FB Login, set your Valid OAuth redirect URIs to `https://internal.yourcompany.com/oauth2/callback`

View File

@ -0,0 +1,24 @@
---
id: gitea
title: Gitea / Forgejo
---
:::note
This is not actually a fully serparate provider. For more details and options please refer to the [GitHub Provider Options](github.md)
:::
1. Create a new application: `https://< your gitea host >/user/settings/applications`
2. Under `Redirect URI` enter the correct URL i.e. `https://<proxied host>/oauth2/callback`
3. Note the Client ID and Client Secret.
4. Pass the following options to the proxy:
```
--provider="github"
--redirect-url="https://<proxied host>/oauth2/callback"
--provider-display-name="Gitea"
--client-id="< client_id as generated by Gitea >"
--client-secret="< client_secret as generated by Gitea >"
--login-url="https://< your gitea host >/login/oauth/authorize"
--redeem-url="https://< your gitea host >/login/oauth/access_token"
--validate-url="https://< your gitea host >/api/v1/user/emails"
```

View File

@ -0,0 +1,81 @@
---
id: github
title: GitHub
---
## Config Options
| Flag | Toml Field | Type | Description | Default |
| ---------------- | -------------- | -------------- | ------------------------------------------------------------------------------------------------------------- | ------- |
| `--github-org` | `github_org` | string | restrict logins to members of this organisation | |
| `--github-team` | `github_team` | string | restrict logins to members of any of these teams (slug) or (org:team), comma separated | |
| `--github-repo` | `github_repo` | string | restrict logins to collaborators of this repository formatted as `orgname/repo` | |
| `--github-token` | `github_token` | string | the token to use when verifying repository collaborators (must have push access to the repository) | |
| `--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 | |
## Usage
1. Create a new project: https://github.com/settings/developers
2. Under `Authorization callback URL` enter the correct url ie `https://internal.yourcompany.com/oauth2/callback`
The GitHub auth provider supports two additional ways to restrict authentication to either organization and optional
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`
NOTE: When `--github-user` is set, the specified users are allowed to log in even if they do not belong to the specified
org and team or collaborators.
To restrict access to your organization:
```shell
# restrict logins to members of this organisation
--github-org="your-org"
```
To restrict access to specific teams within an organization:
```shell
--github-org="your-org"
# restrict logins to members of any of these teams (slug), comma separated
--github-team="team1,team2,team3"
```
To restrict to teams within different organizations, keep the organization flag empty and use `--github-team` like so:
```shell
# keep empty
--github-org=""
# restrict logins to members to any of the following teams (format <org>:<slug>, like octo:team1), comma separated
--github-team="org1:team1,org2:team1,org3:team42,octo:cat"
```
If you would rather restrict access to collaborators of a repository, those users must either have push access to a
public repository or any access to a private repository:
```shell
# restrict logins to collaborators of this repository formatted as orgname/repo
--github-repo=""
```
If you'd like to allow access to users with **read only** access to a **public** repository you will need to provide a
[token](https://github.com/settings/tokens) for a user that has write access to the repository. The token must be
created with at least the `public_repo` scope:
```shell
# the token to use when verifying repository collaborators
--github-token=""
```
To allow a user to log in with their username even if they do not belong to the specified org and team or collaborators:
```shell
# allow logins by username, comma separated
--github-user=""
```
If you are using GitHub enterprise, make sure you set the following to the appropriate url:
```shell
--login-url="http(s)://<enterprise github host>/login/oauth/authorize"
--redeem-url="http(s)://<enterprise github host>/login/oauth/access_token"
--validate-url="http(s)://<enterprise github host>/api/v3"
```

View File

@ -0,0 +1,49 @@
---
id: gitlab
title: GitLab
---
## Config Options
| Flag | Toml Field | Type | Description | Default |
| ------------------- | ----------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `--gitlab-group` | `gitlab_groups` | string \| list | restrict logins to members of any of these groups (slug), separated by a comma | |
| `--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 | |
## Usage
This auth provider has been tested against Gitlab version 12.X. Due to Gitlab API changes, it may not work for version
prior to 12.X (see [994](https://github.com/oauth2-proxy/oauth2-proxy/issues/994)).
Whether you are using GitLab.com or self-hosting GitLab, follow
[these steps to add an application](https://docs.gitlab.com/integration/oauth_provider/). Make sure to enable at
least the `openid`, `profile` and `email` scopes, and set the redirect url to your application url e.g.
https://myapp.com/oauth2/callback.
If you need projects filtering, add the extra `read_api` scope to your application.
The following config should be set to ensure that the oauth will work properly. To get a cookie secret follow
[these steps](../overview.md#generating-a-cookie-secret)
```
--provider="gitlab"
--redirect-url="https://myapp.com/oauth2/callback" // Should be the same as the redirect url for the application in gitlab
--client-id=GITLAB_CLIENT_ID
--client-secret=GITLAB_CLIENT_SECRET
--cookie-secret=COOKIE_SECRET
```
Restricting by group membership is possible with the following option:
```shell
--gitlab-group="mygroup,myothergroup" # restrict logins to members of any of these groups (slug), separated by a comma
```
If you are using self-hosted GitLab, make sure you set the following to the appropriate URL:
```shell
--oidc-issuer-url="<your gitlab url>"
```
If your self-hosted GitLab is on a subdirectory (e.g. domain.tld/gitlab), as opposed to its own subdomain
(e.g. gitlab.domain.tld), you may need to add a redirect from domain.tld/oauth pointing at e.g. domain.tld/gitlab/oauth.

View File

@ -0,0 +1,75 @@
---
id: google
title: Google (default)
---
## Config Options
| Flag | Toml Field | Type | Description | Default |
| ---------------------------------------------- | -------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------ | -------------------------------------------------- |
| `--google-admin-email` | `google_admin_email` | string | the google admin to impersonate for api calls | |
| `--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. | |
| `--google-service-account-json` | `google_service_account_json` | string | the path to the service account json credentials | |
| `--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) | |
| `--google-target-principal` | `google_target_principal` | bool | the target principal to impersonate when using ADC | defaults to the service account configured for ADC |
## Usage
For Google, the registration steps are:
1. Create a new project: https://console.developers.google.com/project
2. Choose the new project from the top right project dropdown (only if another project is selected)
3. In the project Dashboard center pane, choose **"APIs & Services"**
4. In the left Nav pane, choose **"Credentials"**
5. In the center pane, choose **"OAuth consent screen"** tab. Fill in **"Product name shown to users"** and hit save.
6. In the center pane, choose **"Credentials"** tab.
- Open the **"New credentials"** drop down
- Choose **"OAuth client ID"**
- Choose **"Web application"**
- Application name is freeform, choose something appropriate
- Authorized JavaScript origins is your domain ex: `https://internal.yourcompany.com`
- Authorized redirect URIs is the location of oauth2/callback ex: `https://internal.yourcompany.com/oauth2/callback`
- Choose **"Create"**
7. Take note of the **Client ID** and **Client Secret**
It's recommended to refresh sessions on a short interval (1h) with `cookie-refresh` setting which validates that the
account is still authorized.
#### Restrict auth to specific Google groups on your domain. (optional)
1. Create a [service account](https://developers.google.com/identity/protocols/oauth2/service-account) and configure it
to use [Application Default Credentials / Workload Identity / Workload Identity Federation (recommended)](#using-application-default-credentials-adc--workload-identity--workload-identity-federation-recommended) or,
alternatively download the JSON.
2. Make note of the Client ID for a future step.
3. Under "APIs & Auth", choose APIs.
4. Click on Admin SDK and then Enable API.
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)
and give the client id from step 2 the following oauth scopes:
```
https://www.googleapis.com/auth/admin.directory.group.member.readonly
```
6. Follow the steps on https://support.google.com/a/answer/60757 to enable Admin API access.
7. Create or choose an existing administrative email address on the Gmail domain to assign to the `google-admin-email`
flag. This email will be impersonated by this client to make calls to the Admin SDK. See the note on the link from
step 5 for the reason why.
8. Create or choose an existing email group and set that email to the `google-group` flag. You can pass multiple instances
of this flag with different groups and the user will be checked against all the provided groups.
(Only if using a JSON file (see step 1))
9. Lock down the permissions on the json file downloaded from step 1 so only oauth2-proxy is able to read the file and
set the path to the file in the `google-service-account-json` flag.
10. Restart oauth2-proxy.
Note: The user is checked against the group members list on initial authentication and every time the token is
refreshed ( about once an hour ).
##### Using Application Default Credentials (ADC) / Workload Identity / Workload Identity Federation (recommended)
oauth2-proxy can make use of [Application Default Credentials](https://cloud.google.com/docs/authentication/application-default-credentials).
When deployed within GCP, this means that it can automatically use the service account attached to the resource. When deployed to GKE, ADC
can be leveraged through a feature called Workload Identity. Follow Google's [guide](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity)
to set up Workload Identity.
When deployed outside of GCP, [Workload Identity Federation](https://cloud.google.com/docs/authentication/provide-credentials-adc#wlif) might be an option.

View File

@ -0,0 +1,45 @@
---
id: index
title: OAuth Provider Configuration
---
You will need to register an OAuth application with a Provider (Google, GitHub or another provider), and configure it
with Redirect URI(s) for the domain you intend to run `oauth2-proxy` on.
Valid providers are :
- [ADFS](adfs.md)
- [Bitbucket](bitbucket.md)
- [Cidaas](cidaas.md)
- [DigitalOcean](digitalocean.md)
- [Facebook](facebook.md)
- [Gitea](gitea.md)
- [GitHub](github.md)
- [GitLab](gitlab.md)
- [Google](google.md) _default_
- [Keycloak](keycloak.md) (Deprecated)
- [Keycloak OIDC](keycloak_oidc.md)
- [LinkedIn](linkedin.md)
- [login.gov](login_gov.md)
- [Microsoft Azure](ms_azure_ad.md) (Deprecated)
- [Microsoft Entra ID](ms_entra_id.md)
- [Nextcloud](nextcloud.md)
- [OpenID Connect](openid_connect.md)
- [SourceHut](sourcehut.md)
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).
Please note that not all providers support all claims. The `preferred_username` claim is currently only supported by the
OpenID Connect provider.
## Email Authentication
To authorize a specific email-domain use `--email-domain=yourcompany.com`. To authorize individual email addresses use
`--authenticated-emails-file=/path/to/file` with one email per line. To authorize all email addresses use `--email-domain=*`.
## Adding a new Provider
Follow the examples in the [`providers` package](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/providers/) to define a new
`Provider` instance. Add a new `case` to
[`providers.New()`](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/providers/providers.go) to allow `oauth2-proxy` to use the
new `Provider`.

View File

@ -0,0 +1,36 @@
---
id: keycloak
title: Keycloak (Deprecated)
---
:::note
This is the legacy and deprecated provider for Keycloak, use [Keycloak OIDC Auth Provider](keycloak_oidc.md) if possible.
:::
1. Create new client in your Keycloak realm with **Access Type** 'confidential' and **Valid Redirect URIs** 'https://internal.yourcompany.com/oauth2/callback'
2. Take note of the Secret in the credential tab of the client
3. Create a mapper with **Mapper Type** 'Group Membership' and **Token Claim Name** 'groups'.
Make sure you set the following to the appropriate url:
```
--provider=keycloak
--client-id=<client you have created>
--client-secret=<your client's secret>
--login-url="http(s)://<keycloak host>/auth/realms/<your realm>/protocol/openid-connect/auth"
--redeem-url="http(s)://<keycloak host>/auth/realms/<your realm>/protocol/openid-connect/token"
--profile-url="http(s)://<keycloak host>/auth/realms/<your realm>/protocol/openid-connect/userinfo"
--validate-url="http(s)://<keycloak host>/auth/realms/<your realm>/protocol/openid-connect/userinfo"
--keycloak-group=<first_allowed_user_group>
--keycloak-group=<second_allowed_user_group>
```
For group based authorization, the optional `--keycloak-group` (legacy) or `--allowed-group` (global standard)
flags can be used to specify which groups to limit access to.
If these are unset but a `groups` mapper is set up above in step (3), the provider will still
populate the `X-Forwarded-Groups` header to your upstream server with the `groups` data in the
Keycloak userinfo endpoint response.
The group management in keycloak is using a tree. If you create a group named admin in keycloak
you should define the 'keycloak-group' value to /admin.

View File

@ -0,0 +1,151 @@
---
id: keycloak_oidc
title: Keycloak OIDC
---
## Config Options
| Flag | Toml Field | Type | Description | Default |
| ---------------- | --------------- | -------------- | ------------------------------------------------------------------------------------------------------------------ | ------- |
| `--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. | |
## Usage
```
--provider=keycloak-oidc
--client-id=<your client's id>
--client-secret=<your client's secret>
--redirect-url=https://internal.yourcompany.com/oauth2/callback
--oidc-issuer-url=https://<keycloak host>/realms/<your realm> // For Keycloak versions <17: --oidc-issuer-url=https://<keycloak host>/auth/realms/<your realm>
--email-domain=<yourcompany.com> // Validate email domain for users, see option documentation
--allowed-role=<realm role name> // Optional, required realm role
--allowed-role=<client id>:<client role name> // Optional, required client role
--allowed-group=</group name> // Optional, requires group client scope
--code-challenge-method=S256 // PKCE
```
:::note
Keycloak has updated its admin console and as of version 19.0.0, the new admin console is enabled by default. The
legacy admin console has been announced for removal with the release of version 21.0.0.
:::
**Keycloak legacy admin console**
1. Create new client in your Keycloak realm with **Access Type** 'confidential', **Client protocol** 'openid-connect'
and **Valid Redirect URIs** 'https://internal.yourcompany.com/oauth2/callback'
2. Take note of the Secret in the credential tab of the client
3. Create a mapper with **Mapper Type** 'Group Membership' and **Token Claim Name** 'groups'.
4. Create a mapper with **Mapper Type** 'Audience' and **Included Client Audience** and **Included Custom Audience** set
to your client name.
**Keycloak new admin console (default as of v19.0.0)**
The following example shows how to create a simple OIDC client using the new Keycloak admin2 console. However, for best
practices, it is recommended to consult the Keycloak documentation.
The OIDC client must be configured with an _audience mapper_ to include the client's name in the `aud` claim of the JWT token.
The `aud` claim specifies the intended recipient of the token, and OAuth2 Proxy expects a match against the values of
either `--client-id` or `--oidc-extra-audience`.
_In Keycloak, claims are added to JWT tokens through the use of mappers at either the realm level using "client scopes" or
through "dedicated" client mappers._
**Creating the client**
1. Create a new OIDC client in your Keycloak realm by navigating to:
**Clients** -> **Create client**
* **Client Type** 'OpenID Connect'
* **Client ID** `<your client's id>`, please complete the remaining fields as appropriate and click **Next**.
* **Client authentication** 'On'
* **Authentication flow**
* **Standard flow** 'selected'
* **Direct access grants** 'deselect'
* _Save the configuration._
* **Settings / Access settings**:
* **Valid redirect URIs** `https://internal.yourcompany.com/oauth2/callback`
* _Save the configuration._
* Under the **Credentials** tab you will now be able to locate `<your client's secret>`.
2. Configure a dedicated *audience mapper* for your client by navigating to **Clients** -> **\<your client's id\>** -> **Client scopes**.
* Access the dedicated mappers pane by clicking **\<your client's id\>-dedicated**, located under *Assigned client scope*.
_(It should have a description of "Dedicated scope and mappers for this client")_
* Click **Configure a new mapper** and select **Audience**
* **Name** 'aud-mapper-\<your client's id\>'
* **Included Client Audience** select `<your client's id>` from the dropdown.
* _OAuth2 proxy can be set up to pass both the access and ID JWT tokens to your upstream services.
If you require additional audience entries, you can use the **Included Custom Audience** field in addition
to the "Included Client Audience" dropdown. Note that the "aud" claim of a JWT token should be limited and
only specify its intended recipients._
* **Add to ID token** 'On'
* **Add to access token** 'On' - [#1916](https://github.com/oauth2-proxy/oauth2-proxy/pull/1916)
* _Save the configuration._
* Any subsequent dedicated client mappers can be defined by clicking **Dedicated scopes** -> **Add mapper** ->
**By configuration** -> *Select mapper*
You should now be able to create a test user in Keycloak and get access to the OAuth2 Proxy instance, make sure to set
an email address matching `<yourcompany.com>` and select _Email verified_.
**Authorization**
_OAuth2 Proxy will perform authorization by requiring a valid user, this authorization can be extended to take into
account a user's membership in Keycloak `groups`, `realm roles`, and `client roles` using the keycloak-oidc provider options
`--allowed-role` or `--allowed-group`_
**Roles**
_A standard Keycloak installation comes with the required mappers for **realm roles** and **client roles** through the
pre-defined client scope "roles". This ensures that any roles assigned to a user are included in the `JWT` tokens when
using an OIDC client that has the "Full scope allowed" feature activated, the feature is enabled by default._
_Creating a realm role_
* Navigate to **Realm roles** -> **Create role**
* **Role name**, *`<realm role name>`* -> **save**
_Creating a client role_
* Navigate to **Clients** -> `<your client's id>` -> **Roles** -> **Create role**
* **Role name**, *`<client role name>`* -> **save**
_Assign a role to a user_
**Users** -> _Username_ -> **Role mapping** -> **Assign role** -> _filter by roles or clients and select_ -> **Assign**.
Keycloak "realm roles" can be authorized using the `--allowed-role=<realm role name>` option, while "client roles" can be
evaluated using `--allowed-role=<your client's id>:<client role name>`.
You may limit the _realm roles_ included in the JWT tokens for any given client by navigating to:
**Clients** -> `<your client's id>` -> **Client scopes** -> _\<your client's id\>-dedicated_ -> **Scope**
Disabling **Full scope allowed** activates the **Assign role** option, allowing you to select which roles, if assigned
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
want to reduce the size and impact of the JWT token.
**Groups**
You may also do authorization on group memberships by using the OAuth2 Proxy option `--allowed-group`.
We will only do a brief description of creating the required _client scope_ **groups** and refer you to read the Keycloak
documentation.
To summarize, the steps required to authorize Keycloak group membership with OAuth2 Proxy are as follows:
* Create a new Client Scope with the name **groups** in Keycloak.
* Include a mapper of type **Group Membership**.
* Set the "Token Claim Name" to **groups** or customize by matching it to the `--oidc-groups-claim` option of OAuth2 Proxy.
* If the "Full group path" option is selected, you need to include a "/" separator in the group names defined in the
`--allowed-group` option of OAuth2 Proxy. Example: "/groupname" or "/groupname/child_group".
After creating the _Client Scope_ named _groups_ you will need to attach it to your client.
**Clients** -> `<your client's id>` -> **Client scopes** -> **Add client scope** -> Select **groups** and choose Optional
and you should now have a client that maps group memberships into the JWT tokens so that Oauth2 Proxy may evaluate them.
Create a group by navigating to **Groups** -> **Create group** and _add_ your test user as a member.
The OAuth2 Proxy option `--allowed-group=/groupname` will now allow you to filter on group membership
Keycloak also has the option of attaching roles to groups, please refer to the Keycloak documentation for more information.
**Tip**
To check if roles or groups are added to JWT tokens, you can preview a users token in the Keycloak console by following
these steps: **Clients** -> `<your client's id>` -> **Client scopes** -> **Evaluate**.
Select a _realm user_ and optional _scope parameters_ such as groups, and generate the JSON representation of an access
or id token to examine its contents.

View File

@ -0,0 +1,13 @@
---
id: linkedin
title: LinkedIn
---
For LinkedIn, the registration steps are:
1. Create a new project: https://www.linkedin.com/secure/developer
2. In the OAuth User Agreement section:
- In default scope, select r_basicprofile and r_emailaddress.
- In "OAuth 2.0 Redirect URLs", enter `https://internal.yourcompany.com/oauth2/callback`
3. Fill in the remaining required fields and Save.
4. Take note of the **Consumer Key / API Key** and **Consumer Secret / Secret Key**

View File

@ -0,0 +1,79 @@
---
id: login_gov
title: Login.gov
---
login.gov is an OIDC provider for the US Government.
If you are a US Government agency, you can contact the login.gov team through the contact information
that you can find on https://login.gov/developers/ and work with them to understand how to get login.gov
accounts for integration/test and production access.
A developer guide is available here: https://developers.login.gov/, though this proxy handles everything
but the data you need to create to register your application in the login.gov dashboard.
As a demo, we will assume that you are running your application that you want to secure locally on
http://localhost:3000/, that you will be starting your proxy up on http://localhost:4180/, and that
you have an agency integration account for testing.
First, register your application in the dashboard. The important bits are:
* Identity protocol: make this `Openid connect`
* Issuer: do what they say for OpenID Connect. We will refer to this string as `${LOGINGOV_ISSUER}`.
* Public key: This is a self-signed certificate in .pem format generated from a 2048-bit RSA private key.
A quick way to do this is
`openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 3650 -nodes -subj '/C=US/ST=Washington/L=DC/O=GSA/OU=18F/CN=localhost'`.
The contents of the `key.pem` shall be referred to as `${OAUTH2_PROXY_JWT_KEY}`.
* Return to App URL: Make this be `http://localhost:4180/`
* Redirect URIs: Make this be `http://localhost:4180/oauth2/callback`.
* Attribute Bundle: Make sure that email is selected.
Now start the proxy up with the following options:
```
./oauth2-proxy -provider login.gov \
-client-id=${LOGINGOV_ISSUER} \
-redirect-url=http://localhost:4180/oauth2/callback \
-oidc-issuer-url=https://idp.int.identitysandbox.gov/ \
-cookie-secure=false \
-email-domain=gsa.gov \
-upstream=http://localhost:3000/ \
-cookie-secret=somerandomstring12341234567890AB \
-cookie-domain=localhost \
-skip-provider-button=true \
-pubjwk-url=https://idp.int.identitysandbox.gov/api/openid_connect/certs \
-profile-url=https://idp.int.identitysandbox.gov/api/openid_connect/userinfo \
-jwt-key="${OAUTH2_PROXY_JWT_KEY}"
```
You can also set all these options with environment variables, for use in cloud/docker environments.
One tricky thing that you may encounter is that some cloud environments will pass in environment
variables in a docker env-file, which does not allow multiline variables like a PEM file.
If you encounter this, then you can create a `jwt_signing_key.pem` file in the top level
directory of the repo which contains the key in PEM format and then do your docker build.
The docker build process will copy that file into your image which you can then access by
setting the `OAUTH2_PROXY_JWT_KEY_FILE=/etc/ssl/private/jwt_signing_key.pem`
environment variable, or by setting `--jwt-key-file=/etc/ssl/private/jwt_signing_key.pem` on the commandline.
Once it is running, you should be able to go to `http://localhost:4180/` in your browser,
get authenticated by the login.gov integration server, and then get proxied on to your
application running on `http://localhost:3000/`. In a real deployment, you would secure
your application with a firewall or something so that it was only accessible from the
proxy, and you would use real hostnames everywhere.
#### Skip OIDC discovery
Some providers do not support OIDC discovery via their issuer URL, so oauth2-proxy cannot simply grab the authorization,
token and jwks URI endpoints from the provider's metadata.
In this case, you can set the `--skip-oidc-discovery` option, and supply those required endpoints manually:
```
-provider oidc
-client-id oauth2-proxy
-client-secret proxy
-redirect-url http://127.0.0.1:4180/oauth2/callback
-oidc-issuer-url http://127.0.0.1:5556
-skip-oidc-discovery
-login-url http://127.0.0.1:5556/authorize
-redeem-url http://127.0.0.1:5556/token
-oidc-jwks-url http://127.0.0.1:5556/keys
-cookie-secure=false
-email-domain example.com
```

View File

@ -0,0 +1,59 @@
---
id: azure
title: Azure (Deprecated)
---
:::note
This is the legacy and deprecated provider for Azure, use [Microsoft Entra ID](ms_entra_id.md) if possible.
:::
## Config Options
| Flag | Toml Field | Type | Description | Default |
| ---------------- | -------------- | ------ | ---------------------------------------------------------------- | ---------- |
| `--azure-tenant` | `azure_tenant` | string | go to a tenant-specific or common (tenant-independent) endpoint. | `"common"` |
| `--resource` | `resource` | string | The resource that is protected (Azure AD only) | |
## Usage
1. Add an application: go to [https://portal.azure.com](https://portal.azure.com), choose **Azure Active Directory**, select
**App registrations** and then click on **New registration**.
2. Pick a name, check the supported account type(single-tenant, multi-tenant, etc). In the **Redirect URI** section create a new
**Web** platform entry for each app that you want to protect by the oauth2 proxy(e.g.
https://internal.yourcompanycom/oauth2/callback). Click **Register**.
3. Next we need to add group read permissions for the app registration, on the **API Permissions** page of the app, click on
**Add a permission**, select **Microsoft Graph**, then select **Application permissions**, then click on **Group** and select
**Group.Read.All**. Hit **Add permissions** and then on **Grant admin consent** (you might need an admin to do this).
<br/>**IMPORTANT**: Even if this permission is listed with **"Admin consent required=No"** the consent might actually
be required, due to AAD policies you won't be able to see. If you get a **"Need admin approval"** during login,
most likely this is what you're missing!
4. Next, if you are planning to use v2.0 Azure Auth endpoint, go to the **Manifest** page and set `"accessTokenAcceptedVersion": 2`
in the App registration manifest file.
5. On the **Certificates & secrets** page of the app, add a new client secret and note down the value after hitting **Add**.
6. Configure the proxy with:
- for V1 Azure Auth endpoint (Azure Active Directory Endpoints - https://login.microsoftonline.com/common/oauth2/authorize)
```
--provider=azure
--client-id=<application ID from step 3>
--client-secret=<value from step 5>
--azure-tenant={tenant-id}
--oidc-issuer-url=https://sts.windows.net/{tenant-id}/
```
- for V2 Azure Auth endpoint (Microsoft Identity Platform Endpoints - https://login.microsoftonline.com/common/oauth2/v2.0/authorize)
```
--provider=azure
--client-id=<application ID from step 3>
--client-secret=<value from step 5>
--azure-tenant={tenant-id}
--oidc-issuer-url=https://login.microsoftonline.com/{tenant-id}/v2.0
```
***Notes***:
- When using v2.0 Azure Auth endpoint (`https://login.microsoftonline.com/{tenant-id}/v2.0`) as `--oidc_issuer_url`, in conjunction
with `--resource` flag, be sure to append `/.default` at the end of the resource name. See
https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-permissions-and-consent#the-default-scope for more details.
- When using the Azure Auth provider with nginx and the cookie session store you may find the cookie is too large and doesn't
get passed through correctly. Increasing the proxy_buffer_size in nginx or implementing the
[redis session storage](../sessions.md#redis-storage) should resolve this.

View File

@ -0,0 +1,197 @@
---
id: ms_entra_id
title: Microsoft Entra ID
---
Provider for Microsoft Entra ID. Fully compliant with OIDC, with support for group overage and multi-tenant apps.
## Config Options
The provider is OIDC-compliant, so all the OIDC parameters are honored. Additional provider-specific configuration parameters are:
| Flag | Toml Field | Type | Description | Default |
| --------------------------- | -------------------------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `--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). | |
| `--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 |
## Configure App registration
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.
<details>
<summary>See Azure Portal example</summary>
<div class="videoBlock">
<iframe src="https://www.youtube.com/embed/IUNfxhOzr4E"></iframe>
</div>
</details>
<details>
<summary>See Terraform example</summary>
```
resource "azuread_application" "auth" {
display_name = "oauth2-proxy"
sign_in_audience = "AzureADMyOrg" # Others are also supported
web {
redirect_uris = [
"https://podinfo.lakis.tech/oauth2/callback",
]
}
// We don't specify any required API permissions - we allow user consent only
}
resource "azuread_service_principal" "sp" {
client_id = azuread_application.auth.client_id
app_role_assignment_required = false
}
resource "azuread_service_principal_password" "pass" {
service_principal_id = azuread_service_principal.sp.id
}
```
</details>
### Configure groups
If you want to make use of groups, you can configure *groups claim* to be present in ID Tokens issued by the App registration.
<details>
<summary>See Azure Portal example</summary>
<div class="videoBlock">
<div class="videoBlock">
<iframe src="https://www.youtube.com/embed/QZmP5MKEJis"></iframe>
</div>
</div>
</details>
<details>
<summary>See Terraform example</summary>
```
resource "azuread_application" "auth" {
display_name = "oauth2-proxy"
sign_in_audience = "AzureADMyOrg"
group_membership_claims = [
"SecurityGroup"
]
web {
redirect_uris = [
"https://podinfo.lakis.tech/oauth2/callback",
]
}
}
resource "azuread_service_principal" "sp" {
client_id = azuread_application.auth.client_id
app_role_assignment_required = false
}
resource "azuread_service_principal_password" "pass" {
service_principal_id = azuread_service_principal.sp.id
}
```
</details>
### Scopes and claims
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)).
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.
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).
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.
For personal microsoft accounts, required scope is `openid profile email`.
See: [Overview of permissions and consent in the Microsoft identity platform](https://learn.microsoft.com/en-us/entra/identity-platform/permissions-consent-overview).
### Multi-tenant apps
To authenticate apps from multiple tenants (including personal Microsoft accounts), set the common OIDC issuer url and disable verification:
```toml
oidc_issuer_url=https://login.microsoftonline.com/common/v2.0
insecure_oidc_skip_issuer_verification=true
```
`insecure_oidc_skip_issuer_verification` setting is required to disable following checks:
* 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).
* 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).
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.
### Workload Identity
Provider supports authentication with federated token, without need of using client secret. Following conditions have to be met:
* 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`.
* 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).
* Appropriate federated credential is added to application registration.
<details>
<summary>See federated credential terraform example</summary>
```
resource "azuread_application_federated_identity_credential" "fedcred" {
application_id = azuread_application.application.id # ID of your application
display_name = "federation-cred"
description = "Workload identity for oauth2-proxy"
audiences = ["api://AzureADTokenExchange"] # Fixed value
issuer = "https://cluster-oidc-issuer-url..."
subject = "system:serviceaccount:oauth2-proxy-namespace-name:oauth2-proxy-sa-name" # set proper NS and SA name
}
```
</details>
* Kubernetes service account associated with oauth2-proxy deployment, is annotated with `azure.workload.identity/client-id: <app-registration-client-id>`
* oauth2-proxy pod is labeled with `azure.workload.identity/use: "true"`
* oauth2-proxy is configured with `entra_id_federated_token_auth` set to `true`.
`client_secret` setting can be omitted when using federated token authentication.
See: [Azure Workload Identity documentation](https://azure.github.io/azure-workload-identity/docs/).
### Example configurations
Single-tenant app without groups (*groups claim* not enabled). Consider using generic OIDC provider:
```toml
provider="entra-id"
oidc_issuer_url="https://login.microsoftonline.com/<tenant-id>/v2.0"
client_id="<client-id>"
client_secret="<client-secret>"
scope="openid"
```
Single-tenant app with up to 200 groups (*groups claim* enabled). Consider using generic OIDC provider:
```toml
provider="entra-id"
oidc_issuer_url="https://login.microsoftonline.com/<tenant-id>/v2.0"
client_id="<client-id>"
client_secret="<client-secret>"
scope="openid"
allowed_groups=["ac51800c-2679-4ecb-8130-636380a3b491"]
```
Single-tenant app with more than 200 groups:
```toml
provider="entra-id"
oidc_issuer_url="https://login.microsoftonline.com/<tenant-id>/v2.0"
client_id="<client-id>"
client_secret="<client-secret>"
scope="openid User.Read"
allowed_groups=["968b4844-d5e7-4e18-a834-59927959369f"]
```
Single-tenant app with more than 200 groups and workload identity enabled:
```toml
provider="entra-id"
oidc_issuer_url="https://login.microsoftonline.com/<tenant-id>/v2.0"
client_id="<client-id>"
scope="openid User.Read"
allowed_groups=["968b4844-d5e7-4e18-a834-59927959369f"]
entra_id_federated_token_auth=true
```
Multi-tenant app with Microsoft personal accounts & one Entra tenant allowed, with group overage considered:
```toml
provider="entra-id"
oidc_issuer_url="https://login.microsoftonline.com/common/v2.0"
client_id="<client-id>"
client_secret="<client-secret>"
insecure_oidc_skip_issuer_verification=true
scope="openid profile email User.Read"
entra_id_allowed_tenants=["9188040d-6c67-4c5b-b112-36a304b66dad","<my-tenant-id>"] # Allow only <my-tenant-id> and Personal MS Accounts tenant
email_domains="*"
```

Some files were not shown because too many files have changed in this diff Show More