auth

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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