oauth2

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteClientMap added in v0.17.0

func DeleteClientMap(id string) (map[string]struct{}, bool)

func GetClientMap added in v0.17.0

func GetClientMap(id string) map[string]struct{}

func NewFactory

func NewFactory() auth.IAuthFactory

NewFactory 生成一个 auth_apiKey工厂

func Register

func Register()

Register 注册auth驱动工厂

func RegisterClient added in v0.17.0

func RegisterClient(clientId string, client IClient)

func RemoveClient added in v0.15.12

func RemoveClient(clientId string)

func SetClientMap added in v0.17.0

func SetClientMap(id string, clientIds map[string]struct{})

Types

type Config

type Config struct {
	application.Auth
	Users []*User `json:"users" label:"用户列表"`
}

type IClient added in v0.15.12

type IClient interface {
	ClientID() string
	ClientSecret() string
	ClientType() string
	HashSecret() bool
	RedirectUrls() []string
	MatchSecret(secret string) error
	Expire() int64
}

func GetClient added in v0.15.12

func GetClient(clientId string) (IClient, bool)

type Manager

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

Manager 管理oauth2配置

func NewManager

func NewManager() *Manager

type Pattern

type Pattern struct {
	ClientId     string   `json:"client_id" label:"客户端ID"`
	ClientSecret string   `json:"client_secret" label:"客户端密钥"`
	ClientType   string   `json:"client_type" label:"客户端类型" enum:"public,confidential"`
	HashSecret   bool     `json:"hash_secret" label:"是否Hash加密"`
	RedirectUrls []string `json:"redirect_urls" label:"重定向URL列表"`
}

type User

type User struct {
	Pattern Pattern `json:"pattern" label:"用户信息"`
	application.User
}

func (*User) Username

func (u *User) Username() string

Jump to

Keyboard shortcuts

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