1
0
mirror of https://github.com/oauth2-proxy/oauth2-proxy.git synced 2025-03-29 22:06:58 +02:00

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>
This commit is contained in:
Damien Degois 2022-11-07 09:42:33 +01:00 committed by GitHub
parent e9a4654358
commit fd2807c091
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 3 deletions

View File

@ -8,6 +8,7 @@
## Changes since v7.4.0
- [#1873](https://github.com/oauth2-proxy/oauth2-proxy/pull/1873) Fix empty users with some OIDC providers (@babs)
- [#1882](https://github.com/oauth2-proxy/oauth2-proxy/pull/1882) Make `htpasswd.GetUsers` racecondition safe
- [#1883](https://github.com/oauth2-proxy/oauth2-proxy/pull/1883) Ensure v8 manifest variant is set on docker images

View File

@ -32,7 +32,10 @@ var _ Provider = (*GitLabProvider)(nil)
// NewGitLabProvider initiates a new GitLabProvider
func NewGitLabProvider(p *ProviderData, opts options.GitLabOptions) (*GitLabProvider, error) {
p.ProviderName = gitlabProviderName
p.setProviderDefaults(providerDefaults{
name: gitlabProviderName,
})
if p.Scope == "" {
p.Scope = gitlabDefaultScope
}

View File

@ -17,7 +17,9 @@ type KeycloakOIDCProvider struct {
// NewKeycloakOIDCProvider makes a KeycloakOIDCProvider using the ProviderData
func NewKeycloakOIDCProvider(p *ProviderData, opts options.KeycloakOptions) *KeycloakOIDCProvider {
p.ProviderName = keycloakOIDCProviderName
p.setProviderDefaults(providerDefaults{
name: keycloakOIDCProviderName,
})
provider := &KeycloakOIDCProvider{
OIDCProvider: &OIDCProvider{

View File

@ -21,7 +21,10 @@ const nextCloudProviderName = "Nextcloud"
// NewNextcloudProvider initiates a new NextcloudProvider
func NewNextcloudProvider(p *ProviderData) *NextcloudProvider {
p.ProviderName = nextCloudProviderName
p.setProviderDefaults(providerDefaults{
name: nextCloudProviderName,
})
p.getAuthorizationHeaderFunc = makeOIDCHeader
if p.EmailClaim == options.OIDCEmailClaim {
// This implies the email claim has not been overridden, we should set a default