mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Some refactoring
This commit is contained in:
22
einterfaces/ldap.go
Normal file
22
einterfaces/ldap.go
Normal file
@@ -0,0 +1,22 @@
|
||||
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
package einterfaces
|
||||
|
||||
import (
|
||||
"github.com/mattermost/platform/model"
|
||||
)
|
||||
|
||||
type LdapInterface interface {
|
||||
DoLogin(team *model.Team, id string, password string) (*model.User, *model.AppError)
|
||||
}
|
||||
|
||||
var theLdapInterface LdapInterface
|
||||
|
||||
func RegisterLdapInterface(newInterface LdapInterface) {
|
||||
theLdapInterface = newInterface
|
||||
}
|
||||
|
||||
func GetLdapInterface() LdapInterface {
|
||||
return theLdapInterface
|
||||
}
|
||||
29
einterfaces/oauthproviders.go
Normal file
29
einterfaces/oauthproviders.go
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
package einterfaces
|
||||
|
||||
import (
|
||||
"github.com/mattermost/platform/model"
|
||||
"io"
|
||||
)
|
||||
|
||||
type OauthProvider interface {
|
||||
GetIdentifier() string
|
||||
GetUserFromJson(data io.Reader) *model.User
|
||||
GetAuthDataFromJson(data io.Reader) string
|
||||
}
|
||||
|
||||
var oauthProviders = make(map[string]OauthProvider)
|
||||
|
||||
func RegisterOauthProvider(name string, newProvider OauthProvider) {
|
||||
oauthProviders[name] = newProvider
|
||||
}
|
||||
|
||||
func GetOauthProvider(name string) OauthProvider {
|
||||
provider, ok := oauthProviders[name]
|
||||
if ok {
|
||||
return provider
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user