auth

package
v0.0.0-...-35b844d Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthMiddleware

type AuthMiddleware struct {
	OnError       func(c *haruka.Context, err error)
	Module        *AuthModule
	RequestFilter func(c *haruka.Context) bool
}

func (AuthMiddleware) OnRequest

func (m AuthMiddleware) OnRequest(c *haruka.Context)

type AuthModule

type AuthModule struct {
	Plugins        []harukap.AuthPlugin
	AuthMiddleware AuthMiddleware
	ConfigProvider *config.Provider
	Config         AuthModuleConfig
	CacheStore     *TokenStoreManager
}

func (*AuthModule) AddCacheStore

func (m *AuthModule) AddCacheStore(convert Serializer)

func (*AuthModule) GetAuthConfig

func (m *AuthModule) GetAuthConfig() ([]interface{}, error)

func (*AuthModule) GetAuthPluginByName

func (m *AuthModule) GetAuthPluginByName(name string) harukap.AuthPlugin

func (*AuthModule) InitModule

func (m *AuthModule) InitModule() error

func (*AuthModule) ParseAuthHeader

func (m *AuthModule) ParseAuthHeader(c *haruka.Context) string

func (*AuthModule) ParseToken

func (m *AuthModule) ParseToken(jwtToken string) (commons.AuthUser, error)

type AuthModuleConfig

type AuthModuleConfig struct {
	EnableAnonymous bool
}

type Serializer

type Serializer interface {
	Serialize(data interface{}) ([]byte, error)
	Deserialize(raw []byte) (commons.AuthUser, error)
}

type TokenStoreManager

type TokenStoreManager struct {
	DB         *bolt.DB
	Serializer Serializer
	// contains filtered or unexported fields
}

func (*TokenStoreManager) GetUserByToken

func (m *TokenStoreManager) GetUserByToken(token string) (commons.AuthUser, error)

func (*TokenStoreManager) Init

func (m *TokenStoreManager) Init() error

Jump to

Keyboard shortcuts

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