jwt

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrJWTInvalidClaims = echo.NewHTTPError(http.StatusUnauthorized, "invalid jwt claims")
)

Errors

Functions

This section is empty.

Types

type AuthClaims

type AuthClaims struct {
	jwt.StandardClaims
	Dashboard bool `json:"dashboard"`
	API       bool `json:"api"`
}

func (*AuthClaims) VerifySubject added in v1.0.2

func (c *AuthClaims) VerifySubject(expected string) bool

type JWTAuth

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

func NewJWTAuth

func NewJWTAuth(subject string, sessionTimeout time.Duration, nodeID string, secret crypto.PrivKey) (*JWTAuth, error)

func (*JWTAuth) IssueJWT

func (j *JWTAuth) IssueJWT(api bool, dashboard bool) (string, error)

func (*JWTAuth) Middleware

func (j *JWTAuth) Middleware(skipper middleware.Skipper, allow func(c echo.Context, subject string, claims *AuthClaims) bool) echo.MiddlewareFunc

func (*JWTAuth) VerifyJWT

func (j *JWTAuth) VerifyJWT(token string, allow func(claims *AuthClaims) bool) bool

Jump to

Keyboard shortcuts

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