security

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessLevel

type AccessLevel int
const (
	CanSub AccessLevel = iota
	CanPub
	CanSubPub
)

type Acl

type Acl struct {
	Topic  string
	Access AccessLevel
}

type Authentication

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

func NewAuthentication

func NewAuthentication(acls []Acl) *Authentication

func (*Authentication) CanPub

func (auth *Authentication) CanPub(topic string) bool

func (*Authentication) CanSub

func (auth *Authentication) CanSub(topic string) bool

type AuthenticationProvider

type AuthenticationProvider interface {
	//验证用户凭证并返回当前用户的授权信息
	Authenticate(username, password string) *Authentication
}

type StaticUserListAuthProvider

type StaticUserListAuthProvider struct {
	Users []User
	// contains filtered or unexported fields
}

该权限认证器只会判断用户是否在白名单内, 并给所有的用户统一赋予所有topic的pubsub权限

func NewStaticUserListAuthProvider

func NewStaticUserListAuthProvider(users []User) *StaticUserListAuthProvider

func (*StaticUserListAuthProvider) Authenticate

func (authProvider *StaticUserListAuthProvider) Authenticate(username, password string) *Authentication

type User

type User struct {
	UserName string
	Password string
}

Jump to

Keyboard shortcuts

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