jwt

package
v0.0.0-...-b27e624 Latest Latest
Warning

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

Go to latest
Published: May 5, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccessLevelFull  = float32(0)
	AccessLevelLeast = float32(10)

	AccessLevelSuper   = float32(1)
	AccessLevelAdmin   = float32(3)
	AccessLevelStaff   = float32(7)
	AccessLevelUser    = float32(9)
	AccessLevelVisitor = float32(9.5)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthMSClaim

type AuthMSClaim struct {
	UsrID string
	Group Group
	jwt.StandardClaims
}

func NewClaim

func NewClaim(issuer, usrID string, g Group, validity time.Duration) *AuthMSClaim

type Group

type Group struct {
	AccessLevel float32
}

type JWTEr

type JWTEr interface {
	errors.IsAuthErrChecker
	Generate(claims jwt.Claims) (string, error)
	Validate(JWT string, claims jwt.Claims) (*jwt.Token, error)
}

type Manager

type Manager struct {
	JWTEr
}

func NewManager

func NewManager(opts ...Option) (*Manager, error)

func (Manager) IsOwnerOrJWTHasAccess

func (v Manager) IsOwnerOrJWTHasAccess(JWT string, owner string, acl float32) (*AuthMSClaim, error)

func (Manager) JWTHasAccess

func (v Manager) JWTHasAccess(JWT string, acl float32) (*AuthMSClaim, error)

func (Manager) JWTValid

func (v Manager) JWTValid(JWT string) (*AuthMSClaim, error)

func (Manager) JWTValidOnClaim

func (v Manager) JWTValidOnClaim(JWT string, clm jwt.Claims) error

type ManagerConfig

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

type Option

type Option func(*ManagerConfig) error

func WithHS256Key

func WithHS256Key(key []byte) Option

func WithJWTEr

func WithJWTEr(jwter JWTEr) Option

Jump to

Keyboard shortcuts

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