1
0
mirror of https://github.com/oauth2-proxy/oauth2-proxy.git synced 2025-01-10 04:18:14 +02:00

Logs provider name on startup

If invalid provider is specified, stop and error out

fixes #895
This commit is contained in:
Arcadiy Ivanov 2020-11-11 00:53:56 -05:00
parent 6254ed24ea
commit 45ae87e4b7
No known key found for this signature in database
GPG Key ID: 3EFDACAE0954CFA4
3 changed files with 12 additions and 2 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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
} }
} }