golazy.dev
–
golazy.dev
/
lazyauth
/
memoryauth
Index
|
Files
package memoryauth ¶
import "golazy.dev/lazyauth/memoryauth"
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
func FromEnvironment ¶
FromEnvironment creates the default lazyapp memory backend.
With no LAZYAUTH_DEFAULT_PASS environment variable, the backend has zero users. When LAZYAUTH_DEFAULT_PASS is set, it creates one password user named admin, or LAZYAUTH_DEFAULT_USER when that value is non-empty.
func FromEnvironment() *Provider
func New ¶
New creates an in-memory authenticator with the provided users.
func New(users ...User) *Provider
func (p *Provider) Authenticate ¶
Authenticate implements lazyauth.Authenticator.
func (p *Provider) Authenticate(_ context.Context, credential lazyauth.Credential) (lazyauth.User, error)
func (p *Provider) Set ¶
Set adds or replaces one in-memory user.
func (p *Provider) Set(user User)
type User ¶
User is an in-memory password user.
type User struct {
ID string
Password string
Data map[string]any
}
Provider authenticates password credentials against an in-memory user set.