middleware

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SUCCESS                        = 200
	INVALID_PARAMS                 = 99
	ERROR_AUTH_CHECK_TOKEN_TIMEOUT = 98
	ERROR_AUTH_CHECK_TOKEN_FAIL    = 97

	ISSUER = "realjf"
)

Variables

This section is empty.

Functions

func AccessLogger

func AccessLogger(next http.Handler) http.Handler

log

func GenerateToken

func GenerateToken(username, password string) (string, error)

func JWT

func JWT(next http.Handler) http.Handler

func SafeHandler

func SafeHandler(next http.Handler) http.Handler

log

Types

type Authentication

type Authentication struct {
	// contains filtered or unexported fields
}

func NewAuthentication

func NewAuthentication() *Authentication

func (*Authentication) Middleware

func (amw *Authentication) Middleware(next http.Handler) http.Handler

Middleware function, which will be called for each request

func (*Authentication) Populate

func (amw *Authentication) Populate()

初始化授权口令

type Claims

type Claims struct {
	Username string `json:"username"`
	Password string `json:"password"`
	jwt.StandardClaims
}

func ParseToken

func ParseToken(token string) (*Claims, error)

type Log

type Log struct {
	Logger *logging.Logger
}
var (
	Logger *Log
)

func NewLogger

func NewLogger() *Log

func (*Log) Init

func (l *Log) Init() *Log

type Session

type Session struct {
	// contains filtered or unexported fields
}

func NewSession

func NewSession(cookieName string) *Session

func (*Session) Middleware

func (s *Session) Middleware(next http.Handler) http.Handler

func (*Session) Populate

func (s *Session) Populate()

会话token

func (*Session) SetCookie

func (s *Session) SetCookie(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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