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

244 Commits

Author SHA1 Message Date
93cb575d7c Fix error message for clarity 2019-07-19 08:59:29 -05:00
f537720b52 fix lint errors 2019-07-19 08:57:05 -05:00
122ec45dd8 Requested changes 2019-07-19 08:55:14 -05:00
0d94f5e515 fix lint error 2019-07-19 08:53:20 -05:00
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
630db3769b Merge branch 'master' into refactor 2019-07-15 11:30:43 +01:00
018a25be04 Create option to skip verified email check in OIDC provider 2019-07-11 15:29:48 +01:00
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
0af18d6d7c Merge pull request #141 from openai/googleGroupEmail
Check google group membership based on email address
2019-06-15 14:05:56 +02:00
6366690927 Fix gofmt for changed files 2019-06-15 11:34:00 +02:00
fb9616160e Move logger to pkg/logger 2019-06-15 11:33:58 +02:00
d1ef14becc Move cookie to pkg/encryption 2019-06-15 11:33:57 +02:00
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
8027cc454e Move api to pkg/requests 2019-06-08 07:40:43 +01:00
34cbe0497c Add CreatedAt to SessionState 2019-05-20 11:26:09 +02:00
2ab8a7d95d Move SessionState to its own package 2019-05-18 13:09:56 +02:00
7179c5796a make unable to fetch user a warning message 2019-05-08 08:29:38 -07:00
56da8387c0 Include JWT sub as User 2019-05-07 11:57:17 +01:00
15f48fb95e Don't infer username from email local part if username not set 2019-05-07 10:36:00 +01:00
3f2fab10e6 check google group based on email address 2019-05-02 17:11:25 -07:00
8ec025f536 Auth and standard logging with file rolling 2019-04-12 08:59:46 -07:00
d00e3bddf5 Merge branch 'master' into verified 2019-04-11 13:49:56 +01:00
f7c85a4d16 Removing obsolete comment from EncodeSessionState 2019-04-10 15:28:03 +03:00
f5a6609b45 Fixing lint error 2019-04-09 15:17:40 +03:00
4f7517b2f9 Encrypting user/email from cookie 2019-04-09 14:55:33 +03:00
24f36f27a7 fix: check if it is both primary and verified 2019-03-20 13:52:30 -03:00
95ee4358b2 Merge remote-tracking branch 'upstream/master' into verified 2019-03-20 13:46:04 -03:00
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
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
6d15fe004e change per_page value from 200 to 100 2019-03-15 08:00:20 -07:00
e73f6501f0 limit => per_page 2019-03-14 20:04:45 -07:00
3c19c364bd add pagination support for /user/teams 2019-03-12 21:24:47 -07:00
b49aeb222b fix: should check if email is verified 2019-03-11 14:52:08 -03:00
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
eacba4ec7d Add id_token refresh to Google provider (#83) 2019-03-05 14:07:10 +00:00
cac2c9728d Validate OIDC Session State 2019-01-22 11:34:57 +00:00
1b638f32ac Implement refreshing within OIDC provider 2019-01-22 11:34:56 +00:00
6aa35a9ecf Update sessions state 2019-01-22 11:34:53 +00:00
68d4164897 Add Authorization header flags 2019-01-22 11:34:23 +00:00
e200bd5c20 Add comments to exported methods for providers package 2018-12-20 10:37:59 +00:00
8ee802d4e5 Lint for non-comment linter errors 2018-11-29 14:26:41 +00:00
847cf25228 Move imports from bitly to pusher 2018-11-27 11:45:05 +00:00
542ef54093 Strip JWT base64 padding before parsing. #560 2018-03-08 16:44:11 -08:00
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
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
a7c5d9c478 Merge pull request #421 from arnottcr/raw-url-encode
raw url encoding
2017-11-20 10:50:56 -05:00
f2a995b8d9 providers: update gitlab api endpoint to use latest version, v4 2017-11-06 12:05:58 -05:00
8a77cfcac3 Swap out bmizerany/assert package that is deprecated in favor of stretchr/testify/assert 2017-10-23 12:24:17 -04:00
b7f9438b8a Merge pull request #473 from jmcarp/oidc-name
Add OpenID Connect provider name.
2017-10-13 09:10:44 -04:00
d118cb7bbb Drop deprecated MyUSA provider.
[Resolves #390]
2017-10-08 01:01:15 -04:00