Documentation
¶
Index ¶
- Variables
- func CheckPassword(ctx context.Context, store PasswordStore, userID core.ID, password string) error
- func PutPrincipal(ctx context.Context, op Principal) context.Context
- func SetPassword(ctx context.Context, store PasswordStore, userID core.ID, password string) error
- type Action
- type AllowAll
- type AllowNone
- type Guard
- type OAuthStore
- type PasswordHash
- func (p PasswordHash) MarshalJSON() ([]byte, error)
- func (p PasswordHash) MarshalText() ([]byte, error)
- func (p *PasswordHash) Scan(src any) error
- func (p PasswordHash) String() string
- func (p *PasswordHash) UnmarshalJSON([]byte) error
- func (p *PasswordHash) UnmarshalText([]byte) error
- func (p PasswordHash) Value() (driver.Value, error)
- type PasswordStore
- type Principal
- type SessionReader
- type SessionStore
- type User
- type UserStore
Constants ¶
This section is empty.
Variables ¶
View Source
Functions ¶
func CheckPassword ¶
func PutPrincipal ¶
PutPrincipal stores a Principal in the context.
Types ¶
type OAuthStore ¶
type PasswordHash ¶
type PasswordHash struct {
// contains filtered or unexported fields
}
PasswordHash is an opaque type representing a hashed password. It implements driver.Valuer and sql.Scanner for database storage.
func NewPasswordHash ¶
func NewPasswordHash(hash string) PasswordHash
func (PasswordHash) MarshalJSON ¶
func (p PasswordHash) MarshalJSON() ([]byte, error)
func (PasswordHash) MarshalText ¶
func (p PasswordHash) MarshalText() ([]byte, error)
func (*PasswordHash) Scan ¶
func (p *PasswordHash) Scan(src any) error
func (PasswordHash) String ¶
func (p PasswordHash) String() string
func (*PasswordHash) UnmarshalJSON ¶
func (p *PasswordHash) UnmarshalJSON([]byte) error
func (*PasswordHash) UnmarshalText ¶
func (p *PasswordHash) UnmarshalText([]byte) error
func (PasswordHash) Value ¶
func (p PasswordHash) Value() (driver.Value, error)
type PasswordStore ¶
type PasswordStore interface {
SetHash(ctx context.Context, userID core.ID, hash PasswordHash) error
GetHash(ctx context.Context, userID core.ID) (PasswordHash, error)
}
PasswordStore is implemented by the app to persist password hashes.
type Principal ¶
type SessionStore ¶
type UserStore ¶
type UserStore interface {
Save(ctx context.Context, user *User) (created bool, err error)
// GetUserByEmail gets a user by email.
// Returns core.ErrNotFound if user doesn't exist
GetByEmail(ctx context.Context, email string) (*User, error)
// Get gets a user by ID.
// Returns core.ErrNotFound if user doesn't exist
Get(ctx context.Context, id core.ID) (*User, error)
}
UserStore provides access to user data
Source Files
¶
- errors.go
- guard.go
- oauth.go
- passwords.go
- principal.go
- session.go
- users.go
Click to show internal directories.
Click to hide internal directories.