jwt

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2016 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateToken

func CreateToken(claims Claims, key interface{}) (string, error)

CreateToken takes some claims and a private key (either rsa or ec) and returns a signed json web token

func GetTokenFromRequest added in v0.2.0

func GetTokenFromRequest(r *http.Request) (string, error)

GetTokenFromRequest takes the first Authorization header and extracts the bearer json web token

func LoadPrivateKey

func LoadPrivateKey(keyFile string) (interface{}, error)

LoadPublicKey loads a PEM encoded private key (either rsa or ec)

func LoadPublicKey

func LoadPublicKey(keyFile string) (interface{}, error)

LoadPublicKey loads a PEM encoded public key (either rsa or ec)

Types

type Claims

type Claims map[string]interface{}

Claims is a map of string->something containing the meta infos associated with a token

func GetClaimsFromRequest added in v0.2.0

func GetClaimsFromRequest(r *http.Request, key interface{}) (Claims, error)

GetClaimsFromRequest extracts the

func ValidateToken

func ValidateToken(tokenString string, key interface{}) (Claims, error)

ValidateToken checks the signature of the token with a given public key and returns the associated claims

Jump to

Keyboard shortcuts

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