Skip to content

Commit 7a8e299

Browse files
techknowlogicksapk
authored andcommitted
migrate gplus to google oauth2 provider (#7885)
* migrate gplus to google oauth2 provider. this still provides support for old gplus connections. * Update models/oauth2.go Co-Authored-By: Antoine GIRARD <[email protected]> * make vendor
1 parent 107d57a commit 7a8e299

39 files changed

+3992
-63
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ require (
6868
github.com/lib/pq v1.2.0
6969
github.com/lunny/dingtalk_webhook v0.0.0-20171025031554-e3534c89ef96
7070
github.com/lunny/levelqueue v0.0.0-20190217115915-02b525a4418e
71-
github.com/markbates/goth v1.56.0
7271
github.com/mailru/easyjson v0.7.0 // indirect
72+
github.com/markbates/goth v1.56.0
7373
github.com/mattn/go-isatty v0.0.7
7474
github.com/mattn/go-oci8 v0.0.0-20190320171441-14ba190cf52d // indirect
7575
github.com/mattn/go-sqlite3 v1.11.0

models/oauth2.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ var OAuth2Providers = map[string]OAuth2Provider{
4040
ProfileURL: oauth2.GetDefaultProfileURL("gitlab"),
4141
},
4242
},
43-
"gplus": {Name: "gplus", DisplayName: "Google+", Image: "/img/auth/google_plus.png"},
43+
"gplus": {Name: "gplus", DisplayName: "Google", Image: "/img/auth/google.png"},
4444
"openidConnect": {Name: "openidConnect", DisplayName: "OpenID Connect", Image: "/img/auth/openid_connect.png"},
4545
"twitter": {Name: "twitter", DisplayName: "Twitter", Image: "/img/auth/twitter.png"},
4646
"discord": {Name: "discord", DisplayName: "Discord", Image: "/img/auth/discord.png"},

modules/auth/oauth2/oauth2.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"github.com/markbates/goth/providers/gitea"
2323
"github.com/markbates/goth/providers/github"
2424
"github.com/markbates/goth/providers/gitlab"
25-
"github.com/markbates/goth/providers/gplus"
25+
"github.com/markbates/goth/providers/google"
2626
"github.com/markbates/goth/providers/openidConnect"
2727
"github.com/markbates/goth/providers/twitter"
2828
"github.com/satori/go.uuid"
@@ -166,8 +166,8 @@ func createProvider(providerName, providerType, clientID, clientSecret, openIDCo
166166
}
167167
}
168168
provider = gitlab.NewCustomisedURL(clientID, clientSecret, callbackURL, authURL, tokenURL, profileURL, "read_user")
169-
case "gplus":
170-
provider = gplus.New(clientID, clientSecret, callbackURL, "email")
169+
case "gplus": // named gplus due to legacy gplus -> google migration (Google killed Google+). This ensures old connections still work
170+
provider = google.New(clientID, clientSecret, callbackURL)
171171
case "openidConnect":
172172
if provider, err = openidConnect.New(clientID, clientSecret, callbackURL, openIDConnectAutoDiscoveryURL); err != nil {
173173
log.Warn("Failed to create OpenID Connect Provider with name '%s' with url '%s': %v", providerName, openIDConnectAutoDiscoveryURL, err)

public/img/auth/google.png

1.59 KB
Loading

public/img/auth/google_plus.png

-1.22 KB
Binary file not shown.

templates/admin/auth/new.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
<span>{{.i18n.Tr "admin.auths.tip.github"}}</span>
103103
<li>GitLab</li>
104104
<span>{{.i18n.Tr "admin.auths.tip.gitlab"}}</span>
105-
<li>Google+</li>
105+
<li>Google</li>
106106
<span>{{.i18n.Tr "admin.auths.tip.google_plus"}}</span>
107107
<li>OpenID Connect</li>
108108
<span>{{.i18n.Tr "admin.auths.tip.openid_connect"}}</span>

0 commit comments

Comments
 (0)