auth

package
v0.0.0-...-081aa00 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRoutes

func AddRoutes(r *mux.Router, service Service)

func AuthenticateFunc

func AuthenticateFunc(service Service, f http.HandlerFunc) http.HandlerFunc

Types

type Claims

type Claims struct {
	jwt.StandardClaims
}

type LoginRequest

type LoginRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type Service

type Service interface {
	Login(r LoginRequest) (*jwt.Token, error)
	Sign(t *jwt.Token) (string, error)
	Parse(ss string) (*jwt.Token, error)
}

func NewService

func NewService(secret string, tokenDuration time.Duration, users map[string]string) Service

type UserInfo

type UserInfo struct {
	Username string `json:"username"`
}

Jump to

Keyboard shortcuts

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