auth

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const RequestContextKey = ContextKey("request")

Variables

This section is empty.

Functions

func AuthMiddleware

func AuthMiddleware(next http.Handler) http.Handler

func CreateNewToken

func CreateNewToken(nodeId string) (string, error)

func ParseJwtTokenWithCustomClaims added in v0.2.0

func ParseJwtTokenWithCustomClaims(jwtToken string) (*jwt.Token, error)

func SetAuthSecret

func SetAuthSecret(secret string) error

Types

type ContextKey

type ContextKey string

type CustomClaims

type CustomClaims struct {
	Authorized bool   `json:"authorized"`
	NodeId     string `json:"node_id"`
	jwt.StandardClaims
}

type RequestContext

type RequestContext struct {
	NodeId    string
	Timestamp time.Time
}

Jump to

Keyboard shortcuts

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