security

package
v0.0.0-...-73e35a2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2017 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClaimsSigning = errors.New("error on claims signing")

ErrClaimsSigning occurs in jwt signing, data safe.

View Source
var ErrMissingUIDString = errors.New("missing uid string")

ErrMissingUIDString occurs when given a struct without an UIDString.

View Source
var ErrUnexpectedSigningMethod = errors.New("unexpected signing method")

ErrUnexpectedSigningMethod is given if there is a signing method mismatch in the token header.

Functions

func LoginToken

func LoginToken(user *db.User) (string, int64, error)

LoginToken given a user, returns a JWT string, and its expiration.

func StructUIDToken

func StructUIDToken(data interface{}) (string, error)

StructUIDToken will given a struct with an UIDString, return a JWT certifying that the UID corresponds to that struct type.

func VerifyLoginToken

func VerifyLoginToken(tokenString string, user *db.User) bool

VerifyLoginToken will given a JWT token, and a loginType as a string, returns true if the logintype matches and the token has not expired, false otherwise.

func VerifyStructUIDToken

func VerifyStructUIDToken(tokenString string, typeString string, UIDString string) bool

VerifyStructUIDToken will given a JWT token, and a struct name, and an UIDString, verify that the JWT token corresponds to those.

Types

type LoginClaims

type LoginClaims struct {
	jwt.StandardClaims
}

LoginClaims are jwt standard claims, with LoginType (ltp in json)

Jump to

Keyboard shortcuts

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