summaryrefslogtreecommitdiffstats
path: root/model/gitlab
diff options
context:
space:
mode:
authorEmil Velikov <emil.l.velikov@gmail.com>2018-06-27 01:23:13 +0100
committerChristopher Speller <crspeller@gmail.com>2018-06-26 17:23:13 -0700
commitf17c15c9d83e42e46adb8e8c1fb9706b22fe6f50 (patch)
tree47fc7424a307efb78262526c5d795e0649964f14 /model/gitlab
parent85aa3d664c32af0532113f554002a5d3192faf29 (diff)
downloadchat-f17c15c9d83e42e46adb8e8c1fb9706b22fe6f50.tar.gz
chat-f17c15c9d83e42e46adb8e8c1fb9706b22fe6f50.tar.bz2
chat-f17c15c9d83e42e46adb8e8c1fb9706b22fe6f50.zip
Simplify oauth (#8972)
* Remove unused OauthProvider::GetIdentifier Signed-off-by: Emil Velikov <emil.velikov@collabora.com> * Reuse gitlab's getAuthData() instead of open-coding it Signed-off-by: Emil Velikov <emil.velikov@collabora.com> * Remove OauthProvider::GetAuthDataFromJson interface The data is already available via GetUserFromJson().AuthData Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Diffstat (limited to 'model/gitlab')
-rw-r--r--model/gitlab/gitlab.go16
1 files changed, 1 insertions, 15 deletions
diff --git a/model/gitlab/gitlab.go b/model/gitlab/gitlab.go
index 7e0cb10af..f0a388b6a 100644
--- a/model/gitlab/gitlab.go
+++ b/model/gitlab/gitlab.go
@@ -47,7 +47,7 @@ func userFromGitLabUser(glu *GitLabUser) *model.User {
user.FirstName = glu.Name
}
user.Email = glu.Email
- userId := strconv.FormatInt(glu.Id, 10)
+ userId := glu.getAuthData()
user.AuthData = &userId
user.AuthService = model.USER_AUTH_SERVICE_GITLAB
@@ -90,10 +90,6 @@ func (glu *GitLabUser) getAuthData() string {
return strconv.FormatInt(glu.Id, 10)
}
-func (m *GitLabProvider) GetIdentifier() string {
- return model.USER_AUTH_SERVICE_GITLAB
-}
-
func (m *GitLabProvider) GetUserFromJson(data io.Reader) *model.User {
glu := gitLabUserFromJson(data)
if glu.IsValid() {
@@ -102,13 +98,3 @@ func (m *GitLabProvider) GetUserFromJson(data io.Reader) *model.User {
return &model.User{}
}
-
-func (m *GitLabProvider) GetAuthDataFromJson(data io.Reader) string {
- glu := gitLabUserFromJson(data)
-
- if glu.IsValid() {
- return glu.getAuthData()
- }
-
- return ""
-}