keyutil

package
v0.0.0-...-8dc6894 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2020 License: Unlicense Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HEADER_CLIENT_NAME  = "x-client-role"
	HEADER_USER_ID      = "x-user-id"
	HEADER_IS_LOGGED_IN = "x-client-is-logged-in"
	ORIGINAL_TOKEN      = "x-jwt-token"
)

Variables

This section is empty.

Functions

func VerifyJwt

func VerifyJwt(rawToken string, validator func(*AppClaims) (bool, error)) (bool, error)

VerifyJwt parses and verifies token

Types

type AppClaims

type AppClaims struct {
	ClientID string `json:"cid"`
	UserID   string `json:"uid"`
	Role     string `json:"role"`
	jwt.Claims
}

Claims

func GetClaimsFromToken

func GetClaimsFromToken(rawToken string) (*AppClaims, error)

GetClaimsFromToken gets AppClaims from token

func NewAppClaims

func NewAppClaims(cid, uid, iss, role string, aud []string, dur time.Duration) *AppClaims

NewAppClaims creates new app claims

func (*AppClaims) CreateJwtClaims

func (a *AppClaims) CreateJwtClaims(signer Signer) (string, error)

CreateJwtClaims creates jwt claims with specified Issuer, Audience, and Duration

type KeyType

type KeyType int
const (
	RSA KeyType = iota
	ECC
)

func (*KeyType) GenSigningKeys

func (k *KeyType) GenSigningKeys(path string) error

func (*KeyType) ReadSignerKey

func (k *KeyType) ReadSignerKey() (jose.Signer, error)

func (*KeyType) String

func (k *KeyType) String() string

type Signer

type Signer jose.Signer

Wrapper for jose.Signer

Jump to

Keyboard shortcuts

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