authentication

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2019 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JWTContext

func JWTContext(next http.Handler) http.Handler

Types

type Claims

type Claims struct {
	ID       int64   `json:"id"`
	Name     *string `json:"username"`
	Admin    bool    `json:"admin"`
	Country  *string `json:"country"`
	Locale   *string `json:"locale"`
	Verified bool    `json:"verified"`
	Banned   bool    `json:"banned"`
	jwt.StandardClaims
}

type Context

type Context struct {
	Claims Claims
	Token  string
}

type Level

type Level int
const (
	CLAIMS    Level = -1 // just the claims context tag
	PUBLIC    Level = 0  // public return
	USER      Level = 1  // user return
	ADMINUSER Level = 2  // admin wants to change password. admins cant change other users passwords so this exists
	ADMIN     Level = 3  // admin return
	SERVER    Level = 4  // server can update any user without giving 2 shits
)

Jump to

Keyboard shortcuts

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