auth

package
v0.0.0-...-5d4f8f2 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoDataFound       = "not found"
	EmptyPasswordHash = "empty password hash"
)
View Source
const (
	ValidUser   = "Valid"
	InvalidUser = "Invalid"
)
View Source
const (
	GuestUser    = "Guest"
	StandardUser = "Standard"
)
View Source
const (
	SessionValid   = "Valid"
	SessionInvalid = "Invalid"
	SessionStale   = "Stale"
)

Variables

This section is empty.

Functions

func ErrEmptyPasswordHash

func ErrEmptyPasswordHash() error

func GenerateToken

func GenerateToken(user *User) string

func IsNoDataFoundErr

func IsNoDataFoundErr(err error) bool

Types

type AuthRequest

type AuthRequest struct {
	UserName string
	Password string
}

type AuthResponse

type AuthResponse struct {
	Jwt       string
	UserAttrs *UserAttrs
}

type AuthServer

type AuthServer interface {
	CreateUser(name, email, password string) (*UserAttrs, error)
	CreateTypedUser(usertype, name, email, plainpass string) (*UserAttrs, error)
	CreateSession(name, txtPassword string) (jwtToken string, userAttrs *UserAttrs, fnError error)
}

func NewAuthServer

func NewAuthServer(db db_pkg.DatabaseContext) AuthServer

type Session

type Session struct {
	*User
	Status SessionStatus
}

type SessionAttrs

type SessionAttrs struct {
	Id string
	// contains filtered or unexported fields
}

not used yet

type SessionStatus

type SessionStatus string

type User

type User struct {
	Name string
}

func VerifyToken

func VerifyToken(tokenString string) (*User, error)

type UserAttrs

type UserAttrs struct {
	*User
	Email        string
	PasswordHash string
	Status       UserStatus
	Type         UserType
}

type UserClaims

type UserClaims struct {
	User *User `json:"user"`
	jwt.StandardClaims
}

type UserStatus

type UserStatus string

type UserType

type UserType string

Jump to

Keyboard shortcuts

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