provider

package
v0.0.0-...-79b8b17 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const AppName = "tokenProvider"

Variables

View Source
var (
	AddProvider = func(o Provider) { container[o.Type()] = o }
	GetProvider = func(t token.IssueType) Provider { return container[t] }

	InitProvider = func(conf Conf) {
		logger := log.Sub(AppName)
		for _, o := range container {
			o.Init(conf)
			logger.Info("add provider", slog.String("name", o.Name()), slog.Any("type", o.Type()))
		}
	}
)

Functions

This section is empty.

Types

type Account

type Account struct{}

type Conf

type Conf struct {
	Feishu  *Feishu  `json:"feishu" yaml:"feishu"`
	Account *Account `json:"account" yaml:"account"`
}

Conf 配置集

type Feishu

type Feishu struct {
	AppID     string `json:"appID" yaml:"appID"`
	AppSecret string `json:"appSecret" yaml:"appSecret"`
	BaseUrl   string `json:"baseUrl" yaml:"baseUrl"`
}

type Provider

type Provider interface {
	Name() string
	Init(conf Conf)                                                                   // 初始化,
	Type() token.IssueType                                                            // 有多个Provider 的实现,用来唯一区别每种实现
	IssueToken(ctx context.Context, req *token.IssueTokenRequest) (*user.User, error) // 每种Provider 都需要实现的方法
}

Provider 每种实现的接口定义

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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