jwt

package
v3.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2017 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package jwt implements JWT (JSON Web Token).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authority

type Authority interface {
	Hash() hash.Hash
	Alg() string
}

Authority is the interface for the authority of JWS (JSON Web Signature).

type Claim

type Claim struct {
	Sub      string
	Scope    string
	Duration time.Duration
	Tmp      bool
}

Claim is a structure to hold the processed and validated claim

type Error

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

Error is a structure to hold the error and URI for the description.

func (Error) IsError

func (jwtError Error) IsError() bool

IsError returns whether it indicates an error or not.

func (Error) URI

func (jwtError Error) URI() string

URI returns the URI which describes the error.

type JWT

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

JWT is the structure to hold the context of the JWT issuer and signer.

func New

func New(authority Authority) JWT

New returns a new jwt.JWT.

func (JWT) Authenticate

func (context JWT) Authenticate(jwt string) (Claim, Error)

Authenticate returns the authenticated claim of the given JWT.

func (JWT) Issue

func (context JWT) Issue(sub string, scope string,
	duration time.Duration, temporary bool) (string, error)

Issue takes a subject name and returns a new JWT for him.

type Time

type Time struct {
	time.Time
}

Time is a type to represent a time.

func (Time) MarshalJSON

func (marshallable Time) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of the value.

This implements an interface used in encoding/encoding.

json - The Go Programming Language Example (CustomMarshalJSON) https://golang.org/pkg/encoding/json/#example__customMarshalJSON

func (*Time) UnmarshalJSON

func (marshallable *Time) UnmarshalJSON(data []byte) error

UnmarshalJSON sets *marshallable to unmarshalled value from JSON.

This implements an interface used in encoding/encoding.

json - The Go Programming Language Example (CustomMarshalJSON) https://golang.org/pkg/encoding/json/#example__customMarshalJSON

Jump to

Keyboard shortcuts

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