diff --git a/config.yml b/config.yml index fa6f3ec..213067a 100644 --- a/config.yml +++ b/config.yml @@ -98,6 +98,7 @@ gitea.url: https://gitea.com/ gitea.name: Gitea # To create a new OAuth2 application using OpenID Connect: +oidc.provider-name: oidc.client-key: oidc.secret: # Discovery endpoint of the OpenID provider. Generally something like http://auth.example.com/.well-known/openid-configuration diff --git a/docs/configuration/cheat-sheet.md b/docs/configuration/cheat-sheet.md index e76686e..51b9240 100644 --- a/docs/configuration/cheat-sheet.md +++ b/docs/configuration/cheat-sheet.md @@ -35,6 +35,7 @@ aside: false | gitea.secret | OG_GITEA_SECRET | none | The secret for the Gitea OAuth application. | | gitea.url | OG_GITEA_URL | `https://gitea.com/` | The URL of the Gitea instance. | | gitea.name | OG_GITEA_NAME | `Gitea` | The name of the Gitea instance. It is displayed in the OAuth login button. | +| oidc.provider-name | OG_OIDC_PROVIDER_NAME | none | The name of the OIDC provider | | oidc.client-key | OG_OIDC_CLIENT_KEY | none | The client key for the OpenID application. | | oidc.secret | OG_OIDC_SECRET | none | The secret for the OpenID application. | | oidc.discovery-url | OG_OIDC_DISCOVERY_URL | none | Discovery endpoint of the OpenID provider. | diff --git a/docs/configuration/oauth-providers.md b/docs/configuration/oauth-providers.md index b7cfe57..dd45873 100644 --- a/docs/configuration/oauth-providers.md +++ b/docs/configuration/oauth-providers.md @@ -63,12 +63,14 @@ Opengist can be configured to use OAuth to authenticate users, with GitHub, Gite * Set 'Redirect URI' to `http://opengist.url/oauth/openid-connect/callback` * Copy the 'Client ID', 'Client Secret', and the discovery endpoint, and add them to the [configuration](cheat-sheet.md) : ```yaml + oidc.provider-name: oidc.client-key: oidc.secret: # Discovery endpoint of the OpenID provider. Generally something like http://auth.example.com/.well-known/openid-configuration oidc.discovery-url: http://auth.example.com/.well-known/openid-configuration ``` ```shell + OG_OIDC_PROVIDER_NAME= OG_OIDC_CLIENT_KEY= OG_OIDC_SECRET= # Discovery endpoint of the OpenID provider. Generally something like http://auth.example.com/.well-known/openid-configuration diff --git a/internal/config/config.go b/internal/config/config.go index 0e08ab4..cd62320 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -67,6 +67,7 @@ type config struct { GiteaUrl string `yaml:"gitea.url" env:"OG_GITEA_URL"` GiteaName string `yaml:"gitea.name" env:"OG_GITEA_NAME"` + OIDCProviderName string `yaml:"oidc.provider-name" env:"OG_OIDC_PROVIDER_NAME"` OIDCClientKey string `yaml:"oidc.client-key" env:"OG_OIDC_CLIENT_KEY"` OIDCSecret string `yaml:"oidc.secret" env:"OG_OIDC_SECRET"` OIDCDiscoveryUrl string `yaml:"oidc.discovery-url" env:"OG_OIDC_DISCOVERY_URL"` diff --git a/templates/pages/admin_config.html b/templates/pages/admin_config.html index c6f8b40..8276890 100644 --- a/templates/pages/admin_config.html +++ b/templates/pages/admin_config.html @@ -64,6 +64,7 @@
Gitea Secret
{{ if .c.GiteaSecret }}<defined>{{ end }}
Gitea URL
{{ .c.GiteaUrl }}
Gitea Name
{{ .c.GiteaName }}
+
OIDC Provider name
{{ .c.OIDCProviderName }}
OIDC client Key
{{ if .c.OIDCClientKey }}<defined>{{ end }}
OIDC Secret
{{ if .c.OIDCSecret }}<defined>{{ end }}
OIDC Discovery URL
{{ if .c.OIDCDiscoveryUrl }}<defined>{{ end }}
diff --git a/templates/pages/auth_form.html b/templates/pages/auth_form.html index 18206dd..ac342e3 100644 --- a/templates/pages/auth_form.html +++ b/templates/pages/auth_form.html @@ -79,7 +79,11 @@ {{ end }} {{ if .oidcOauth }} - Continue with OpenID account + {{ if .c.OIDCProviderName }} + Connect with {{ .c.OIDCProviderName }} account + {{ else }} + Continue with OpenID account + {{ end }} {{ end }}