services

package
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthLoginProtocolHttp  = "http"
	AuthLoginProtocolHttps = "https"
	AuthLoginProtocolLdap  = "ldap"
	AuthLoginProtocolLdaps = "ldaps"
)
View Source
const (
	LdapDefaultAccountPattern     = "(&(objectClass=User)(uid=%s))"
	LdapDefaultAttributeGivenName = "cn"
)

Variables

View Source
var AuthLogin = NewAuthLoginManager()
View Source
var DocIndexService = NewDocIndexService()
View Source
var (
	LdapUserSearchNotFoundErr = errors.New("用户不存在或密码错误")
)

Functions

This section is empty.

Types

type AuthLoginConfig

type AuthLoginConfig struct {
	BaseDn         string `json:"basedn"`
	BindUsername   string `json:"bind_username"`
	BindPassword   string `json:"bind_password"`
	AccountPattern string `json:"account_pattern"`
	GivenNameKey   string `json:"given_name_key"`
	EmailKey       string `json:"email_key"`
	MobileKey      string `json:"mobile_key"`
	PhoneKey       string `json:"phone_key"`
	DepartmentKey  string `json:"department_key"`
	PositionKey    string `json:"position_key"`
	LocationKey    string `json:"location_key"`
	ImKey          string `json:"im_key"`
}

type AuthLoginHttpRes

type AuthLoginHttpRes struct {
	Message string             `json:"message"`
	Data    *AuthLoginResponse `json:"data"`
}

type AuthLoginLdapService

type AuthLoginLdapService struct {
	// contains filtered or unexported fields
}

AuthLoginLdapService ldap auth login

func (*AuthLoginLdapService) AuthLogin

func (al *AuthLoginLdapService) AuthLogin(username string, password string) (*AuthLoginResponse, error)

AuthLogin ldap auth

func (*AuthLoginLdapService) GetAttributes

func (al *AuthLoginLdapService) GetAttributes() []string

GetAttributes get config attribute name

func (*AuthLoginLdapService) GetServiceName

func (al *AuthLoginLdapService) GetServiceName() string

GetServiceName ldap

func (*AuthLoginLdapService) InitConf

func (al *AuthLoginLdapService) InitConf(url string, conf string) error

InitConf init ldap auth login config

type AuthLoginManager

type AuthLoginManager struct {
	AuthLoginServices map[string]AuthLoginService
}

AuthLoginManager auth login manager

func NewAuthLoginManager

func NewAuthLoginManager() *AuthLoginManager

NewAuthLoginManager new a auth login manager

func (*AuthLoginManager) AuthLogin

func (am *AuthLoginManager) AuthLogin(username, password string) (*AuthLoginResponse, error)

AuthLogin start auth login

func (*AuthLoginManager) RegisterService

func (am *AuthLoginManager) RegisterService(serviceName string, authLoginService AuthLoginService)

RegisterService register a auth login service

func (*AuthLoginManager) UrlIsSupport

func (am *AuthLoginManager) UrlIsSupport(serviceName string) bool

type AuthLoginResponse

type AuthLoginResponse struct {
	GivenName  string `json:"given_name"`
	Email      string `json:"email"`
	Mobile     string `json:"mobile"`
	Phone      string `json:"phone"`
	Department string `json:"department"`
	Position   string `json:"position"`
	Location   string `json:"location"`
	Im         string `json:"im"`
}

AuthLoginResponse auth login response result

type AuthLoginService

type AuthLoginService interface {

	// Init init login config
	InitConf(url string, conf string) error

	// GetServiceName get auth login service name
	GetServiceName() string

	// AuthLogin auth login request
	AuthLogin(username string, password string) (*AuthLoginResponse, error)
}

AuthLoginService auth login service

func NewAuthLoginHttpService

func NewAuthLoginHttpService() AuthLoginService

NewAuthLoginHttpService

func NewAuthLoginLdapService

func NewAuthLoginLdapService() AuthLoginService

NewAuthLoginLdapService

type AuthLoinHttpService

type AuthLoinHttpService struct {
	// contains filtered or unexported fields
}

AuthLoinHttpService http auth login

func (*AuthLoinHttpService) AuthLogin

func (ah *AuthLoinHttpService) AuthLogin(username string, password string) (*AuthLoginResponse, error)

AuthLogin send http request

func (*AuthLoinHttpService) GetServiceName

func (ah *AuthLoinHttpService) GetServiceName() string

GetServiceName http

func (*AuthLoinHttpService) InitConf

func (ah *AuthLoinHttpService) InitConf(url string, conf string) error

InitConf init http auth login config

type DocIndex

type DocIndex struct {
}

func NewDocIndexService

func NewDocIndexService() *DocIndex

func (*DocIndex) Flush

func (di *DocIndex) Flush()

FlushIndex 所有索引

func (*DocIndex) ForceDelDocIdIndex

func (di *DocIndex) ForceDelDocIdIndex(docId string)

ForceDelDocIdIndex 强制删除索引

func (*DocIndex) ForceUpdateDocIndexByDocId

func (di *DocIndex) ForceUpdateDocIndexByDocId(docId string) error

UpdateDocIndex 更新单个文件的索引

func (*DocIndex) IsUpdateDocIndex

func (di *DocIndex) IsUpdateDocIndex() bool

func (*DocIndex) UpdateAllDocIndex

func (di *DocIndex) UpdateAllDocIndex(batchNum int)

UpdateAllDocIndex 更新所有的文档

func (*DocIndex) UpdateDocIndex

func (di *DocIndex) UpdateDocIndex(doc map[string]string)

UpdateDocIndex 更新单个文件的索引

func (*DocIndex) UpdateDocsIndex

func (di *DocIndex) UpdateDocsIndex(docs []map[string]string)

UpdateDocsIndex 批量更新多个文件的索引

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL