Merge pull request #911 from arcivanov/issue_895
Validate and log provider type on startup
This commit is contained in:
		
						commit
						df56a34ea3
					
				|  | @ -17,6 +17,7 @@ | ||||||
| 
 | 
 | ||||||
| ## Breaking Changes | ## Breaking Changes | ||||||
| 
 | 
 | ||||||
|  | - [#911](https://github.com/oauth2-proxy/oauth2-rpoxy/pull/911) Specifying a non-existent provider will cause OAuth2-Proxy to fail on startup instead of defaulting to "google". | ||||||
| - [#722](https://github.com/oauth2-proxy/oauth2-proxy/pull/722) When a Redis session store is configured, OAuth2-Proxy will fail to start up unless connection and health checks to Redis pass | - [#722](https://github.com/oauth2-proxy/oauth2-proxy/pull/722) When a Redis session store is configured, OAuth2-Proxy will fail to start up unless connection and health checks to Redis pass | ||||||
| - [#800](https://github.com/oauth2-proxy/oauth2-proxy/pull/800) Fix import path for v7. The import path has changed to support the go get installation. | - [#800](https://github.com/oauth2-proxy/oauth2-proxy/pull/800) Fix import path for v7. The import path has changed to support the go get installation. | ||||||
|   - You can now `go get github.com/oauth2-proxy/oauth2-proxy/v7` to get the latest `v7` version of OAuth2 Proxy |   - You can now `go get github.com/oauth2-proxy/oauth2-proxy/v7` to get the latest `v7` version of OAuth2 Proxy | ||||||
|  | @ -34,6 +35,7 @@ | ||||||
| 
 | 
 | ||||||
| ## Changes since v6.1.1 | ## Changes since v6.1.1 | ||||||
| 
 | 
 | ||||||
|  | - [#911](https://github.com/oauth2-proxy/oauth2-rpoxy/pull/911) Validate provider type on startup. | ||||||
| - [#906](https://github.com/oauth2-proxy/oauth2-proxy/pull/906) Set up v6.1.x versioned documentation as default documentation (@JoelSpeed) | - [#906](https://github.com/oauth2-proxy/oauth2-proxy/pull/906) Set up v6.1.x versioned documentation as default documentation (@JoelSpeed) | ||||||
| - [#905](https://github.com/oauth2-proxy/oauth2-proxy/pull/905) Remove v5 legacy sessions support (@NickMeves) | - [#905](https://github.com/oauth2-proxy/oauth2-proxy/pull/905) Remove v5 legacy sessions support (@NickMeves) | ||||||
| - [#904](https://github.com/oauth2-proxy/oauth2-proxy/pull/904) Set `skip-auth-strip-headers` to `true` by default (@NickMeves) | - [#904](https://github.com/oauth2-proxy/oauth2-proxy/pull/904) Set `skip-auth-strip-headers` to `true` by default (@NickMeves) | ||||||
|  |  | ||||||
|  | @ -233,7 +233,13 @@ func parseProviderInfo(o *options.Options, msgs []string) []string { | ||||||
| 	p.ValidateURL, msgs = parseURL(o.ValidateURL, "validate", msgs) | 	p.ValidateURL, msgs = parseURL(o.ValidateURL, "validate", msgs) | ||||||
| 	p.ProtectedResource, msgs = parseURL(o.ProtectedResource, "resource", msgs) | 	p.ProtectedResource, msgs = parseURL(o.ProtectedResource, "resource", msgs) | ||||||
| 
 | 
 | ||||||
| 	o.SetProvider(providers.New(o.ProviderType, p)) | 	provider := providers.New(o.ProviderType, p) | ||||||
|  | 	if provider == nil { | ||||||
|  | 		msgs = append(msgs, fmt.Sprintf("invalid setting: provider '%s' is not available", o.ProviderType)) | ||||||
|  | 		return msgs | ||||||
|  | 	} | ||||||
|  | 	o.SetProvider(provider) | ||||||
|  | 
 | ||||||
| 	switch p := o.GetProvider().(type) { | 	switch p := o.GetProvider().(type) { | ||||||
| 	case *providers.AzureProvider: | 	case *providers.AzureProvider: | ||||||
| 		p.Configure(o.AzureTenant) | 		p.Configure(o.AzureTenant) | ||||||
|  |  | ||||||
|  | @ -46,7 +46,9 @@ func New(provider string, p *ProviderData) Provider { | ||||||
| 		return NewNextcloudProvider(p) | 		return NewNextcloudProvider(p) | ||||||
| 	case "digitalocean": | 	case "digitalocean": | ||||||
| 		return NewDigitalOceanProvider(p) | 		return NewDigitalOceanProvider(p) | ||||||
| 	default: | 	case "google": | ||||||
| 		return NewGoogleProvider(p) | 		return NewGoogleProvider(p) | ||||||
|  | 	default: | ||||||
|  | 		return nil | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue