admin

package
v0.1.0-beta Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateUserIDToken

func CreateUserIDToken(key []byte, userID string) (string, error)

CreateUserIDToken ForContext finds the user from the context. REQUIRES Middleware to have run.

func ForContext

func ForContext(ctx context.Context) *ent.Admin

ForContext finds the user from the context. REQUIRES Middleware to have run.

func GinMiddleware

func GinMiddleware(conn *storage.Conn, key []byte) gin.HandlerFunc

GinMiddleware decodes the share session cookie and packs the session into context

func Init

func Init(ctx context.Context, admins []User, store *storage.Conn) error

Init creates admin object in the DB from the given configuration.

func Middleware

func Middleware(conn *storage.Conn, key []byte) func(http.Handler) http.Handler

Middleware decodes the share session cookie and packs the session into context

Types

type User

type User struct {
	Name     string
	Username string
	Password string
}

User will store the credentials of an admin.

Jump to

Keyboard shortcuts

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