diff --git a/account.go b/account.go
index ad58235..04aa61d 100644
--- a/account.go
+++ b/account.go
@@ -309,6 +309,7 @@ func viewLogin(app *App, w http.ResponseWriter, r *http.Request) error {
OauthSlack bool
OauthWriteAs bool
OauthGitlab bool
+ GitlabHost string
}{
pageForReq(app, r),
r.FormValue("to"),
@@ -318,6 +319,7 @@ func viewLogin(app *App, w http.ResponseWriter, r *http.Request) error {
app.Config().SlackOauth.ClientID != "",
app.Config().WriteAsOauth.ClientID != "",
app.Config().GitlabOauth.ClientID != "",
+ config.OrDefaultString(app.Config().GitlabOauth.DisplayName, gitlabDisplayName),
}
if earlyError != "" {
diff --git a/config/config.go b/config/config.go
index 1d82a0e..40dbd4d 100644
--- a/config/config.go
+++ b/config/config.go
@@ -72,9 +72,8 @@ type (
GitlabOauthCfg struct {
ClientID string `ini:"client_id"`
ClientSecret string `ini:"client_secret"`
- AuthLocation string `ini:"auth_location"`
- TokenLocation string `ini:"token_location"`
- InspectLocation string `ini:"inspect_location"`
+ Host string `ini:"host"`
+ DisplayName string `ini:"display_name"`
CallbackProxy string `ini:"callback_proxy"`
CallbackProxyAPI string `ini:"callback_proxy_api"`
}
diff --git a/oauth.go b/oauth.go
index 0893fcd..a344bde 100644
--- a/oauth.go
+++ b/oauth.go
@@ -179,12 +179,13 @@ func configureGitlabOauth(parentHandler *Handler, r *mux.Router, app *App) {
callbackLocation = app.Config().GitlabOauth.CallbackProxy
}
+ address := config.OrDefaultString(app.Config().GitlabOauth.Host, gitlabHost)
oauthClient := gitlabOauthClient{
ClientID: app.Config().GitlabOauth.ClientID,
ClientSecret: app.Config().GitlabOauth.ClientSecret,
- ExchangeLocation: config.OrDefaultString(app.Config().GitlabOauth.TokenLocation, gitlabExchangeLocation),
- InspectLocation: config.OrDefaultString(app.Config().GitlabOauth.InspectLocation, gitlabIdentityLocation),
- AuthLocation: config.OrDefaultString(app.Config().GitlabOauth.AuthLocation, gitlabAuthLocation),
+ ExchangeLocation: address + "/oauth/token",
+ InspectLocation: address + "/api/v4/user",
+ AuthLocation: address + "/oauth/authorize",
HttpClient: config.DefaultHTTPClient(),
CallbackLocation: callbackLocation,
}
diff --git a/oauth_gitlab.go b/oauth_gitlab.go
index e5138d4..8931978 100644
--- a/oauth_gitlab.go
+++ b/oauth_gitlab.go
@@ -21,9 +21,8 @@ type gitlabOauthClient struct {
var _ oauthClient = gitlabOauthClient{}
const (
- gitlabAuthLocation = "https://gitlab.com/oauth/authorize"
- gitlabExchangeLocation = "https://gitlab.com/oauth/token"
- gitlabIdentityLocation = "https://gitlab.com/api/v4/user"
+ gitlabHost = "https://gitlab.com"
+ gitlabDisplayName = "GitLab"
)
func (c gitlabOauthClient) GetProvider() string {
diff --git a/pages/login.tmpl b/pages/login.tmpl
index a988615..f08dbf7 100644
--- a/pages/login.tmpl
+++ b/pages/login.tmpl
@@ -55,7 +55,7 @@ hr.short {
Sign in with Write.as
{{ end }}
{{ if .OauthGitlab }}
- Sign in with GitLab
+ Sign in with {{ .GitlabDisplayName }}
{{ end }}