Documentation
¶
Overview ¶
Package auth handles passwords and turns request credentials into a user.
Index ¶
- Constants
- Variables
- func BrowserName(userAgent string) string
- func CheckPIN(hash, pin string) bool
- func CheckPassword(u store.User, password string) bool
- func HashPassword(pw string) (string, error)
- func Login(ctx context.Context, s *store.Store, username, password string, ...) (store.User, string, error)
- func Token(r *http.Request) string
- func UserFrom(ctx context.Context) (store.User, bool)
- func ValidPIN(pin string) bool
- func WithUser(ctx context.Context, u store.User) context.Context
Constants ¶
const ( CookieName = "matinee_session" SessionTTL = 90 * 24 * time.Hour )
Variables ¶
var ErrBadCredentials = errors.New("wrong username or password")
Functions ¶
func BrowserName ¶
BrowserName describes a browser from its User-Agent, such as "Firefox on macOS", for the list of signed-in devices.
func CheckPassword ¶
CheckPassword says whether password is the user's.
func HashPassword ¶
func Login ¶
func Login(ctx context.Context, s *store.Store, username, password string, dev store.Device) (store.User, string, error)
Login checks a password and starts a session for a device.
func Token ¶
Token pulls a session token from the Authorization header, the session cookie, or a ?token= query parameter (for <video> and <audio> sources in apps).
Types ¶
This section is empty.