auth

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Login

func Login(user string, password string, userStore UserStore, w http.ResponseWriter, t int) error

func Logout

func Logout(user string, userStore UserStore, w http.ResponseWriter) error

Types

type User

type User struct {
	Name      string
	Pass      string
	Session   string
	LoginTime time.Time
	LastSeen  time.Time

	Data map[string]interface{}
}

type UserStore

type UserStore interface {
	InitiateSession(user string, password string, ttl int) (string, error)
	ValidateUser(user string, sessionId string) (bool, error)
	EndSession(user string) error
	AddUser(user string, password string) error
	DeleteUser(user string) error
	ChangePassword(user string, oldPassword string, newPassword string) error
	GetLastLoginTime(user string) (time.Time, error)
	GetLastTimeSeen(user string) (time.Time, error)
	SetData(user string, key string, value interface{}) error
	GetData(user string, key string) (interface{}, error)
	GrantToken(user, password string, ttl int) (string, error)
	ValidateToken(token string) (bool, error)
	ValidateTokenWithScopes(token string, scopes map[string]string) (bool, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL