jwthandler

package
v0.0.0-...-b0cbc73 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2016 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidJWT   = errors.New("Invalid JWT token.")
	ErrRevokedToken = errors.New("Token is revoked.")
)
View Source
var (
	// ErrMissingKeyID should be used when the kid attribute is missing in the JWT header
	ErrMissingKeyID = errors.New("Missing key Id in the JWT header")
	// ErrInvalidKeyID should be used when the content of the kid attribute is invalid
	ErrInvalidKeyID = errors.New("Invalid key Id in the JWT header")
)
View Source
var (
	// ErrInvalidClaimScope should be used whenever the scope claim is invalid or missing in the JWT
	ErrInvalidClaimScope = errors.New("Invalid claim: scope")
	// ErrInvalidClaimSub should be used whenever the scope sub is invalid or missing in the JWT
	ErrInvalidClaimSub = errors.New("Invalid claim: sub")
	// ErrInvalidClaimRealm should be used whenever the scope realm is invalid or missing in the JWT
	ErrInvalidClaimRealm = errors.New("Invalid claim: realm")
	ErrInvalidClaimAzp   = errors.New("Invalid claim: azp")
	// ErrInvalidClaimExp should be used whenever the scope exp is invalid or missing in the JWT
	ErrInvalidClaimExp = errors.New("Invalid claim: exp")
)

Functions

func New

New returns an http.Handler that is able to validate JWT tokens

Types

type TokenInfo

type TokenInfo struct {
	AccessToken  string   `json:"access_token"`
	RefreshToken string   `json:"refresh_token,omitempty"`
	UID          string   `json:"uid"`
	GrantType    string   `json:"grant_type"`
	Scope        []string `json:"scope"`
	Realm        string   `json:"realm"`
	ClientId     string   `json:"client_id"`
	TokenType    string   `json:"token_type"`
	ExpiresIn    int      `json:"expires_in"`
}

TokenInfo type is used to serialize a JWT validation result in a standard Token Info JSON format

func (*TokenInfo) Marshal

func (ti *TokenInfo) Marshal(w io.Writer) error

Jump to

Keyboard shortcuts

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