jwt

package
v0.0.0-...-d1ce05c Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2016 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CLAIMS denotes the key to get the claims from context
	CLAIMS = "Claims"

	// TOKENERROR denotes the key to get the token error from context
	TOKENERROR = "TokenError"
)

Variables

View Source
var ErrPrivateKey = errors.New("Private key location empty.")

ErrPrivateKey indicates a missing private key location

View Source
var ErrPublicKey = errors.New("Public key location empty.")

ErrPublicKey indicates a missing public key location

View Source
var ErrTokenExpired = errors.New("Token expired")

ErrTokenExpired indicates an expired token

View Source
var ErrTokenMissing = errors.New("Token missing.")

ErrTokenMissing indicates a missing token

View Source
var ErrUnrecognizedTokenFormat = errors.New("Unrecognized token format")

ErrUnrecognizedTokenFormat indicates an invalid token format

Functions

func Init

func Init(pubKeyFile, privKeyFile io.Reader, keyPass []byte) error

Init initialises the jwt middlewares with pubKeyFile, privKeyFile and keyPass

func MustValidate

func MustValidate(errorHandler goji.Handler) func(goji.Handler) goji.Handler

MustValidate returns a middleware for parsing and validating JSON Web Tokens. When this middleware is used, the token must be present in the request and should be valid valid. If the token is invalid, the defaultErrorHandler or the errorHandler provided will be handling the request.

func Validate

func Validate(h goji.Handler) goji.Handler

Validate is a middleware for parsing and validating JSON Web Tokens

Types

type Claims

type Claims struct {
	Iss           string `json:"iss,omitempty"`
	Aud           string `json:"aud,omitempty"`
	IsTrusted     string `json:"isTrusted,omitempty"`
	Sub           string `json:"sub,omitempty"`
	Name          string `json:"name,omitempty"`
	FirstName     string `json:"firstName,omitempty"`
	LastName      string `json:"lastName,omitempty"`
	ProfileImage  string `json:"profileImage,omitempty"`
	EmailVerified string `json:"emailVerified,omitempty"`
	Email         string `json:"email,omitempty"`
	Nonce         string `json:"nonce,omitempty"`
	AtHash        string `json:"at_hash,omitempty"`
	Iat           int    `json:"iat,omitempty"`
	Exp           int    `json:"exp,omitempty"`
}

Claims represents the claims for sso token

type ErrInvalidToken

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

ErrInvalidToken indicates an invalid token

func (ErrInvalidToken) Error

func (e ErrInvalidToken) Error() string

Jump to

Keyboard shortcuts

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