auth

package
v0.0.0-...-425066b Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2016 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTokenExpired returned when the jwt token has expired
	ErrTokenExpired = errors.New("JWT token has expired")
)

Functions

func GenerateClaim

func GenerateClaim(certs *Certs, usr *models.User) (string, error)

GenerateClaim generate a JWT token containing a claim using the supplied certificates and user

func ValidateClaim

func ValidateClaim(certs *Certs, token string) (*models.User, error)

ValidateClaim validate the JWT token and return the user model decoded from the claim

Types

type Certs

type Certs struct {
	PublicKey  *rsa.PublicKey
	PrivateKey *rsa.PrivateKey
}

Certs used by JWT to sign and verify tokens

func GenerateTestCerts

func GenerateTestCerts() (*Certs, error)

GenerateTestCerts generate certs for testing or hacking

Jump to

Keyboard shortcuts

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