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

199 Commits

Author SHA1 Message Date
9cea4ea89b Update golangci-lint version in CI workflow 2021-02-17 20:25:37 +00:00
b6cca79cb9 Ensure errors in tests are logged to the GinkgoWriter 2021-02-10 19:50:04 +00:00
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
4b28e6886c Handle ValidateURL fallback for nil & empty struct cases 2020-12-24 14:04:20 -08:00
816d9a4566 Use a generic http.HandlerFunc in Keycloak tests 2020-12-24 14:04:19 -08:00
f07a5630f1 Update Keycloak documentation 2020-12-24 14:04:19 -08:00
138a6b128a Use ProfileURL for userinfo EnrichSession calls in Keycloak 2020-12-24 14:04:19 -08:00
0886f8035c Move all Keycloak unit tests to Ginkgo 2020-12-24 14:04:19 -08:00
3369799853 Migrate Keycloak to EnrichSession & support multiple groups 2020-12-24 14:04:19 -08:00
d2ffef2c7e Use global OIDC fields for Gitlab 2020-12-21 16:54:12 -08:00
42f6cef7d6 Improve OIDC error handling 2020-12-21 16:53:05 -08:00
ea5b8cc21f Support non-list and complex groups 2020-12-21 16:52:18 -08:00
eb56f24d6d Deprecate UserIDClaim in config and docs 2020-12-21 16:52:17 -08:00
74ac4274c6 Move generic OIDC functionality to be available to all providers 2020-12-21 16:52:04 -08:00
a1877434b2 Refactor OIDC to EnrichSession 2020-12-21 16:51:52 -08:00
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
26ed080bed Cleanup method name refactors missed in comments 2020-11-29 14:18:14 -08:00
57a8ef06b4 Fix method renaming in comments and tests 2020-11-28 10:25:12 -08:00
22f60e9b63 Generalize and extend default CreateSessionFromToken 2020-11-28 10:25:12 -08:00
3e9717d489 Decouple TokenToSession from OIDC & add a generic VerifyFunc 2020-11-28 10:25:11 -08:00
e9f787957e Standardize provider interface method names 2020-11-28 10:25:11 -08:00
d7fa979060 Note legacy areas to refactor away from groupValidator 2020-11-12 11:18:59 -08:00
f21b3b8b20 Authorize in Redeem callback flow 2020-11-12 11:18:59 -08:00
1b3b00443a Streamline ErrMissingCode in provider Redeem methods 2020-11-12 11:18:59 -08:00
b92fd4b0bb Streamline Google to use default Authorize 2020-11-12 11:18:58 -08:00
eb58ea2ed9 Move AllowedGroups to DefaultProvider for default Authorize usage 2020-11-12 11:18:15 -08:00
e7ac793044 Replace ValidateGroup with Authorize for Provider 2020-11-12 11:17:06 -08:00
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
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
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
4a54c9421c Remove EmailDomain verification from GitLab provider
This is handled globally
2020-10-20 10:01:53 -07:00
d9c141ae7c Remove GetUserName method from Provider 2020-10-19 14:09:46 -07:00
0da45e97e1 Refactor GitLab to EnrichSessionState 2020-10-19 14:09:45 -07:00
e51f5fe7c9 Refactor GitHub to EnrichSessionState 2020-10-19 14:09:45 -07:00
2b9e1bbba0 Add EnrichSessionState as main post-Redeem session updater 2020-10-19 14:09:45 -07:00
0bd8eb3191 Setup provider.ErrNotImplemented sentinel error 2020-10-19 14:09:02 -07:00
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
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
4eb9612679 Move DefaultGetLoginURL into util.go 2020-09-28 12:15:06 +02:00
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
fde09bea4e Move azure specific resource parameter handling into azure provider 2020-09-28 12:15:06 +02:00
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
017b9bcfb7 Add unit test for protected resources 2020-09-28 12:15:06 +02:00
8cbf9219bc Pass resource parameter in login url 2020-09-28 12:15:06 +02:00
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
9d59519a96 Add support to ensure user belongs in required groups when using the OIDC provider 2020-09-21 10:43:54 -07:00
d05e08cba3 Create generic Authorization Header constructor 2020-08-16 20:04:34 +01:00
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
dcc75410a8 Handle claim finding differently in bearer vs standard IDTokens 2020-08-14 13:31:38 -07:00
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