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:
		
							parent
							
								
									e9a4654358
								
							
						
					
					
						commit
						fd2807c091
					
				|  | @ -8,6 +8,7 @@ | ||||||
| 
 | 
 | ||||||
| ## Changes since v7.4.0 | ## 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 | - [#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 | - [#1883](https://github.com/oauth2-proxy/oauth2-proxy/pull/1883) Ensure v8 manifest variant is set on docker images | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -32,7 +32,10 @@ var _ Provider = (*GitLabProvider)(nil) | ||||||
| 
 | 
 | ||||||
| // NewGitLabProvider initiates a new GitLabProvider
 | // NewGitLabProvider initiates a new GitLabProvider
 | ||||||
| func NewGitLabProvider(p *ProviderData, opts options.GitLabOptions) (*GitLabProvider, error) { | func NewGitLabProvider(p *ProviderData, opts options.GitLabOptions) (*GitLabProvider, error) { | ||||||
| 	p.ProviderName = gitlabProviderName | 	p.setProviderDefaults(providerDefaults{ | ||||||
|  | 		name: gitlabProviderName, | ||||||
|  | 	}) | ||||||
|  | 
 | ||||||
| 	if p.Scope == "" { | 	if p.Scope == "" { | ||||||
| 		p.Scope = gitlabDefaultScope | 		p.Scope = gitlabDefaultScope | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -17,7 +17,9 @@ type KeycloakOIDCProvider struct { | ||||||
| 
 | 
 | ||||||
| // NewKeycloakOIDCProvider makes a KeycloakOIDCProvider using the ProviderData
 | // NewKeycloakOIDCProvider makes a KeycloakOIDCProvider using the ProviderData
 | ||||||
| func NewKeycloakOIDCProvider(p *ProviderData, opts options.KeycloakOptions) *KeycloakOIDCProvider { | func NewKeycloakOIDCProvider(p *ProviderData, opts options.KeycloakOptions) *KeycloakOIDCProvider { | ||||||
| 	p.ProviderName = keycloakOIDCProviderName | 	p.setProviderDefaults(providerDefaults{ | ||||||
|  | 		name: keycloakOIDCProviderName, | ||||||
|  | 	}) | ||||||
| 
 | 
 | ||||||
| 	provider := &KeycloakOIDCProvider{ | 	provider := &KeycloakOIDCProvider{ | ||||||
| 		OIDCProvider: &OIDCProvider{ | 		OIDCProvider: &OIDCProvider{ | ||||||
|  |  | ||||||
|  | @ -21,7 +21,10 @@ const nextCloudProviderName = "Nextcloud" | ||||||
| 
 | 
 | ||||||
| // NewNextcloudProvider initiates a new NextcloudProvider
 | // NewNextcloudProvider initiates a new NextcloudProvider
 | ||||||
| func NewNextcloudProvider(p *ProviderData) *NextcloudProvider { | func NewNextcloudProvider(p *ProviderData) *NextcloudProvider { | ||||||
| 	p.ProviderName = nextCloudProviderName | 	p.setProviderDefaults(providerDefaults{ | ||||||
|  | 		name: nextCloudProviderName, | ||||||
|  | 	}) | ||||||
|  | 
 | ||||||
| 	p.getAuthorizationHeaderFunc = makeOIDCHeader | 	p.getAuthorizationHeaderFunc = makeOIDCHeader | ||||||
| 	if p.EmailClaim == options.OIDCEmailClaim { | 	if p.EmailClaim == options.OIDCEmailClaim { | ||||||
| 		// This implies the email claim has not been overridden, we should set a default
 | 		// This implies the email claim has not been overridden, we should set a default
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue