user

package
v0.0.0-...-4de3c4e Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package user contains the basic admin user creation and authentication code, specific to Instio systems.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auth

func Auth(next http.HandlerFunc) http.HandlerFunc

Auth is HTTP middleware to ensure the request has proper token credentials

func IsUser

func IsUser(usr *User, password string) bool

IsUser checks for consistency in email/pass combination

func IsValid

func IsValid(req *http.Request) bool

IsValid checks if the user request is authenticated

Types

type User

type User struct {
	ID    int    `json:"id"`
	Email string `json:"email"`
	Hash  string `json:"hash"`
	Salt  string `json:"salt"`
}

User defines a admin user in the system

func New

func New(email, password string) (*User, error)

New creates a user

Jump to

Keyboard shortcuts

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