check authdata for different format (#17577)

* check authdata for different format

* add mocks, fix lint

* rename function

* update auth-data with new format

* update assert

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
Scott Bishel
2021-05-24 09:04:20 -06:00
committed by GitHub
parent a4f7df6f6e
commit 2f33b52d8a
6 changed files with 73 additions and 10 deletions

View File

@@ -84,3 +84,17 @@ func (_m *OauthProvider) GetUserFromJson(data io.Reader, tokenUser *model.User)
return r0, r1
}
// IsSameUser provides a mock function with given fields: dbUser, oAuthUser
func (_m *OauthProvider) IsSameUser(dbUser *model.User, oAuthUser *model.User) bool {
ret := _m.Called(dbUser, oAuthUser)
var r0 bool
if rf, ok := ret.Get(0).(func(*model.User, *model.User) bool); ok {
r0 = rf(dbUser, oAuthUser)
} else {
r0 = ret.Get(0).(bool)
}
return r0
}

View File

@@ -13,6 +13,7 @@ type OauthProvider interface {
GetUserFromJson(data io.Reader, tokenUser *model.User) (*model.User, error)
GetSSOSettings(config *model.Config, service string) (*model.SSOSettings, error)
GetUserFromIdToken(idToken string) (*model.User, error)
IsSameUser(dbUser, oAuthUser *model.User) bool
}
var oauthProviders = make(map[string]OauthProvider)