github.com/trigonella/mattermost-server@v5.11.1+incompatible/einterfaces/oauthproviders.go (about)

     1  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
     2  // See License.txt for license information.
     3  
     4  package einterfaces
     5  
     6  import (
     7  	"io"
     8  
     9  	"github.com/mattermost/mattermost-server/model"
    10  )
    11  
    12  type OauthProvider interface {
    13  	GetUserFromJson(data io.Reader) *model.User
    14  }
    15  
    16  var oauthProviders = make(map[string]OauthProvider)
    17  
    18  func RegisterOauthProvider(name string, newProvider OauthProvider) {
    19  	oauthProviders[name] = newProvider
    20  }
    21  
    22  func GetOauthProvider(name string) OauthProvider {
    23  	provider, ok := oauthProviders[name]
    24  	if ok {
    25  		return provider
    26  	}
    27  	return nil
    28  }