jws

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeSegment

func DecodeSegment(seg string) ([]byte, error)

DecodeSegment Decode JWT specific base64url encoding with padding stripped.

func EncodeSegment

func EncodeSegment(seg []byte) string

EncodeSegment Encode JWT specific base64url encoding with padding stripped.

Types

type Claims

type Claims interface {
	Valid() error
}

Claims represents JWT Claims Section.

type MapClaims

type MapClaims map[string]interface{}

MapClaims represents Claims type using the map[string]interface{} for JSON decoding.

func (MapClaims) Valid

func (m MapClaims) Valid() error

Valid forever.

type StandardClaims

type StandardClaims struct {
	Audience  string `json:"aud,omitempty"`
	ExpiresAt int64  `json:"exp,omitempty"`
	ID        string `json:"jti,omitempty"`
	IssuedAt  int64  `json:"iat,omitempty"`
	Issuer    string `json:"iss,omitempty"`
	NotBefore int64  `json:"nbf,omitempty"`
	Subject   string `json:"sub,omitempty"`
}

StandardClaims represents Structured version of JWT Claims Section.

func (StandardClaims) Valid

func (c StandardClaims) Valid() error

Valid forever.

type Token

type Token struct {
	Raw       string                 // The raw token
	Header    map[string]interface{} // The first segment of the token
	Claims    Claims                 // The second segment of the token
	Signature string                 // The third segment of the token
}

Token represents a JWT Token.

func Parse

func Parse(tokenString string) (*Token, error)

Parse validate and return a token.

func ParseUnverified

func ParseUnverified(tokenString string, claims Claims) (token *Token, err error)

ParseUnverified parses the token but doesn't validate the signature.

func ParseWithClaims

func ParseWithClaims(tokenString string, claims Claims) (*Token, error)

ParseWithClaims validate with given Claims and return a token.

Jump to

Keyboard shortcuts

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