1
0
mirror of https://github.com/oauth2-proxy/oauth2-proxy.git synced 2025-06-15 00:15:00 +02:00
Commit Graph

294 Commits

Author SHA1 Message Date
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
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
0791aef8cc Integrate new provider constructor in main 2022-02-16 10:38:07 +00:00
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
c1b01b5bc0 Fix issue with query string allowed group panic on skip methods 2022-02-10 12:39:32 +00:00
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
d8deaa124b Improve error message when no cookie is found 2021-10-13 19:08:11 +01:00
d3e036d619 Add force-json-errors flag 2021-10-05 11:24:47 +02:00
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
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
593125152d Standarize provider refresh implemention & logging 2021-06-22 17:04:30 -07:00
7fa6d2d024 Manage session time fields centrally 2021-06-21 21:54:52 -07:00
7e80e5596b RefreshSessions immediately when called 2021-06-21 21:54:52 -07:00
273ab1f591 Integrate redirect package with OAuth2 Proxy 2021-06-19 11:24:27 +01:00
a8c9b2903d Use gorilla mux for OAuth Proxy routing 2021-06-19 11:17:16 +01:00
befcdd9d04 Add pagewriter to upstream proxy 2021-05-10 11:14:05 +01:00
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
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
c0654e3d9f Remove unused fields from OAuthProxy 2021-03-29 18:26:48 +01:00
17009d8363 Metrics server should be constructed with secure bind address for TLS 2021-03-26 09:58:39 +00:00
64f0a9f580 Reinstate preferEmailToUser behaviour for basic auth sessions 2021-03-22 13:13:26 +00:00
2e5b229637 Deprecate GCP HealthCheck option 2021-03-21 20:05:13 +00:00
f3bd61b371 Use pagewriter to render robots txt page 2021-03-21 18:34:42 +00:00
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
9dbd5f5afd Ensure redirect URI always has a scheme 2021-03-14 10:16:29 +00:00
8d2fc409d8 Integrate new server implementation into main OAuth2 Proxy 2021-03-07 11:49:11 +00:00
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
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
23e545a639 Add option for custom logos on the sign in page 2021-02-19 13:23:55 +00:00
9cea4ea89b Update golangci-lint version in CI workflow 2021-02-17 20:25:37 +00:00
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
225ff478a1 Move all pagewriter related code to dedicated pagewriter package 2021-02-14 10:21:13 +00:00
e8e2af73df Wrap templates and page rendering in PageWriter interface 2021-02-14 10:20:26 +00:00
dba6989054 Move SignIn page rendering to app pkg 2021-02-13 11:35:38 +00:00
6ecbc7bc4e Allow users to choose detailed error messages on error pages 2021-02-12 21:12:28 +00:00
a63ed0225c Use ErrorPage to render proxy error page 2021-02-12 21:12:27 +00:00
ef457b1765 Move Error page rendering to app package 2021-02-12 21:12:05 +00:00
0151ca11f6 Move template loading to app package 2021-02-12 16:55:52 +00:00
84f76c6060 Move template options to their own struct 2021-02-12 16:55:51 +00:00
801edeba23 Update templates to bulma framework 2021-02-12 16:55:45 +00:00
780ae4f3c9 Merge pull request from GHSA-4mf2-f3wh-gvf2 2021-02-01 18:04:33 +00:00
da02914a9c Log IsValidRedirect violations and do a final safety call 2021-01-16 13:56:38 -08:00
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
73fc7706bc Figure out final app redirect URL with proxy aware request utils 2021-01-16 13:55:49 -08:00
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
81bf1ef8ce Adapt isAjax to support mimetype lists
Fixes #988
2021-01-12 19:37:30 +01:00
1d74a51cd7 Use X-Forwarded-{Proto,Host,Uri} on redirect as last resort (#957) 2021-01-01 15:23:11 -08:00
753f6c548a Add a detailed allowed_groups example to Important Notes 2020-12-24 12:05:12 -08:00
65e15f24c1 Support only allowed_groups querystring 2020-12-24 12:05:12 -08:00
025056cba0 Move AuthOnly authorize logic to a dedicated method 2020-12-24 12:05:11 -08:00