Documentation ¶
Index ¶
- Variables
- func Compare(hash, password []byte) bool
- func Hash(password []byte) ([]byte, error)
- type Attempter
- type AuthProvider
- type Config
- type DriverRegister
- type GuardConfig
- type Manager
- func (m *Manager) GetDriverRegister(name string) (DriverRegister, bool)
- func (m *Manager) GetGuard(driver, provider string, r contracts.RequestContract) (authenticate.Guard, error)
- func (m *Manager) GetProvider(name string) (AuthProvider, bool)
- func (m *Manager) RegisterDriver(name string, dr DriverRegister)
- func (m *Manager) WithProvider(name string, p AuthProvider)
- type Service
Constants ¶
This section is empty.
Variables ¶
View Source
var AuthManager = &Manager{ drivers: make(map[string]DriverRegister), providers: make(map[string]AuthProvider), mu: sync.RWMutex{}, }
AuthManager default manager
View Source
var DefaultCost = bcrypt.DefaultCost
View Source
var GuardType = reflection.InterfaceType[authenticate.Guard]()
Functions ¶
Types ¶
type Attempter ¶
type Attempter interface {
Attempt(r contracts.RequestContract) (authenticate.User, error)
}
type AuthProvider ¶
type AuthProvider interface { authenticate.UserProvider Attempter }
type Config ¶
type Config struct { Default string `yaml:"default"` Guards map[string]GuardConfig `yaml:"guards"` }
Config of authentication
type DriverRegister ¶
type DriverRegister func(up AuthProvider, r contracts.RequestContract) (authenticate.Guard, error)
DriverRegister register of auth guard
type GuardConfig ¶
GuardConfig config of auth guard
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager of authentication
func (*Manager) GetDriverRegister ¶
func (m *Manager) GetDriverRegister(name string) (DriverRegister, bool)
GetDriverRegister get auth guard driver register
func (*Manager) GetGuard ¶
func (m *Manager) GetGuard(driver, provider string, r contracts.RequestContract) (authenticate.Guard, error)
GetGuard get auth guard
func (*Manager) GetProvider ¶
func (m *Manager) GetProvider(name string) (AuthProvider, bool)
GetProvider get auth provider
func (*Manager) RegisterDriver ¶
func (m *Manager) RegisterDriver(name string, dr DriverRegister)
RegisterDriver register auth guard driver
func (*Manager) WithProvider ¶
func (m *Manager) WithProvider(name string, p AuthProvider)
WithProvider register auth provider
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewAuthService ¶
func NewAuthService() *Service
Click to show internal directories.
Click to hide internal directories.