mirror of
https://github.com/miniflux/v2.git
synced 2025-08-11 17:51:01 +00:00
Add generic OpenID Connect provider (OAuth2)
This adds the oauth2 provider `oidc`. It needs an additional argument, the OIDC discovery endpoint to figure out where the auth and token URLs are. Configuration is similar to setting up the Google Authentication with these changes: * `OAUTH2_PROVIDER = oidc` * `OAUTH2_OIDC_DISCOVERY_ENDPOINT = https://auth.exampe.org/discovery`
This commit is contained in:
parent
54602b55bb
commit
3e1e0b604f
88 changed files with 15856 additions and 155 deletions
|
@ -832,6 +832,41 @@ func TestDefaultOAuth2RedirectURLValue(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestOAuth2OidcDiscoveryEndpoint(t *testing.T) {
|
||||
os.Clearenv()
|
||||
os.Setenv("OAUTH2_OIDC_DISCOVERY_ENDPOINT", "http://example.org")
|
||||
|
||||
parser := NewParser()
|
||||
opts, err := parser.ParseEnvironmentVariables()
|
||||
if err != nil {
|
||||
t.Fatalf(`Parsing failure: %v`, err)
|
||||
}
|
||||
|
||||
expected := "http://example.org"
|
||||
result := opts.OAuth2OidcDiscoveryEndpoint()
|
||||
|
||||
if result != expected {
|
||||
t.Fatalf(`Unexpected OAUTH2_OIDC_DISCOVERY_ENDPOINT value, got %q instead of %q`, result, expected)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDefaultOAuth2OidcDiscoveryEndpointValue(t *testing.T) {
|
||||
os.Clearenv()
|
||||
|
||||
parser := NewParser()
|
||||
opts, err := parser.ParseEnvironmentVariables()
|
||||
if err != nil {
|
||||
t.Fatalf(`Parsing failure: %v`, err)
|
||||
}
|
||||
|
||||
expected := defaultOAuth2OidcDiscoveryEndpoint
|
||||
result := opts.OAuth2OidcDiscoveryEndpoint()
|
||||
|
||||
if result != expected {
|
||||
t.Fatalf(`Unexpected OAUTH2_REDIRECT_URL value, got %q instead of %q`, result, expected)
|
||||
}
|
||||
}
|
||||
|
||||
func TestOAuth2Provider(t *testing.T) {
|
||||
os.Clearenv()
|
||||
os.Setenv("OAUTH2_PROVIDER", "google")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue