auth

package
v0.0.0-...-0ce3674 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultKey = `` /* 358-byte string literal not displayed */

)

Variables

View Source
var (
	ErrInvalidRoleclaims = errors.New("invalid role claims")
)

Functions

func Decode

func Decode(pemEncoded string) *ecdsa.PrivateKey

func Encode

func Encode(privateKey *ecdsa.PrivateKey) string

func FromBase64

func FromBase64(key string) (*ecdsa.PrivateKey, error)

func New

func New() (*ecdsa.PrivateKey, *ecdsa.PublicKey)

func NewBase64

func NewBase64() string

func NewToken

func NewToken(claim *RoleClaims, private interface{}) (string, error)

Types

type RoleClaims

type RoleClaims struct {
	Roles []string `json:"roles"`
	jwt.StandardClaims
}

func NewRoleClaims

func NewRoleClaims(roles []string) *RoleClaims

func ParseAndCheckToken

func ParseAndCheckToken(token string, pubKey interface{}) (*RoleClaims, error)

func (*RoleClaims) String

func (r *RoleClaims) String() string

Jump to

Keyboard shortcuts

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